rpm 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 2013-10-24 Duncan Mac-Vicar P. <dmacvicar@suse.de>
3
+
4
+ * v0.0.4
5
+ * Bugfix: too many open files on transaction with blocks
6
+
2
7
  2012-02-23 Duncan Mac-Vicar P. <dmacvicar@suse.de>
3
8
 
4
9
  * RPM::FFI module is now RPM::C
data/lib/rpm.rb CHANGED
@@ -31,9 +31,13 @@ module RPM
31
31
  # end
32
32
  #
33
33
  def self.transaction(root = '/')
34
- ts = Transaction.new
35
- ts.root_dir = root
36
- yield ts
34
+ begin
35
+ ts = Transaction.new
36
+ ts.root_dir = root
37
+ yield ts
38
+ ensure
39
+ ts.ptr.free
40
+ end
37
41
  end
38
42
 
39
43
  # @param [String] name Name of the macro
@@ -7,7 +7,7 @@ module RPM
7
7
  :none, 0,
8
8
  :config, (1 << 0),
9
9
  :doc, (1 << 1),
10
- :icon, (1 <<2),
10
+ :icon, (1 << 2),
11
11
  :missingok, (1 << 3),
12
12
  :noreplace, (1 << 4),
13
13
  :specfile, (1 << 5),
@@ -34,17 +34,17 @@ module RPM
34
34
 
35
35
  # @return [Boolean] True if the file is marked as a configuration file
36
36
  def config?
37
- ! (@attr & FileAttrs[:config]).zero?
37
+ ! (@attr & RPM::C::FileAttrs[:config]).zero?
38
38
  end
39
39
 
40
40
  # @return [Boolean] True if the file is marked as documentation
41
41
  def doc?
42
- ! (@attr & FileAttrs[:doc]).zero?
42
+ ! (@attr & RPM::C::FileAttrs[:doc]).zero?
43
43
  end
44
44
 
45
45
  # @return [Boolean] True if the file is marked as do not use
46
46
  def donotuse?
47
- ! (@attr & FileAttrs[:donotuse]).zero?
47
+ ! (@attr & RPM::C::FileAttrs[:donotuse]).zero?
48
48
  end
49
49
 
50
50
  # @return [Boolean] True if the file is marked that can be missing on disk
@@ -52,7 +52,7 @@ module RPM
52
52
  # This modifier is used for files or links that are created during the %post scripts
53
53
  # but will need to be removed if the package is removed
54
54
  def is_missingok?
55
- ! (@attr & FileAttrs[:missingok]).zero?
55
+ ! (@attr & RPM::C::FileAttrs[:missingok]).zero?
56
56
  end
57
57
 
58
58
  # @return [Boolean] True if the file is marked as configuration not to be replaced
@@ -63,12 +63,12 @@ module RPM
63
63
  # if the file has been modified on disk, the rpm command will copy the new file with an extra
64
64
  # file-name extension of .rpmnew.
65
65
  def is_noreplace?
66
- ! (@attr & FileAttrs[:noreplace]).zero?
66
+ ! (@attr & RPM::C::FileAttrs[:noreplace]).zero?
67
67
  end
68
68
 
69
69
  # @return [Boolean] True if the file is marked as a spec file
70
70
  def is_specfile?
71
- ! (@attr & FileAttrs[:specfile]).zero?
71
+ ! (@attr & RPM::C::FileAttrs[:specfile]).zero?
72
72
  end
73
73
 
74
74
  # @return [Boolean] True if the file is marked as ghost
@@ -78,37 +78,37 @@ module RPM
78
78
  # will create.
79
79
  # For example, you may want to ensure that a program’s log file has certain attributes.
80
80
  def ghost?
81
- ! (@attr & FileAttrs[:ghost]).zero?
81
+ ! (@attr & RPM::C::FileAttrs[:ghost]).zero?
82
82
  end
83
83
 
84
84
  # @return [Boolean] True if the file is a license
85
85
  def license?
86
- ! (@attr & FileAttrs[:license]).zero?
86
+ ! (@attr & RPM::C::FileAttrs[:license]).zero?
87
87
  end
88
88
 
89
89
  # @return [Boolean] True if the file is a README
90
90
  def readme?
91
- ! (@attr & FileAttrs[:readme]).zero?
91
+ ! (@attr & RPM::C::FileAttrs[:readme]).zero?
92
92
  end
93
93
 
94
94
  # @return [Boolean] True if the file is listed in the exlude section
95
95
  def exclude?
96
- ! (@attr & FileAttrs[:exclude]).zero?
96
+ ! (@attr & RPM::C::FileAttrs[:exclude]).zero?
97
97
  end
98
98
 
99
99
  # @return [Boolean] True if the file is replaced during installation
100
100
  def replaced?
101
- ! (@attr & FileState[:replaced]).zero?
101
+ ! (@attr & RPM::C::FileState[:replaced]).zero?
102
102
  end
103
103
 
104
104
  # @return [Boolean] True if the file is not installed
105
105
  def notinstalled?
106
- ! (@attr & FileState[:notinstalled]).zero?
106
+ ! (@attr & RPM::C::FileState[:notinstalled]).zero?
107
107
  end
108
108
 
109
109
  # @return [Boolean] True if the file is shared over the network
110
110
  def netshared?
111
- ! (@attr & FileState[:netshared]).zero?
111
+ ! (@attr & RPM::C::FileState[:netshared]).zero?
112
112
  end
113
113
 
114
114
  def initialize(path, md5sum, link_to, size, mtime, owner, group, rdev, mode, attr, state)
@@ -3,5 +3,5 @@
3
3
  # is because it conflicts with the version.rb class
4
4
  module RPM
5
5
  PKG_NAME = "ruby-rpm"
6
- GEM_VERSION = "0.0.3"
6
+ GEM_VERSION = "0.0.4"
7
7
  end
@@ -8,5 +8,25 @@ class RPM_File_Tests < Test::Unit::TestCase
8
8
  f = RPM::File.new("path", "md5sum", "link_to", 42, 1,
9
9
  "owner", "group", 43, 0777, 44, 45)
10
10
  assert_equal("link_to", f.link_to)
11
- end
11
+ end
12
+
13
+ def test_flags
14
+ f = RPM::File.new("path", "md5sum", nil, 42, 1,
15
+ "owner", "group", 43, 0777, 44, 45)
16
+ f.config?
17
+ f.doc?
18
+ f.donotuse?
19
+ f.is_missingok?
20
+ f.is_noreplace?
21
+ f.is_specfile?
22
+ f.ghost?
23
+ f.license?
24
+ f.readme?
25
+ f.exclude?
26
+ f.replaced?
27
+ f.notinstalled?
28
+ f.netshared?
29
+ end
30
+
31
+
12
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &20015700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *20015700
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: ffi
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &20034180 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,12 +32,7 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *20034180
46
36
  description: Ruby bindings for rpm. Almost a drop-in replacement for ruby-rpm. Uses
47
37
  FFI.
48
38
  email:
@@ -122,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
112
  version: '0'
123
113
  requirements: []
124
114
  rubyforge_project: rpm
125
- rubygems_version: 1.8.23
115
+ rubygems_version: 1.8.11
126
116
  signing_key:
127
117
  specification_version: 3
128
118
  summary: Ruby bindings for rpm (package manager)