aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM.pm2
-rw-r--r--URPM/Build.pm51
-rw-r--r--URPM/Signature.pm26
-rw-r--r--perl-URPM.spec10
4 files changed, 54 insertions, 35 deletions
diff --git a/URPM.pm b/URPM.pm
index 4a1db7b..4d21c17 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -4,7 +4,7 @@ use strict;
use DynaLoader;
our @ISA = qw(DynaLoader);
-our $VERSION = '0.92';
+our $VERSION = '0.93';
URPM->bootstrap($VERSION);
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 .= $_;
}
}
}
diff --git a/perl-URPM.spec b/perl-URPM.spec
index 50a20d6..b319173 100644
--- a/perl-URPM.spec
+++ b/perl-URPM.spec
@@ -1,7 +1,7 @@
%define name perl-URPM
%define real_name URPM
-%define version 0.92
-%define release 4mdk
+%define version 0.93
+%define release 1mdk
%{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)}
@@ -51,6 +51,12 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Aug 6 2003 François Pons <fpons@mandrakesoft.com> 0.93-1mdk
+- added URPM::Signature for handling armored gpg file and
+ internal rpm pubkey.
+- take care of PreReq when building hdlist or synthesis files.
+- removed id log during hdlist or synthesis creation.
+
* Mon Aug 4 2003 François Pons <fpons@mandrakesoft.com> 0.92-4mdk
- sanity check on transaction set (should be the same as
normal selection, else something wrong has occured).