aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-08-06 15:54:26 +0000
committerFrancois Pons <fpons@mandriva.com>2003-08-06 15:54:26 +0000
commit206d19d511e549403660d9c2dfcf9f471ed669ff (patch)
tree0f768265618cd0c638b1634a9abfc200a4f600f6 /URPM
parent702be5a6295afbda33d31d7f4492396371512638 (diff)
downloadperl-URPM-206d19d511e549403660d9c2dfcf9f471ed669ff.tar
perl-URPM-206d19d511e549403660d9c2dfcf9f471ed669ff.tar.gz
perl-URPM-206d19d511e549403660d9c2dfcf9f471ed669ff.tar.bz2
perl-URPM-206d19d511e549403660d9c2dfcf9f471ed669ff.tar.xz
perl-URPM-206d19d511e549403660d9c2dfcf9f471ed669ff.zip
0.93-1mdk0.93
Diffstat (limited to 'URPM')
-rw-r--r--URPM/Build.pm51
-rw-r--r--URPM/Signature.pm26
2 files changed, 45 insertions, 32 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm
index d0daaa7..839746e 100644
--- a/URPM/Build.pm
+++ b/URPM/Build.pm
@@ -132,6 +132,9 @@ sub compute_deps {
#- check if something has to be done.
$start > $end and return;
+ #- keep track of prereqs.
+ my %prereqs;
+
#- take into account in which hdlist a package has been found.
#- this can be done by an incremental take into account generation
#- of depslist.ordered part corresponding to the hdlist.
@@ -141,29 +144,32 @@ sub compute_deps {
my %required_packages;
my @required_packages;
- my %requires; @requires{$pkg->requires_nosense} = ();
+ my %requires;
+
+ foreach ($pkg->requires) {
+ my ($n, $prereq) = /^([^\s\[]*)(\[\*\])?/;
+ $requires{$n} = $prereq && 1;
+ }
my @requires = keys %requires;
while (my $req = shift @requires) {
$req =~ /^basesystem/ and next; #- never need to requires basesystem directly as always required! what a speed up!
- $req = ($req =~ /^\d+$/ && [ $req ] ||
- $urpm->{provides}{$req} && [ keys %{$urpm->{provides}{$req}} ] ||
- [ ($req !~ /NOTFOUND_/ && "NOTFOUND_") . $req ]);
- if (@$req > 1) {
+ my $treq = ($req =~ /^\d+$/ && [ $req ] ||
+ $urpm->{provides}{$req} && [ keys %{$urpm->{provides}{$req}} ] ||
+ [ ($req !~ /NOTFOUND_/ && "NOTFOUND_") . $req ]);
+ if (@$treq > 1) {
#- this is a choice, no closure need to be done here.
- push @required_packages, $req;
+ push @required_packages, $treq;
} else {
#- this could be nothing if the provides is a file not found.
#- and this has been fixed above.
- foreach (@$req) {
+ foreach (@$treq) {
my $pkg_ = /^\d+$/ && $urpm->{depslist}[$_];
- exists $required_packages{$_} and next;
- $required_packages{$_} = undef; $pkg_ or next;
+ exists $required_packages{$_} and $pkg_ = undef;
+ $required_packages{$_} ||= $requires{$req}; $pkg_ or next;
foreach ($pkg_->requires_nosense) {
- unless (exists $requires{$_}) {
- $requires{$_} = undef;
- push @requires, $_;
- }
+ exists $requires{$_} or push @requires, $_;
+ $requires{$_} ||= $requires{$req};
}
}
}
@@ -177,6 +183,10 @@ sub compute_deps {
#- store a short representation of requires.
$urpm->{requires}[$_] = join ' ', keys %required_packages;
+ foreach my $d (keys %required_packages) {
+ $required_packages{$d} or next;
+ $prereqs{$d}{$_} = undef;
+ }
}
#- expand choices and closure again.
@@ -230,11 +240,15 @@ sub compute_deps {
#- give an id to each packages, start from number of package already
#- registered in depslist.
my %remap_ids; @remap_ids{sort {
- $ordered{$b} <=> $ordered{$a} or do {
- my ($na, $nb) = map { $urpm->{depslist}[$_]->name } ($a, $b);
- my ($sa, $sb) = map { /^lib(.*)/ and $1 } ($na, $nb);
- $sa && $sb ? $sa cmp $sb : $sa ? -1 : $sb ? 1 : $na cmp $nb;
- } } ($start .. $end)} = ($start .. $end);
+ exists $prereqs{$b}{$a} && ! exists $prereqs{$a}{$b} ? 1 :
+ $ordered{$b} <=> $ordered{$a} or do {
+ my ($na, $nb) = map { $urpm->{depslist}[$_]->name } ($a, $b);
+ my ($sa, $sb) = map { /^lib(.*)/ and $1 } ($na, $nb);
+ $sa && $sb ? $sa cmp $sb : $sa ? -1 : $sb ? 1 : $na cmp $nb;
+ } } ($start .. $end)} = ($start .. $end);
+
+ #- now it is possible to clean ordered and prereqs.
+ %ordered = %prereqs = ();
#- recompute requires to use packages id, drop any base packages or
#- reference of a package to itself.
@@ -244,7 +258,6 @@ sub compute_deps {
#- set new id.
$pkg->set_id($remap_ids{$_});
- print STDERR "setting id of ".$pkg->name.":$remap_ids{$_}\n";
my ($id, $base, %requires_id, %not_founds);
foreach (split ' ', $urpm->{requires}[$_]) {
diff --git a/URPM/Signature.pm b/URPM/Signature.pm
index 4e7ef70..5e90d09 100644
--- a/URPM/Signature.pm
+++ b/URPM/Signature.pm
@@ -5,7 +5,7 @@ use strict;
#- parse an armored file and import in keys hash if the key does not already exists.
sub parse_armored_file {
my ($urpm, $file) = @_;
- my ($block, @l, $contents);
+ my ($block, @l, $content);
local (*F, $_);
#- read armored file.
@@ -17,11 +17,11 @@ sub parse_armored_file {
my $inside_block = /^$/ ... /^-----END PGP PUBLIC KEY BLOCK-----$/;
if ($inside_block > 1) {
if ($inside_block =~ /E/) {
- push @l, $contents;
+ push @l, $content;
$block = undef;
- $contents = '';
+ $content = '';
} else {
- $contents .= $_;
+ $content .= $_;
}
}
}
@@ -35,20 +35,20 @@ sub parse_armored_file {
#- check if key has been found, remove from list.
@l = grep {
my $found = 0;
- foreach my $k (values %{$urpm->{keys}}) {
- $k->{contents} eq $_ and $found = 1, last;
+ foreach my $k (values %{$urpm->{keys} || {}}) {
+ $k->{content} eq $_ and $found = 1, last;
}
!$found;
} @l;
#- now return something (true) which reflect what should be found in keys.
- map { +{ contents => $_ } } @l;
+ map { +{ content => $_ } } @l;
}
-#- pare from rpmdb.
-sub parse_rpmdb_pubkeys {
+#- pare from rpmlib db.
+sub parse_pubkeys {
my ($urpm, $db) = @_;
- my ($block, @l, $contents);
+ my ($block, @l, $content);
$db->traverse_tag('name', [ 'gpg-pubkey' ], sub {
my ($p) = @_;
@@ -61,12 +61,12 @@ sub parse_rpmdb_pubkeys {
if ($inside_block =~ /E/) {
$urpm->{keys}{$p->version} = { $p->summary =~ /^gpg\(\)$/ ? (name => $1) : @{[]},
id => $p->version,
- contents => $contents,
+ content => $content,
};
$block = undef;
- $contents = '';
+ $content = '';
} else {
- $contents .= $_;
+ $content .= $_;
}
}
}