aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-04-24 19:11:39 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-04-24 19:11:39 +0000
commite6c464eae1294ece368e20952acfba8587c23db7 (patch)
treec8067e342dd05389b3d98e04a8bd7743b3702c3f /URPM
parentd314f11b331c1035b4a9102ece80d03941b58a44 (diff)
downloadperl-URPM-e6c464eae1294ece368e20952acfba8587c23db7.tar
perl-URPM-e6c464eae1294ece368e20952acfba8587c23db7.tar.gz
perl-URPM-e6c464eae1294ece368e20952acfba8587c23db7.tar.bz2
perl-URPM-e6c464eae1294ece368e20952acfba8587c23db7.tar.xz
perl-URPM-e6c464eae1294ece368e20952acfba8587c23db7.zip
re-sync after the big svn loss1.581.571.561.55
Diffstat (limited to 'URPM')
-rw-r--r--URPM/Build.pm19
-rw-r--r--URPM/Resolve.pm17
2 files changed, 22 insertions, 14 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm
index 924074a..66de723 100644
--- a/URPM/Build.pm
+++ b/URPM/Build.pm
@@ -17,6 +17,7 @@ sub _get_tmp_dir () {
#- dir : directory which will contain headers (defaults to /tmp/.build_hdlist)
#- callback : perl code to be called for each package read (defaults pack_header)
#- clean : bool to clean cache before (default no).
+#- packing : bool to create info (default is weird)
sub parse_rpms_build_headers {
my ($urpm, %options) = @_;
my ($dir, %cache, @headers);
@@ -24,7 +25,7 @@ sub parse_rpms_build_headers {
#- check for mandatory options.
if (@{$options{rpms} || []} > 0) {
#- build a working directory which will hold rpm headers.
- $dir = $options{dir} || _get_tmp_dir;
+ $dir = $options{dir} || _get_tmp_dir();
$options{clean} and system($ENV{LD_LOADER} ? $ENV{LD_LOADER} : @{[]}, "rm", "-rf", $dir);
-d $dir or mkdir $dir, 0755 or die "cannot create directory $dir\n";
@@ -46,11 +47,11 @@ sub parse_rpms_build_headers {
}
foreach (@{$options{rpms}}) {
- my ($key) = /([^\/]*)\.rpm$/ or next; #- get rpm filename.
+ my ($key) = m!([^/]*)\.rpm$! or next; #- get rpm filename.
my ($id, $filename);
if ($cache{$key} && $cache{$key}{time} > 0 && $cache{$key}{time} >= (stat $_)[9]) {
- ($id, undef) = $urpm->parse_hdlist("$dir/$cache{$key}{file}", keep_all_tags => $options{keep_all_tags});
+ ($id, undef) = $urpm->parse_hdlist("$dir/$cache{$key}{file}", packing => $options{packing}, keep_all_tags => $options{keep_all_tags});
unless (defined $id) {
if ($options{dontdie}) {
print STDERR "bad header $dir/$cache{$key}{file}\n";
@@ -124,13 +125,13 @@ sub parse_headers {
my ($urpm, %options) = @_;
my ($dir, $start, $id);
- $dir = $options{dir} || _get_tmp_dir;
+ $dir = $options{dir} || _get_tmp_dir();
-d $dir or die "no directory $dir\n";
$start = @{$urpm->{depslist} || []};
foreach (@{$options{headers} || []}) {
#- make smart use of memory (no need to keep header in memory now).
- ($id, undef) = $urpm->parse_hdlist("$dir/$_", !$options{callback});
+ ($id, undef) = $urpm->parse_hdlist("$dir/$_", packing => !$options{callback});
defined $id or die "bad header $dir/$_\n";
$options{callback} and $options{callback}->($urpm, $id, %options);
}
@@ -404,10 +405,10 @@ sub build_hdlist {
my ($urpm, %options) = @_;
my ($dir, $ratio, @idlist);
- $dir = $options{dir} || _get_tmp_dir;
+ $dir = $options{dir} || _get_tmp_dir();
-d $dir or die "no directory $dir\n";
- @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist}) or return;
+ @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist});
#- compression ratio are not very high, sample for cooker
#- gives the following (main only and cache fed up):
@@ -429,7 +430,7 @@ sub build_hdlist {
) or die "Can't create archive";
foreach my $pkg (@{$urpm->{depslist}}[@idlist]) {
my $filename = $pkg->fullname;
- "$filename.rpm" ne $pkg->filename && $pkg->filename =~ /([^\/]*)\.rpm$/
+ "$filename.rpm" ne $pkg->filename && $pkg->filename =~ m!([^/]*)\.rpm$!
and $filename .= ":$1";
-s "$dir/$filename" or die "bad header $dir/$filename\n";
$pack->add($dir, $filename);
@@ -448,7 +449,7 @@ sub build_synthesis {
my ($urpm, %options) = @_;
my ($ratio, @idlist);
- @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist}) or return;
+ @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist});
$ratio = $options{ratio} || 9;
$options{synthesis} || defined $options{fd} or die "invalid parameters given";
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index cb458a4..7aeb0d1 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -714,11 +714,18 @@ sub resolve_requested {
push @keep, scalar $p->fullname;
} else {
#- no package has been found, we need to remove the package examined.
- delete $state->{rejected}{$p->fullname}; #- force resolution (#12696, maybe #11885)
- $urpm->resolve_rejected($db, $state, $p,
- removed => 1, unsatisfied => \@properties,
- from => scalar $pkg->fullname,
- why => { conflicts => scalar $pkg->fullname });
+ my $obsoleted;
+ #- force resolution (#12696, maybe #11885)
+ if (my $prev = delete $state->{rejected}{$p->fullname}) {
+ $obsoleted = $prev->{obsoleted};
+ }
+ $urpm->resolve_rejected(
+ $db, $state, $p,
+ ($obsoleted ? 'obsoleted' : 'removed') => 1,
+ unsatisfied => \@properties,
+ from => scalar $pkg->fullname,
+ why => { conflicts => scalar $pkg->fullname },
+ );
}
}
}