aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-17 16:25:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-17 16:25:14 +0000
commit6111ce37d4a132972730ee29525d246000c28311 (patch)
tree2ab715118cb453f2d18bb58b7b6e9c1496467a59
parenta684773347534dae69c29f4a3e6006b2b6541a2a (diff)
downloadperl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar
perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar.gz
perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar.bz2
perl-URPM-6111ce37d4a132972730ee29525d246000c28311.tar.xz
perl-URPM-6111ce37d4a132972730ee29525d246000c28311.zip
- parse_hdlist on a simple header was broken because pid was left unset,
- add some tests for this
-rw-r--r--URPM.xs2
-rw-r--r--t/parse.t14
2 files changed, 14 insertions, 2 deletions
diff --git a/URPM.xs b/URPM.xs
index 3542f15..c5e8b10 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3077,7 +3077,7 @@ Urpm_parse_hdlist__XS(urpm, filename, ...)
HV *provides = fprovides && SvROK(*fprovides) && SvTYPE(SvRV(*fprovides)) == SVt_PVHV ? (HV*)SvRV(*fprovides) : NULL;
if (depslist != NULL) {
- pid_t pid;
+ pid_t pid = 0;
int d;
int empty_archive = 0;
FD_t fd;
diff --git a/t/parse.t b/t/parse.t
index 61d8bfe..d62b34f 100644
--- a/t/parse.t
+++ b/t/parse.t
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 29;
+use Test::More tests => 35;
use MDV::Packdrakeng;
use URPM;
use URPM::Build;
@@ -44,6 +44,7 @@ ok(-f 'hdlist.cz');
my $b = new URPM;
($start, $end) = $b->parse_hdlist('hdlist.cz', keep_all_tags => 1);
+is("$start $end", "0 0", 'parse_hdlist');
ok(@{$b->{depslist}} == 1);
$pkg = $b->{depslist}[0];
ok($pkg);
@@ -53,6 +54,17 @@ is($pkg->get_tag(1002), '1mdk', 'release');
is($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}"), "test-rpm-1.0-1mdk.noarch",
q/get headers from hdlist/);
+my $headers = eval { [ $b->parse_rpms_build_headers(rpms => [ "t/RPMS/noarch/test-rpm-1.0-1mdk.noarch.rpm" ],
+ dir => 't/headers') ] };
+is($@, '', 'parse_rpms_build_headers');
+is(int @$headers, 1, 'parse_rpms_build_headers');
+ok(@{$b->{depslist}} == 2);
+($start, $end) = eval { $b->parse_headers(dir => "t/headers", headers => $headers) };
+is($@, '', 'parse_headers');
+is("$start $end", "2 2", 'parse_headers');
+
+
+
# Version comparison
ok(URPM::rpmvercmp("1-1mdk", "1-1mdk") == 0, "Same value = 0");
ok(URPM::rpmvercmp("0:1-1mdk", "1-1mdk") == -1, "Same value, epoch 0 on left = 1");