aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xgendistrib2
-rw-r--r--rpmtools.pm36
-rw-r--r--rpmtools.spec5
-rw-r--r--rpmtools.xs13
5 files changed, 26 insertions, 32 deletions
diff --git a/Makefile b/Makefile
index 989ee1f..1538032 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = 3.2
+VERSION = 4.0
NAME = rpmtools
FROMC = parsehdlist rpm2header #rpm-find-leaves
FROMCC = #gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups
diff --git a/gendistrib b/gendistrib
index 02b2d72..a7a4a45 100755
--- a/gendistrib
+++ b/gendistrib
@@ -150,7 +150,7 @@ foreach my $pkg (@{$params->{depslist}}) {
print STDERR "$pkg->{name}-$pkg->{version}-$pkg->{release} require [$1] which\n";
if ($params->{provides}{$1}) {
print STDERR " is available on packages not listed in this medium or previous medium:\n";
- foreach (@{$params->{provides}{$1}}) {
+ foreach (keys %{$params->{provides}{$1}}) {
print STDERR " $params->{info}{$_}{name}-$params->{info}{$_}{version}-$params->{info}{$_}{release}\n";
}
} else {
diff --git a/rpmtools.pm b/rpmtools.pm
index e062d7c..a67b3bf 100644
--- a/rpmtools.pm
+++ b/rpmtools.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA %compat_arch);
require DynaLoader;
@ISA = qw(DynaLoader);
-$VERSION = '3.2';
+$VERSION = '4.0';
bootstrap rpmtools $VERSION;
@@ -205,14 +205,7 @@ sub compute_id {
#- speed up the search by giving a provide from all packages.
#- and remove all dobles for each one !
foreach (@info) {
- push @{$params->{provides}{$_->{name}} ||= []}, "$_->{name}-$_->{version}-$_->{release}.$_->{arch}";
- }
-
- #- remove all dobles for each provides.
- foreach (keys %{$params->{provides}}) {
- $params->{provides}{$_} or next;
- my %provides; @provides{@{$params->{provides}{$_}}} = ();
- $params->{provides}{$_} = [ keys %provides ];
+ $params->{provides}{$_->{name}}{"$_->{name}-$_->{version}-$_->{release}.$_->{arch}"} = undef;
}
#- give an id to each packages, start from number of package already
@@ -238,14 +231,7 @@ sub compute_depslist {
#- speed up the search by giving a provide from all packages.
#- and remove all dobles for each one !
foreach (@info) {
- push @{$params->{provides}{$_->{name}} ||= []}, "$_->{name}-$_->{version}-$_->{release}.$_->{arch}";
- }
-
- #- remove all dobles for each provides.
- foreach (keys %{$params->{provides}}) {
- $params->{provides}{$_} or next;
- my %provides; @provides{@{$params->{provides}{$_}}} = ();
- $params->{provides}{$_} = [ keys %provides ];
+ $params->{provides}{$_->{name}}{"$_->{name}-$_->{version}-$_->{release}.$_->{arch}"} = undef;
}
#- take into account in which hdlist a package has been found.
@@ -261,7 +247,7 @@ sub compute_depslist {
while (my $req = shift @requires) {
$req =~ /^basesystem/ and next; #- never need to requires basesystem directly as always required! what a speed up!
ref $req or $req = ($params->{info}{$req} && [ $req ] ||
- $params->{provides}{$req} ||
+ $params->{provides}{$req} && [ keys %{$params->{provides}{$req}} ] ||
($req =~ /rpmlib\(/ ? [] : [ ($req !~ /NOTFOUND_/ && "NOTFOUND_") . $req ]));
if (@$req > 1) {
#- this is a choice, no closure need to be done here.
@@ -338,7 +324,7 @@ sub compute_depslist {
#- some package should be sorted at the beginning.
my $fixed_weight = 10000;
foreach (qw(basesystem filesystem setup glibc sash bash libtermcap2 termcap readline ldconfig)) {
- foreach (@{$params->{provides}{$_} || []}) {
+ foreach (keys %{$params->{provides}{$_} || {}}) {
$ordered{$_} = $fixed_weight;
}
$fixed_weight += 10000;
@@ -347,7 +333,7 @@ sub compute_depslist {
#- compute base flag, consists of packages which are required without
#- choices of basesystem and are ALWAYS installed. these packages can
#- safely be removed from requires of others packages.
- foreach (@{$params->{provides}{basesystem} || []}) {
+ foreach (keys %{$params->{provides}{basesystem} || {}}) {
foreach (@{$params->{info}{$_}{requires}}) {
ref $_ or $params->{info}{$_} and $params->{info}{$_}{base} = undef;
}
@@ -355,7 +341,7 @@ sub compute_depslist {
#- some package are always installed as base and can safely be marked as such.
foreach (qw(basesystem glibc kernel)) {
- foreach (@{$params->{provides}{$_} || []}) {
+ foreach (keys %{$params->{provides}{$_} || {}}) {
$params->{info}{$_} and $params->{info}{$_}{base} = undef;
}
}
@@ -443,13 +429,13 @@ sub read_depslist {
};
#- this can be really usefull as there are no more hash on name directly,
#- but provides gives something quite interesting here.
- push @{$params->{provides}{$name}}, "$name-$version-$release.$arch";
+ $params->{provides}{$name}{"$name-$version-$release.$arch"} = undef;
}
#- compute base flag, consists of packages which are required without
#- choices of basesystem and are ALWAYS installed. these packages can
#- safely be removed from requires of others packages.
- foreach (@{$params->{provides}{basesystem} || []}) {
+ foreach (keys %{$params->{provides}{basesystem} || {}}) {
if ($params->{info}{$_} && ! exists $params->{info}{$_}{base}) {
my @requires_id;
foreach (split ' ', $params->{info}{$_}{deps}) {
@@ -539,7 +525,7 @@ sub read_provides {
while (<$FILE>) {
chomp;
my ($k, @v) = split '@';
- $params->{provides}{$k} = @v > 0 ? \@v : undef;
+ $params->{provides}{$k}{$_} = undef foreach @v;
}
}
@@ -549,7 +535,7 @@ sub write_provides {
my ($k, $v);
while (($k, $v) = each %{$params->{provides}}) {
- printf $FILE "%s\n", join '@', $k, @{$v || []};
+ printf $FILE "%s\n", join '@', $k, keys %{$v || {}};
}
}
diff --git a/rpmtools.spec b/rpmtools.spec
index 64f7d49..b4a0a42 100644
--- a/rpmtools.spec
+++ b/rpmtools.spec
@@ -2,7 +2,7 @@
%define release 1mdk
# do not modify here, see Makefile in the CVS
-%define version 3.2
+%define version 4.0
%{expand:%%define perlbase_version %(rpm -q --queryformat '%{VERSION}' perl-base)}
%{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)}
@@ -54,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/perl5/man/*/*
%changelog
+* Wed Dec 5 2001 François Pons <fpons@mandrakesoft.com> 4.0-1mdk
+- improved provides management but breaks older urpmi.
+
* Wed Dec 5 2001 François Pons <fpons@mandrakesoft.com> 3.2-1mdk
- added --info to parsehdlist, needed for brand new urpmi.
diff --git a/rpmtools.xs b/rpmtools.xs
index 89237b2..fc528e7 100644
--- a/rpmtools.xs
+++ b/rpmtools.xs
@@ -118,12 +118,17 @@ void update_provides(int force, HV* provides, char *name, STRLEN len, Header hea
if (!len) len = strlen(name);
if (force && (isv = hv_fetch(provides, name, len, 1)) || provides && (isv = hv_fetch(provides, name, len, 0)) != 0) {
- if (!SvROK(*isv) || SvTYPE(SvRV(*isv)) != SVt_PVAV) {
- SV* choice_table = (SV*)newAV();
+ if (!SvROK(*isv) || SvTYPE(SvRV(*isv)) != SVt_PVHV) {
+ SV* choice_set = (SV*)newHV();
SvREFCNT_dec(*isv); /* drop the old as we are changing it */
- *isv = choice_table ? newRV_noinc(choice_table) : &PL_sv_undef;
+ *isv = choice_set ? newRV_noinc(choice_set) : &PL_sv_undef;
+ }
+ if (*isv != &PL_sv_undef) {
+ STRLEN key_len;
+ char *key;
+ key = SvPV(get_fullname_sv(header), key_len);
+ hv_fetch((HV*)SvRV(*isv), key, key_len, 1);
}
- if (*isv != &PL_sv_undef) av_push((AV*)SvRV(*isv), get_fullname_sv(header));
}
}