diff options
-rw-r--r-- | URPM/Query.pm | 19 | ||||
-rw-r--r-- | t/parse.t | 21 | ||||
-rw-r--r-- | test-rpm-1.0-1mdk.noarch.rpm | bin | 0 -> 1876 bytes | |||
-rw-r--r-- | test-rpm.spec | 35 |
4 files changed, 58 insertions, 17 deletions
diff --git a/URPM/Query.pm b/URPM/Query.pm index 01548e8..c249470 100644 --- a/URPM/Query.pm +++ b/URPM/Query.pm @@ -12,24 +12,9 @@ use strict; # Return an array of ID tag sub tag2id { + my @l = @_; my %taglist = URPM::list_rpm_tag; - map { $taglist{uc("RPMTAG_$_")} || undef } @_; -} - -# id2tag -# INPUT array of rpm id tag -# Return an array of tag name - -sub id2tag { - my @id = @_; - my %taglist = URPM::list_rpm_tag; - my @ret; - foreach my $thisid (@id) { - my $res = grep { $taglist{$_} == $thisid } keys (%taglist); - $res =~ s/^RPMTAG_//; - push (@ret, $res ? $res : undef); - } - @ret + map { $taglist{uc("RPMTAG_$_")} || undef } @l; } sub query_pkg { diff --git a/t/parse.t b/t/parse.t new file mode 100644 index 0000000..16dfc94 --- /dev/null +++ b/t/parse.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict ; +use warnings ; +use Test::More tests => 4; +use URPM; +use URPM::Build; +use URPM::Query; + +my $a = new URPM; +ok($a); + +my ($start, $end) = $a->parse_rpms_build_headers(rpms => [ "test-rpm-1.0-1mdk.noarch.rpm" ], keep_all_tags => 1); +ok(@{$a->{depslist}} == 1); +my $pkg = $a->{depslist}[0]; +ok($pkg); +ok($pkg->get_tag(1000) eq 'test-rpm'); + + + + diff --git a/test-rpm-1.0-1mdk.noarch.rpm b/test-rpm-1.0-1mdk.noarch.rpm Binary files differnew file mode 100644 index 0000000..4db8fc8 --- /dev/null +++ b/test-rpm-1.0-1mdk.noarch.rpm diff --git a/test-rpm.spec b/test-rpm.spec new file mode 100644 index 0000000..bbd60f1 --- /dev/null +++ b/test-rpm.spec @@ -0,0 +1,35 @@ +# $Id$ +Summary: test rpm for perl-URPM test suite +BuildArch: noarch +Name: test-rpm +Version: 1.0 +Release: 1mdk +License: GPL +Group: Application/Development +BuildRoot: %{_tmppath}/%{name}-root + +%description +test rpm + +%prep + +%build + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%_sysconfdir + +date >> $RPM_BUILD_ROOT%_sysconfdir/%name + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%config(noreplace) %_sysconfdir/%name + +%changelog +* Thu Apr 22 2004 Olivier Thauvin <thauvin@aerov.jussieu.fr> 1-1mdk +- initial build + + |