ruby-rpm 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{ChangeLog → CHANGELOG.rdoc} +7 -0
- data/README.rdoc +40 -0
- data/ext/rpm/db.c +27 -27
- data/ext/rpm/dependency.c +5 -5
- data/ext/rpm/extconf.rb +1 -1
- data/ext/rpm/file.c +1 -1
- data/ext/rpm/package.c +40 -40
- data/ext/rpm/private.h +3 -4
- data/ext/rpm/rpm.c +15 -26
- data/ext/rpm/ruby-rpm.h +0 -2
- data/ext/rpm/source.c +2 -2
- data/ext/rpm/spec.c +5 -5
- data/ext/rpm/version.c +12 -12
- data/lib/rpm.rb +3 -1
- data/lib/rpm/version.rb +4 -0
- metadata +66 -41
- data/COPYING +0 -340
- data/NEWS +0 -20
- data/README +0 -38
- data/Rakefile +0 -111
- data/doc/refm.rd.ja +0 -913
- data/ext/rpm/MANIFEST +0 -13
- data/ext/rpm/extconf.h +0 -10
- data/install.rb +0 -1015
- data/spec/fedora/ruby-rpm.spec +0 -244
- data/tests/runner.rb +0 -15
- data/tests/test_db.rb +0 -58
- data/tests/test_dependency.rb +0 -29
- data/tests/test_file.rb +0 -13
- data/tests/test_rpm.rb +0 -13
- data/tests/test_source.rb +0 -31
- data/tests/test_ts.rb +0 -169
- data/tests/test_version.rb +0 -60
data/spec/fedora/ruby-rpm.spec
DELETED
@@ -1,244 +0,0 @@
|
|
1
|
-
%{!?ruby_sitelib: %define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
|
2
|
-
%{!?ruby_sitearch: %define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
|
3
|
-
|
4
|
-
%define has_ruby_abi 0%{?fedora:%fedora} >= 5 || 0%{?rhel:%rhel} >= 5
|
5
|
-
|
6
|
-
Summary: Ruby bindings for RPM
|
7
|
-
Name: ruby-rpm
|
8
|
-
|
9
|
-
Version: 1.2.4
|
10
|
-
Release: 3%{?dist}
|
11
|
-
Group: Development/Languages
|
12
|
-
License: GPLv2+
|
13
|
-
URL: http://rubyforge.org/projects/ruby-rpm/
|
14
|
-
Source0: http://rubyforge.org/frs/download.php/26403/%{name}-1.2.3.tgz
|
15
|
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
16
|
-
%if %has_ruby_abi
|
17
|
-
Requires: ruby(abi) = 1.8
|
18
|
-
BuildRequires: ruby(abi) = 1.8
|
19
|
-
%endif
|
20
|
-
Provides: ruby(rpm) = %version
|
21
|
-
BuildRequires: ruby ruby-devel
|
22
|
-
BuildRequires: rpm-devel >= 4.2.1
|
23
|
-
BuildRequires: db4-devel
|
24
|
-
# In popt before F8, in popt-devel for F8 and later
|
25
|
-
%if 0%{?fedora:%fedora} >= 8
|
26
|
-
BuildRequires: popt-devel
|
27
|
-
%endif
|
28
|
-
|
29
|
-
%description
|
30
|
-
Provides bindings for accessing RPM packages and databases from Ruby. It
|
31
|
-
includes the low-level C API to talk to rpm as well as Ruby classes to
|
32
|
-
model the various objects that RPM deals with (such as packages,
|
33
|
-
dependencies, and files).
|
34
|
-
|
35
|
-
%prep
|
36
|
-
%setup -q
|
37
|
-
|
38
|
-
%build
|
39
|
-
ruby install.rb config \
|
40
|
-
--bin-dir=%{_bindir} \
|
41
|
-
--rb-dir=%{ruby_sitelib} \
|
42
|
-
--so-dir=%{ruby_sitearch} \
|
43
|
-
--data-dir=%{_datadir}
|
44
|
-
|
45
|
-
ruby install.rb setup
|
46
|
-
|
47
|
-
%install
|
48
|
-
rm -rf %{buildroot}
|
49
|
-
ruby install.rb config \
|
50
|
-
--bin-dir=%{buildroot}%{_bindir} \
|
51
|
-
--rb-dir=%{buildroot}%{ruby_sitelib} \
|
52
|
-
--so-dir=%{buildroot}%{ruby_sitearch} \
|
53
|
-
--data-dir=%{buildroot}%{_datadir}
|
54
|
-
ruby install.rb install
|
55
|
-
chmod 0755 %{buildroot}%{ruby_sitearch}/rpmmodule.so
|
56
|
-
|
57
|
-
%clean
|
58
|
-
rm -rf %{buildroot}
|
59
|
-
|
60
|
-
%files
|
61
|
-
%defattr(-, root, root,-)
|
62
|
-
%doc NEWS README COPYING ChangeLog doc
|
63
|
-
%{ruby_sitelib}/rpm.rb
|
64
|
-
%{ruby_sitearch}/rpmmodule.so
|
65
|
-
|
66
|
-
%changelog
|
67
|
-
* Fri Oct 19 2007 David Lutterkort <dlutter@redhat.com> - 1.2.3-3
|
68
|
-
- Fix BR on popt-devel
|
69
|
-
|
70
|
-
* Mon Oct 8 2007 David Lutterkort <dlutter@redhat.com> - 1.2.3-2
|
71
|
-
- Bring in agreement with Fedora guidelines
|
72
|
-
|
73
|
-
* Tue Nov 14 2006 David Lutterkort <dlutter@redhat.com> - 1.2.1-1
|
74
|
-
- Adapted for Fedora
|
75
|
-
|
76
|
-
* Fri Jul 02 2004 Pascal Terjan <pterjan@mandrake.org> 1.2.0-1mdk
|
77
|
-
- Adapt for Mandrakelinux
|
78
|
-
- Patch for a segfault when TMP or TEMP or TMPDIR exist but does not contain =
|
79
|
-
|
80
|
-
* Sun Mar 14 2004 Toru Hoshina <t@momonga-linux.org>
|
81
|
-
- (1.2.0-1m)
|
82
|
-
- for rpm 4.2.1.
|
83
|
-
|
84
|
-
* Tue Jan 20 2004 YAMAZAKI Makoto <zaki@zakky.org>
|
85
|
-
- (1.1.12-2m)
|
86
|
-
- add patch to fix SEGV if TMP or TEMP or TMPDIR environment variable exists. [bug:#19]
|
87
|
-
|
88
|
-
* Sun Jan 11 2004 Kenta MURATA <muraken2@nifty.com>
|
89
|
-
- (1.1.12-1m)
|
90
|
-
- version up.
|
91
|
-
|
92
|
-
* Sat Nov 01 2003 Kenta MURATA <muraken2@nifty.com>
|
93
|
-
- (1.1.11-1m)
|
94
|
-
- version up.
|
95
|
-
|
96
|
-
* Mon Aug 04 2003 Kenta MURATA <muraken2@nifty.com>
|
97
|
-
- (1.1.10-3m)
|
98
|
-
- merge from ruby-1_8-branch.
|
99
|
-
|
100
|
-
* Sun Aug 03 2003 Kenta MURATA <muraken2@nifty.com>
|
101
|
-
- (1.1.10-2m)
|
102
|
-
- rebuild against ruby-1.8.0.
|
103
|
-
|
104
|
-
* Sun May 4 2003 Kenta MURATA <muraken2@nifty.com>
|
105
|
-
- (1.1.10-1m)
|
106
|
-
- version up.
|
107
|
-
|
108
|
-
* Tue Mar 4 2003 Shingo Akagaki <dora@kitty.dnsalias.org>
|
109
|
-
- (1.1.9-1m)
|
110
|
-
- version up.
|
111
|
-
|
112
|
-
* Sat Jan 18 2003 Shingo Akagaki <dora@kitty.dnsalias.org>
|
113
|
-
- (1.1.8-1m)
|
114
|
-
- version up.
|
115
|
-
|
116
|
-
* Wed Dec 25 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
117
|
-
- (1.1.7-1m)
|
118
|
-
- version up.
|
119
|
-
|
120
|
-
* Tue Dec 17 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
121
|
-
- (1.1.6-1m)
|
122
|
-
- version up.
|
123
|
-
|
124
|
-
* Tue Dec 10 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
125
|
-
- (1.1.5-1m)
|
126
|
-
- version up.
|
127
|
-
|
128
|
-
* Fri Dec 6 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
129
|
-
- (1.1.4-2m)
|
130
|
-
- bug fix.
|
131
|
-
|
132
|
-
* Fri Dec 6 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
133
|
-
- (1.1.4-1m)
|
134
|
-
- version up.
|
135
|
-
|
136
|
-
* Thu Dec 5 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
137
|
-
- (1.1.3-2m)
|
138
|
-
- bug fix.
|
139
|
-
|
140
|
-
* Thu Dec 5 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
141
|
-
- (1.1.3-1m)
|
142
|
-
- version up.
|
143
|
-
|
144
|
-
* Thu Dec 5 2002 Shingo Akagaki <dora@kitty.dnsalias.org>
|
145
|
-
- (1.1.2-1m)
|
146
|
-
- version up.
|
147
|
-
|
148
|
-
* Fri May 31 2002 Kenta MURATA <muraken@kondara.org>
|
149
|
-
- (1.1.1-2k)
|
150
|
-
- version up.
|
151
|
-
|
152
|
-
* Fri May 31 2002 Kenta MURATA <muraken@kondara.org>
|
153
|
-
- (1.1.0-2k)
|
154
|
-
- version up.
|
155
|
-
|
156
|
-
* Tue May 7 2002 Kenta MURATA <muraken@kondara.org>
|
157
|
-
- (1.0.1-2k)
|
158
|
-
- version up.
|
159
|
-
|
160
|
-
* Fri May 3 2002 Kenta MURATA <muraken@kondara.org>
|
161
|
-
- (1.0.0-2k)
|
162
|
-
- version up.
|
163
|
-
|
164
|
-
* Wed May 1 2002 Kenta MURATA <muraken@kondara.org>
|
165
|
-
- (0.3.13-2k)
|
166
|
-
- version up.
|
167
|
-
|
168
|
-
* Mon Apr 29 2002 Kenta MURATA <muraken@kondara.org>
|
169
|
-
- (0.3.12-2k)
|
170
|
-
- version up.
|
171
|
-
|
172
|
-
* Sun Apr 28 2002 Kenta MURATA <muraken@kondara.org>
|
173
|
-
- (0.3.11-2k)
|
174
|
-
- version up.
|
175
|
-
|
176
|
-
* Wed Apr 24 2002 Kenta MURATA <muraken@kondara.org>
|
177
|
-
- (0.3.10-2k)
|
178
|
-
- version up.
|
179
|
-
|
180
|
-
* Sun Apr 21 2002 Toru Hoshina <t@kondara.org>
|
181
|
-
- (0.3.9-6k)
|
182
|
-
- i586tega... copytega...
|
183
|
-
|
184
|
-
* Sun Apr 21 2002 Kenta MURATA <muraken@kondara.org>
|
185
|
-
- (0.3.9-4k)
|
186
|
-
- applyed patch basenames and dirindexes.
|
187
|
-
|
188
|
-
* Sun Apr 21 2002 Kenta MURATA <muraken@kondara.org>
|
189
|
-
- (0.3.9-2k)
|
190
|
-
- version up.
|
191
|
-
|
192
|
-
* Sun Apr 21 2002 Kenta MURATA <muraken@kondara.org>
|
193
|
-
- (0.3.8-4k)
|
194
|
-
- ukekeke.
|
195
|
-
|
196
|
-
* Fri Apr 19 2002 Kenta MURATA <muraken@kondara.org>
|
197
|
-
- (0.3.8-2k)
|
198
|
-
- version up.
|
199
|
-
- devel merge to main.
|
200
|
-
|
201
|
-
* Fri Apr 19 2002 Kenta MURATA <muraken@kondara.org>
|
202
|
-
- (0.3.7-2k)
|
203
|
-
- version up.
|
204
|
-
- append package devel for neomph. fufufu.
|
205
|
-
|
206
|
-
* Fri Apr 19 2002 Kenta MURATA <muraken@kondara.org>
|
207
|
-
- (0.3.6-2k)
|
208
|
-
- version up.
|
209
|
-
|
210
|
-
* Fri Apr 19 2002 Kenta MURATA <muraken@kondara.org>
|
211
|
-
- (0.3.5-4k)
|
212
|
-
- defattr
|
213
|
-
|
214
|
-
* Thu Apr 18 2002 Kenta MURATA <muraken@kondara.org>
|
215
|
-
- (0.3.5-2k)
|
216
|
-
- version up.
|
217
|
-
|
218
|
-
* Thu Apr 18 2002 Kenta MURATA <muraken@kondara.org>
|
219
|
-
- (0.3.4-2k)
|
220
|
-
- version up.
|
221
|
-
|
222
|
-
* Thu Apr 18 2002 Kenta MURATA <muraken@kondara.org>
|
223
|
-
- (0.3.3-4k)
|
224
|
-
- apply patch to DB#each_match
|
225
|
-
|
226
|
-
* Thu Apr 18 2002 Kenta MURATA <muraken@kondara.org>
|
227
|
-
- (0.3.3-2k)
|
228
|
-
- version up.
|
229
|
-
|
230
|
-
* Wed Apr 17 2002 Kenta MURATA <muraken@kondara.org>
|
231
|
-
- (0.3.2-2k)
|
232
|
-
- version up.
|
233
|
-
|
234
|
-
* Wed Apr 17 2002 Kenta MURATA <muraken@kondara.org>
|
235
|
-
- (0.3.1-6k)
|
236
|
-
- apply patch version_parse.
|
237
|
-
|
238
|
-
* Wed Apr 17 2002 Kenta MURATA <muraken@kondara.org>
|
239
|
-
- (0.3.1-4k)
|
240
|
-
- apply patch Init_hoge.
|
241
|
-
|
242
|
-
* Wed Apr 17 2002 Kenta MURATA <muraken@kondara.org>
|
243
|
-
- (0.3.1-2k)
|
244
|
-
- first release.
|
data/tests/runner.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
rootdir = "#{File::dirname($0)}/.."
|
5
|
-
$:.unshift( "#{rootdir}/tests", "#{rootdir}/lib", "#{rootdir}/ext/rpm" )
|
6
|
-
|
7
|
-
require 'test_db'
|
8
|
-
require 'test_rpm'
|
9
|
-
require 'test_source'
|
10
|
-
#require 'test_ts'
|
11
|
-
require 'test_version'
|
12
|
-
require 'test_file'
|
13
|
-
require 'test_dependency'
|
14
|
-
|
15
|
-
exit Test::Unit::AutoRunner.run(false, File.dirname($0))
|
data/tests/test_db.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'tmpdir'
|
4
|
-
require 'rpm'
|
5
|
-
|
6
|
-
def rpm_version(ver=[])
|
7
|
-
ver = `LANG=C rpm --version| cut -d' ' -f 3`.split(/\./) if ver.empty?
|
8
|
-
return (ver[0].to_i<<16) + (ver[1].to_i<<8) + (ver[2].to_i<<0)
|
9
|
-
end
|
10
|
-
|
11
|
-
class RPM_DB_Tests < Test::Unit::TestCase
|
12
|
-
def setup
|
13
|
-
@version = rpm_version
|
14
|
-
@work_dir = "#{Dir.tmpdir}/.ruby-rpm-test"
|
15
|
-
unless File.directory?(@work_dir) then
|
16
|
-
Dir.mkdir(@work_dir, 0777)
|
17
|
-
end
|
18
|
-
## create database directory
|
19
|
-
FileUtils.mkdir_p( "#{@work_dir}#{RPM['_dbpath']}" )
|
20
|
-
RPM::DB.init( @work_dir )
|
21
|
-
@a = RPM::DB.open( true, @work_dir )
|
22
|
-
end # def setup
|
23
|
-
|
24
|
-
def teardown
|
25
|
-
@a.close
|
26
|
-
FileUtils.rm_rf(@work_dir)
|
27
|
-
end # def teardown
|
28
|
-
|
29
|
-
def test_init
|
30
|
-
assert( File.exist?( "#{@tmppath}/#{RPM['_dbpath']}/Packages" ) )
|
31
|
-
end # def test_initdb
|
32
|
-
|
33
|
-
def test_rebuild
|
34
|
-
# We add the "/" to work around an obscure bug in older
|
35
|
-
# RPM versions
|
36
|
-
RPM::DB.rebuild( @work_dir + "/")
|
37
|
-
assert( File.exist?( "#{@tmppath}/#{RPM['_dbpath']}/Packages" ) )
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_open
|
41
|
-
assert( @a )
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_root
|
45
|
-
assert_equal( @a.root, @work_dir ) if @version < rpm_version([4,6,0])
|
46
|
-
if @version >= rpm_version([4,6,0])
|
47
|
-
assert_raise(NoMethodError) { @a.root }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_home
|
52
|
-
assert_equal( @a.home, RPM['_dbpath'] ) if @version < rpm_version([4,6,0])
|
53
|
-
if @version >= rpm_version([4,6,0])
|
54
|
-
assert_raise(NoMethodError) { @a.home }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
end # class RPM_DB_Tests < Test::Unit::TestCase
|
data/tests/test_dependency.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'rpm'
|
3
|
-
|
4
|
-
class RPM_Dependency_Tests < Test::Unit::TestCase
|
5
|
-
|
6
|
-
EQ = RPM::SENSE_EQUAL
|
7
|
-
LT = RPM::SENSE_LESS
|
8
|
-
GT = RPM::SENSE_GREATER
|
9
|
-
|
10
|
-
def test_satisfy
|
11
|
-
prv = provide("foo", "2", "1", 0, EQ)
|
12
|
-
req = require("foo", "1", "1", 0, EQ|GT)
|
13
|
-
assert(req.satisfy?(prv))
|
14
|
-
assert(prv.satisfy?(req))
|
15
|
-
|
16
|
-
# Different names don't overlap
|
17
|
-
prv = provide("foo", "2", "1", 0, EQ)
|
18
|
-
req = require("bar", "1", "1", 0, EQ|GT)
|
19
|
-
assert(! req.satisfy?(prv))
|
20
|
-
end
|
21
|
-
|
22
|
-
def provide(name, v, r, e, sense)
|
23
|
-
RPM::Provide.new(name, RPM::Version.new(v, r, e), sense, nil)
|
24
|
-
end
|
25
|
-
|
26
|
-
def require(name, v, r, e, sense)
|
27
|
-
RPM::Require.new(name, RPM::Version.new(v, r, e), sense, nil)
|
28
|
-
end
|
29
|
-
end
|
data/tests/test_file.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'rpm'
|
3
|
-
|
4
|
-
class RPM_File_Tests < Test::Unit::TestCase
|
5
|
-
def test_link_to
|
6
|
-
f = RPM::File.new("path", "md5sum", nil, 42, 1,
|
7
|
-
"owner", "group", 43, 0777, 44, 45)
|
8
|
-
assert_equal(nil, f.link_to)
|
9
|
-
f = RPM::File.new("path", "md5sum", "link_to", 42, 1,
|
10
|
-
"owner", "group", 43, 0777, 44, 45)
|
11
|
-
assert_equal("link_to", f.link_to)
|
12
|
-
end
|
13
|
-
end
|
data/tests/test_rpm.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'rpm'
|
3
|
-
|
4
|
-
class RPM_RPM_Tests < Test::Unit::TestCase
|
5
|
-
def test_macro_read
|
6
|
-
assert_equal( RPM['_usr'], '/usr' )
|
7
|
-
end # def test_macro_read
|
8
|
-
|
9
|
-
def test_macro_write
|
10
|
-
RPM['hoge'] = 'hoge'
|
11
|
-
assert_equal( RPM['hoge'], 'hoge' )
|
12
|
-
end # def test_macro_write
|
13
|
-
end # class RPM_RPM_Tests < Test::Unit::TestCase
|
data/tests/test_source.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'rpm'
|
3
|
-
|
4
|
-
class RPM_Source_Tests < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
@a = RPM::Source.new( 'http://example.com/hoge/hoge.tar.bz2', 0 )
|
7
|
-
@b = RPM::Source.new( 'http://example.com/fuga/fuga.tar.gz', 1, true )
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_fullname
|
11
|
-
assert_equal( 'http://example.com/hoge/hoge.tar.bz2', @a.fullname )
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_to_s
|
15
|
-
assert_equal( 'http://example.com/hoge/hoge.tar.bz2', @a.to_s )
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_filename
|
19
|
-
assert_equal( 'hoge.tar.bz2', @a.filename )
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_num
|
23
|
-
assert_equal( 0, @a.num )
|
24
|
-
assert_equal( 1, @b.num )
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_no?
|
28
|
-
assert_equal(false, @a.no?)
|
29
|
-
assert( @b.no?)
|
30
|
-
end
|
31
|
-
end
|
data/tests/test_ts.rb
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
raise NotImplementedError, "not implemented yet..."
|
2
|
-
|
3
|
-
require 'test/unit'
|
4
|
-
require 'tmpdir'
|
5
|
-
require 'rpm'
|
6
|
-
|
7
|
-
class TC_TransactionSet < Test::Unit::TestCase
|
8
|
-
SPEC_A = <<END_SPEC_A
|
9
|
-
Summary: Spec A for Testing Ruby/RPM.
|
10
|
-
Name: spec-a
|
11
|
-
Version: 1.0
|
12
|
-
Release: 1m
|
13
|
-
Group: Documentation
|
14
|
-
License: GPL
|
15
|
-
|
16
|
-
BuildArchitectures: noarch
|
17
|
-
|
18
|
-
%description
|
19
|
-
Spec A for Testing Ruby/RPM.
|
20
|
-
|
21
|
-
%files
|
22
|
-
%defattr(-, root, root)
|
23
|
-
|
24
|
-
%changelog
|
25
|
-
* Sun May 23 2004 Kenta MURATA <muraken2@nifty.com>
|
26
|
-
- (1.0-1m)
|
27
|
-
- initial release.
|
28
|
-
END_SPEC_A
|
29
|
-
|
30
|
-
SPEC_C = <<END_SPEC_C
|
31
|
-
Summary: Spec C for Testing Ruby/RPM.
|
32
|
-
Name: spec-c
|
33
|
-
Version: 1.0
|
34
|
-
Release: 1m
|
35
|
-
Group: Documentation
|
36
|
-
License: GPL
|
37
|
-
|
38
|
-
BuildArchitectures: noarch
|
39
|
-
|
40
|
-
Requires: spec-b
|
41
|
-
|
42
|
-
%description
|
43
|
-
Spec C for Testing Ruby/RPM.
|
44
|
-
|
45
|
-
%files
|
46
|
-
%defattr(-, root, root)
|
47
|
-
|
48
|
-
%changelog
|
49
|
-
* Sun May 23 2004 Kenta MURATA <muraken2@nifty.com>
|
50
|
-
- (1.0-1m)
|
51
|
-
- initial release.
|
52
|
-
END_SPEC_C
|
53
|
-
|
54
|
-
def init_rpmmacros(path)
|
55
|
-
File.open(path, "w") do |io|
|
56
|
-
io.puts("%_topdir #{@rpm_dir}")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def init_rpmrc(path)
|
61
|
-
File.open(path, "w") do |io|
|
62
|
-
io.puts("macrofiles: #{@rpm_dir}/macros")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def build_spec(rpmrc, path)
|
67
|
-
log = `rpmbuild --rcfile=/usr/lib/rpm/rpmrc:#{rpmrc} -ba #{path}`
|
68
|
-
if $?.exitstatus != 0 then
|
69
|
-
raise RuntimeError, log
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def setup
|
74
|
-
require 'fileutils'
|
75
|
-
@work_dir = Dir.tmpdir + "/.ruby-rpm-test"
|
76
|
-
|
77
|
-
@rpm_dir = "#{@work_dir}/rpm"
|
78
|
-
%W(SPECS SRPMS SOURCES RPMS/#{RPM['_arch']} RPMS/noarch BUILD SRPMS).each do |dir|
|
79
|
-
FileUtils.mkdir_p("#{@rpm_dir}/#{dir}")
|
80
|
-
end
|
81
|
-
|
82
|
-
@root_dir = "#{@work_dir}/root"
|
83
|
-
FileUtils.mkdir_p("#{@root_dir}#{RPM['_dbpath']}")
|
84
|
-
|
85
|
-
## build spec file for testing
|
86
|
-
init_rpmrc("#{@rpm_dir}/rpmrc") unless File.file?("#{@rpm_dir}/rpmrc")
|
87
|
-
init_rpmmacros("#{@rpm_dir}/macros") unless File.file?("#{@rpm_dir}/macros")
|
88
|
-
self.class.constants.grep(/^SPEC_/).each do |name|
|
89
|
-
filename = name.downcase + ".spec"
|
90
|
-
next if File.file?("#{@rpm_dir}/RPMS/noarch/#{filename}")
|
91
|
-
File.open("#{@rpm_dir}/SPECS/#{filename}", "w") do |io|
|
92
|
-
io.print(self.class.const_get(name))
|
93
|
-
end
|
94
|
-
build_spec("#{@rpm_dir}/rpmrc", "#{@rpm_dir}/SPECS/#{filename}")
|
95
|
-
end
|
96
|
-
|
97
|
-
@ts = RPM::TransactionSet.new(@root_dir)
|
98
|
-
end
|
99
|
-
|
100
|
-
def teardown
|
101
|
-
@ts.empty!
|
102
|
-
@ts.close_db
|
103
|
-
|
104
|
-
# If available following code, rpmbuild process is forked by for
|
105
|
-
# each test_* methods...
|
106
|
-
## FileUtils.rm_rf(@work_dir)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_00_init_db
|
110
|
-
assert_nothing_raised { @ts.init_db }
|
111
|
-
assert(File.exist?("#{@root_dir}/#{RPM[:_dbpath]}/Packages"))
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_rebuild_db
|
115
|
-
assert_nothing_raised { @ts.rebuild_db }
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_verify_db
|
119
|
-
assert_nothing_raised { @ts.verify_db }
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_add_install
|
123
|
-
n = @ts.element_count
|
124
|
-
@ts.add_install() # XXX
|
125
|
-
assert_equal(n + 1, @ts.element_count)
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_add_upgrade
|
129
|
-
n = @ts.element_count
|
130
|
-
@ts.add_upgrade() # XXX
|
131
|
-
assert_equal(n + 1, @ts.element_count)
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_add_available
|
135
|
-
n = @ts.element_count
|
136
|
-
@ts.add_available() # XXX
|
137
|
-
assert_equal(n + 1, @ts.element_count)
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_add_erase
|
141
|
-
n = @ts.element_count
|
142
|
-
@ts.add_erase() # XXX
|
143
|
-
assert_equal(n + 1, @ts.element_count)
|
144
|
-
end
|
145
|
-
|
146
|
-
def test_check
|
147
|
-
# not implemented yet
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_order
|
151
|
-
# not implemented yet
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_set_flags
|
155
|
-
# not implemented yet
|
156
|
-
end
|
157
|
-
|
158
|
-
def test_run
|
159
|
-
# not implemented yet
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
#--
|
164
|
-
# Local Variables:
|
165
|
-
# mode: ruby
|
166
|
-
# ruby-indent-level: 2
|
167
|
-
# indent-tabs-mode: nil
|
168
|
-
# End:
|
169
|
-
#++
|