ruby-rpm 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -3
- data/ext/rpm/db.c +4 -1
- data/ext/rpm/version.c +18 -2
- data/spec/fedora/ruby-rpm.spec +5 -2
- data/tests/test_version.rb +9 -0
- metadata +12 -12
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
|
|
4
4
|
require 'rake/gempackagetask'
|
5
5
|
|
6
6
|
PKG_NAME='ruby-rpm'
|
7
|
-
PKG_VERSION='1.2.
|
7
|
+
PKG_VERSION='1.2.3'
|
8
8
|
|
9
9
|
EXT_CONF='ext/rpm/extconf.rb'
|
10
10
|
MAKEFILE="ext/rpm/Makefile"
|
@@ -78,12 +78,16 @@ SPEC = Gem::Specification.new do |s|
|
|
78
78
|
s.required_ruby_version = '>= 1.8.1'
|
79
79
|
s.extensions = "ext/rpm/extconf.rb"
|
80
80
|
s.description = <<EOF
|
81
|
-
|
81
|
+
Provides bindings for accessing RPM packages and databases from Ruby. It
|
82
|
+
includes the low-level C API to talk to rpm as well as Ruby classes to
|
83
|
+
model the various objects that RPM deals with (such as packages,
|
84
|
+
dependencies, and files).
|
82
85
|
EOF
|
83
86
|
end
|
84
87
|
|
85
88
|
Rake::GemPackageTask.new(SPEC) do |pkg|
|
86
89
|
pkg.need_tar = true
|
90
|
+
pkg.need_zip = true
|
87
91
|
end
|
88
92
|
|
89
93
|
desc "Build (S)RPM for #{PKG_NAME}"
|
@@ -101,7 +105,7 @@ end
|
|
101
105
|
desc "Release a version"
|
102
106
|
task :dist => [ :rpm, :test ] do |t|
|
103
107
|
puts "svn commit -m 'Release #{PKG_VERSION}' #{SPEC_FILE}"
|
104
|
-
puts "svn cp svn+ssh://lutter@rubyforge.org/var/svn/ruby-rpm/trunk svn+ssh://lutter@rubyforge.org/var/svn/ruby-rpm/tags/release-#{PKG_VERSION}"
|
108
|
+
puts "svn cp -m 'Tag release #{PKG_VERSION}' svn+ssh://lutter@rubyforge.org/var/svn/ruby-rpm/trunk svn+ssh://lutter@rubyforge.org/var/svn/ruby-rpm/tags/release-#{PKG_VERSION}"
|
105
109
|
puts "Upload files"
|
106
110
|
puts "Announce on rubyforge and freshmeat"
|
107
111
|
end
|
data/ext/rpm/db.c
CHANGED
@@ -200,7 +200,8 @@ rpm_db_close(VALUE db)
|
|
200
200
|
{
|
201
201
|
db_unref((rpm_db_t*)DATA_PTR(db));
|
202
202
|
DATA_PTR(db) = NULL;
|
203
|
-
|
203
|
+
rb_gc();
|
204
|
+
return Qnil;
|
204
205
|
}
|
205
206
|
|
206
207
|
VALUE
|
@@ -974,6 +975,8 @@ rpm_db_init_iterator(VALUE db, VALUE key, VALUE val)
|
|
974
975
|
return Data_Wrap_Struct(rpm_cMatchIterator, NULL, mi_free, mi);
|
975
976
|
}
|
976
977
|
free(mi);
|
978
|
+
/* FIXME: returning nil here is a pain; for ruby, it would be nicer
|
979
|
+
to return an empty array */
|
977
980
|
return Qnil;
|
978
981
|
}
|
979
982
|
|
data/ext/rpm/version.c
CHANGED
@@ -198,9 +198,9 @@ rpm_version_cmp(VALUE ver, VALUE other)
|
|
198
198
|
|
199
199
|
ve = rb_ivar_get(ver,id_e);
|
200
200
|
oe = rb_ivar_get(other,id_e);
|
201
|
-
if (!NIL_P(ve) && NIL_P(oe))
|
201
|
+
if (!NIL_P(ve) && NUM2INT(ve) > 0 && NIL_P(oe))
|
202
202
|
return INT2FIX(1);
|
203
|
-
else if (NIL_P(ve) && !NIL_P(oe))
|
203
|
+
else if (NIL_P(ve) && !NIL_P(oe) && NUM2INT(oe) > 0)
|
204
204
|
return INT2FIX(-1);
|
205
205
|
else if (!NIL_P(ve) && !NIL_P(oe)) {
|
206
206
|
if (NUM2INT(ve) < NUM2INT(oe))
|
@@ -319,6 +319,21 @@ rpm_version_inspect(VALUE ver)
|
|
319
319
|
return rb_str_new2(buf);
|
320
320
|
}
|
321
321
|
|
322
|
+
VALUE
|
323
|
+
rpm_version_hash(VALUE ver)
|
324
|
+
{
|
325
|
+
long h;
|
326
|
+
VALUE v, r, e;
|
327
|
+
v = rb_ivar_get(ver, id_v);
|
328
|
+
r = rb_ivar_get(ver, id_r);
|
329
|
+
e = rb_ivar_get(ver, id_e);
|
330
|
+
|
331
|
+
h = NIL_P(e) ? 0 : NUM2INT(e);
|
332
|
+
h = (h << 1) ^ NUM2LONG(rb_hash(r));
|
333
|
+
h = (h << 1) ^ NUM2LONG(rb_hash(v));
|
334
|
+
return LONG2FIX(h);
|
335
|
+
}
|
336
|
+
|
322
337
|
void
|
323
338
|
Init_rpm_version(void)
|
324
339
|
{
|
@@ -334,6 +349,7 @@ Init_rpm_version(void)
|
|
334
349
|
rb_define_method(rpm_cVersion, "to_s", rpm_version_to_s, 0);
|
335
350
|
rb_define_method(rpm_cVersion, "to_vre", rpm_version_to_vre, 0);
|
336
351
|
rb_define_method(rpm_cVersion, "inspect", rpm_version_inspect, 0);
|
352
|
+
rb_define_method(rpm_cVersion, "hash", rpm_version_hash, 0);
|
337
353
|
|
338
354
|
id_v = rb_intern("version");
|
339
355
|
id_r = rb_intern("release");
|
data/spec/fedora/ruby-rpm.spec
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
Summary: Ruby bindings for RPM
|
5
5
|
Name: ruby-rpm
|
6
6
|
|
7
|
-
Version: 1.2.
|
7
|
+
Version: 1.2.3
|
8
8
|
Release: 1%{?dist}
|
9
9
|
Group: Development/Languages
|
10
10
|
License: GPL
|
@@ -18,7 +18,10 @@ BuildRequires: rpm-devel >= 4.2.1
|
|
18
18
|
BuildRequires: db4-devel
|
19
19
|
|
20
20
|
%description
|
21
|
-
|
21
|
+
Provides bindings for accessing RPM packages and databases from Ruby. It
|
22
|
+
includes the low-level C API to talk to rpm as well as Ruby classes to
|
23
|
+
model the various objects that RPM deals with (such as packages,
|
24
|
+
dependencies, and files).
|
22
25
|
|
23
26
|
%prep
|
24
27
|
%setup -q
|
data/tests/test_version.rb
CHANGED
@@ -48,4 +48,13 @@ class RPM_Version_Tests < Test::Unit::TestCase
|
|
48
48
|
assert_equal(3, v.e)
|
49
49
|
assert_equal('#<RPM::Version v="1", r="2", e=3>', v.inspect)
|
50
50
|
end
|
51
|
+
|
52
|
+
def test_epoch_none_zero
|
53
|
+
v1 = RPM::Version.new("1-2")
|
54
|
+
v2 = RPM::Version.new("0:1-2")
|
55
|
+
assert_equal(nil, v1.e)
|
56
|
+
assert_equal(0, v2.e)
|
57
|
+
assert( v1 == v2 )
|
58
|
+
assert_equal(v1.hash, v2.hash)
|
59
|
+
end
|
51
60
|
end
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-rpm
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.2.3
|
7
|
+
date: 2007-05-07 00:00:00 -07:00
|
8
8
|
summary: Ruby bindings for RPM
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: ruby-rpm-devel@rubyforge.org
|
12
12
|
homepage: http://rubyforge.org/projects/ruby-rpm/
|
13
13
|
rubyforge_project:
|
14
|
-
description:
|
14
|
+
description: Provides bindings for accessing RPM packages and databases from Ruby. It includes the low-level C API to talk to rpm as well as Ruby classes to model the various objects that RPM deals with (such as packages, dependencies, and files).
|
15
15
|
autorequire: rpm
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -37,26 +37,26 @@ files:
|
|
37
37
|
- install.rb
|
38
38
|
- doc/refm.rd.ja
|
39
39
|
- lib/rpm.rb
|
40
|
-
- ext/rpm/
|
41
|
-
- ext/rpm/rpm.c
|
40
|
+
- ext/rpm/version.c
|
42
41
|
- ext/rpm/file.c
|
43
42
|
- ext/rpm/private.h
|
44
|
-
- ext/rpm/source.c
|
45
43
|
- ext/rpm/ruby-rpm.h
|
46
|
-
- ext/rpm/db.c
|
47
44
|
- ext/rpm/rpm40_compat.c
|
48
|
-
- ext/rpm/
|
45
|
+
- ext/rpm/dependency.c
|
46
|
+
- ext/rpm/package.c
|
47
|
+
- ext/rpm/db.c
|
49
48
|
- ext/rpm/rpm40_compat.h
|
49
|
+
- ext/rpm/rpm.c
|
50
50
|
- ext/rpm/spec.c
|
51
|
-
- ext/rpm/
|
51
|
+
- ext/rpm/source.c
|
52
52
|
- ext/rpm/MANIFEST
|
53
53
|
- ext/rpm/extconf.rb
|
54
|
-
- tests/test_dependency.rb
|
55
|
-
- tests/test_rpm.rb
|
56
54
|
- tests/test_file.rb
|
57
|
-
- tests/test_source.rb
|
58
55
|
- tests/test_db.rb
|
59
56
|
- tests/test_version.rb
|
57
|
+
- tests/test_rpm.rb
|
58
|
+
- tests/test_dependency.rb
|
59
|
+
- tests/test_source.rb
|
60
60
|
- tests/test_ts.rb
|
61
61
|
- tests/runner.rb
|
62
62
|
- spec/fedora
|