rpm 0.0.0 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/MIT-LICENSE +24 -0
- data/README.rdoc +298 -0
- data/Rakefile +32 -1
- data/lib/rpm/compat.rb +43 -0
- data/lib/rpm/db.rb +125 -0
- data/lib/rpm/dependency.rb +132 -0
- data/lib/rpm/ffi/header.rb +37 -0
- data/lib/rpm/ffi/rpmcallback.rb +26 -0
- data/lib/rpm/ffi/rpmdb.rb +22 -0
- data/lib/rpm/ffi/rpmds.rb +51 -0
- data/lib/rpm/ffi/rpmfi.rb +34 -0
- data/lib/rpm/ffi/rpmlib.rb +15 -0
- data/lib/rpm/ffi/rpmlog.rb +24 -0
- data/lib/rpm/ffi/rpmmacro.rb +38 -0
- data/lib/rpm/ffi/rpmprob.rb +42 -0
- data/lib/rpm/ffi/rpmps.rb +13 -0
- data/lib/rpm/ffi/rpmtag.rb +299 -0
- data/lib/rpm/ffi/rpmtd.rb +37 -0
- data/lib/rpm/ffi/rpmts.rb +70 -0
- data/lib/rpm/ffi/rpmtypes.rb +29 -0
- data/lib/rpm/ffi.rb +44 -0
- data/lib/rpm/file.rb +132 -0
- data/lib/rpm/gem_version.rb +7 -0
- data/lib/rpm/match_iterator.rb +73 -0
- data/lib/rpm/package.rb +344 -0
- data/lib/rpm/transaction.rb +130 -0
- data/lib/rpm/utils.rb +10 -0
- data/lib/rpm/version.rb +154 -1
- data/lib/rpm.rb +74 -3
- data/rpm.gemspec +10 -4
- data/test/data/a.spec +49 -0
- data/test/data/simple-1.0-0.i586.rpm +0 -0
- data/test/data/simple.spec +42 -0
- data/test/helper.rb +7 -0
- data/test/test_dependency.rb +29 -0
- data/test/test_file.rb +12 -0
- data/test/test_lib.rb +36 -0
- data/test/test_package.rb +60 -0
- data/test/test_rpm.rb +37 -0
- data/test/test_transaction.rb +61 -0
- data/test/test_version.rb +63 -0
- metadata +74 -13
- data/README +0 -3
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'helper')
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
class RPM_Transaction_Tests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_flags
|
7
|
+
RPM.transaction do |t|
|
8
|
+
assert_equal RPM::TRANS_FLAG_NONE, t.flags
|
9
|
+
t.flags = RPM::TRANS_FLAG_TEST
|
10
|
+
assert_equal RPM::TRANS_FLAG_TEST, t.flags
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_iterator
|
15
|
+
RPM.transaction do |t|
|
16
|
+
it = t.init_iterator(nil, nil)
|
17
|
+
assert_kind_of RPM::MatchIterator, it
|
18
|
+
#assert it.count > 0
|
19
|
+
end
|
20
|
+
|
21
|
+
RPM.transaction do |t|
|
22
|
+
it = t.init_iterator(nil, nil)
|
23
|
+
it.regexp(:name, :glob, '*audio*')
|
24
|
+
it.each do |pkg|
|
25
|
+
assert pkg.name.include?("audio"), "'#{pkg.name}' contains 'audio'"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# FIXME this is not working
|
31
|
+
def test_iterator_version
|
32
|
+
RPM.transaction do |t|
|
33
|
+
it = t.init_iterator(nil, nil)
|
34
|
+
it.version(RPM::Version.new('2.1'))
|
35
|
+
it.each do |pkg|
|
36
|
+
puts pkg
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_install
|
42
|
+
|
43
|
+
filename = 'simple-1.0-0.i586.rpm'
|
44
|
+
pkg = RPM::Package.open(fixture(filename))
|
45
|
+
|
46
|
+
Dir.mktmpdir do |dir|
|
47
|
+
RPM.transaction do |t|
|
48
|
+
assert_equal "/", t.root_dir
|
49
|
+
t.root_dir = dir
|
50
|
+
assert_equal dir + '/', t.root_dir
|
51
|
+
|
52
|
+
t.flags = RPM::TRANS_FLAG_TEST
|
53
|
+
|
54
|
+
t.install(pkg, filename)
|
55
|
+
#t.commit
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'helper')
|
2
|
+
|
3
|
+
class RPM_Version_Tests < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@a = RPM::Version.new( '1.0.0-0.1m' )
|
6
|
+
@b = RPM::Version.new( '0.9.0-1m' )
|
7
|
+
@c = RPM::Version.new( '1.0.0-0.11m' )
|
8
|
+
@d = RPM::Version.new( '0.9.0-1m', 1)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_parse_evr
|
12
|
+
assert_equal [23, '1.0.3', '1suse'],
|
13
|
+
RPM::Version.parse_evr("23:1.0.3-1suse")
|
14
|
+
assert_equal [nil, '1.0', nil],
|
15
|
+
RPM::Version.parse_evr("1.0")
|
16
|
+
assert_equal [nil, '2.0', '3'],
|
17
|
+
RPM::Version.parse_evr("2.0-3")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_version_compare
|
21
|
+
assert( @a > @b )
|
22
|
+
assert( @a < @c )
|
23
|
+
assert( @a < @d )
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_version_newer?
|
27
|
+
assert( @a.newer?(@b) )
|
28
|
+
assert( @c.newer?(@a) )
|
29
|
+
assert( @d.newer?(@a) )
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_version_older?
|
33
|
+
assert( @b.older?(@a) )
|
34
|
+
assert( @a.older?(@c) )
|
35
|
+
assert( @a.older?(@d) )
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_vre
|
39
|
+
assert_equal( '0.9.0', @d.v )
|
40
|
+
assert_equal( '1m', @d.r )
|
41
|
+
assert_equal( 1, @d.e )
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_to_s
|
45
|
+
assert_equal( '0.9.0-1m', @b.to_s )
|
46
|
+
assert_equal( '0.9.0-1m', @d.to_s )
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_to_vre
|
50
|
+
assert_equal( '0.9.0-1m', @b.to_vre )
|
51
|
+
assert_equal( '1:0.9.0-1m', @d.to_vre )
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_epoch_none_zero
|
55
|
+
v1 = RPM::Version.new("1-2")
|
56
|
+
v2 = RPM::Version.new("0:1-2")
|
57
|
+
assert_equal(nil, v1.e)
|
58
|
+
assert_equal(0, v2.e)
|
59
|
+
assert( v1 == v2 )
|
60
|
+
assert_equal(v1.hash, v2.hash)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Duncan Mac-Vicar P.
|
@@ -15,10 +15,24 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
date: 2012-01-04 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: ffi
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Ruby bindings for rpm. Almost a drop-in replacement for ruby-rpm. Uses FFI.
|
22
36
|
email:
|
23
37
|
- dmacvicar@suse.de
|
24
38
|
executables: []
|
@@ -30,11 +44,48 @@ extra_rdoc_files: []
|
|
30
44
|
files:
|
31
45
|
- .gitignore
|
32
46
|
- Gemfile
|
33
|
-
-
|
47
|
+
- MIT-LICENSE
|
48
|
+
- README.rdoc
|
34
49
|
- Rakefile
|
35
50
|
- lib/rpm.rb
|
51
|
+
- lib/rpm/compat.rb
|
52
|
+
- lib/rpm/db.rb
|
53
|
+
- lib/rpm/dependency.rb
|
54
|
+
- lib/rpm/ffi.rb
|
55
|
+
- lib/rpm/ffi/header.rb
|
56
|
+
- lib/rpm/ffi/rpmcallback.rb
|
57
|
+
- lib/rpm/ffi/rpmdb.rb
|
58
|
+
- lib/rpm/ffi/rpmds.rb
|
59
|
+
- lib/rpm/ffi/rpmfi.rb
|
60
|
+
- lib/rpm/ffi/rpmlib.rb
|
61
|
+
- lib/rpm/ffi/rpmlog.rb
|
62
|
+
- lib/rpm/ffi/rpmmacro.rb
|
63
|
+
- lib/rpm/ffi/rpmprob.rb
|
64
|
+
- lib/rpm/ffi/rpmps.rb
|
65
|
+
- lib/rpm/ffi/rpmtag.rb
|
66
|
+
- lib/rpm/ffi/rpmtd.rb
|
67
|
+
- lib/rpm/ffi/rpmts.rb
|
68
|
+
- lib/rpm/ffi/rpmtypes.rb
|
69
|
+
- lib/rpm/file.rb
|
70
|
+
- lib/rpm/gem_version.rb
|
71
|
+
- lib/rpm/match_iterator.rb
|
72
|
+
- lib/rpm/package.rb
|
73
|
+
- lib/rpm/transaction.rb
|
74
|
+
- lib/rpm/utils.rb
|
36
75
|
- lib/rpm/version.rb
|
37
76
|
- rpm.gemspec
|
77
|
+
- test/data/a.spec
|
78
|
+
- test/data/simple-1.0-0.i586.rpm
|
79
|
+
- test/data/simple.spec
|
80
|
+
- test/helper.rb
|
81
|
+
- test/test_dependency.rb
|
82
|
+
- test/test_file.rb
|
83
|
+
- test/test_lib.rb
|
84
|
+
- test/test_package.rb
|
85
|
+
- test/test_rpm.rb
|
86
|
+
- test/test_transaction.rb
|
87
|
+
- test/test_version.rb
|
88
|
+
has_rdoc: true
|
38
89
|
homepage: ""
|
39
90
|
licenses: []
|
40
91
|
|
@@ -63,10 +114,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
114
|
version: "0"
|
64
115
|
requirements: []
|
65
116
|
|
66
|
-
rubyforge_project:
|
67
|
-
rubygems_version: 1.
|
117
|
+
rubyforge_project: rpm
|
118
|
+
rubygems_version: 1.6.2
|
68
119
|
signing_key:
|
69
120
|
specification_version: 3
|
70
|
-
summary:
|
71
|
-
test_files:
|
72
|
-
|
121
|
+
summary: Ruby bindings for rpm (package manager)
|
122
|
+
test_files:
|
123
|
+
- test/data/a.spec
|
124
|
+
- test/data/simple-1.0-0.i586.rpm
|
125
|
+
- test/data/simple.spec
|
126
|
+
- test/helper.rb
|
127
|
+
- test/test_dependency.rb
|
128
|
+
- test/test_file.rb
|
129
|
+
- test/test_lib.rb
|
130
|
+
- test/test_package.rb
|
131
|
+
- test/test_rpm.rb
|
132
|
+
- test/test_transaction.rb
|
133
|
+
- test/test_version.rb
|
data/README
DELETED