summaryrefslogtreecommitdiffstats
path: root/urpm/install.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-24 10:00:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-24 10:00:17 +0000
commit511e443ea064f0c2cb3cc6788d8ed25b59ef2895 (patch)
treeedd8f68da12ece578a847f3c5272a4130e9caec5 /urpm/install.pm
parentf6d374b254fa4b5c6703652cc6e119dc85ee2404 (diff)
downloadurpmi-511e443ea064f0c2cb3cc6788d8ed25b59ef2895.tar
urpmi-511e443ea064f0c2cb3cc6788d8ed25b59ef2895.tar.gz
urpmi-511e443ea064f0c2cb3cc6788d8ed25b59ef2895.tar.bz2
urpmi-511e443ea064f0c2cb3cc6788d8ed25b59ef2895.tar.xz
urpmi-511e443ea064f0c2cb3cc6788d8ed25b59ef2895.zip
- do not say "removing installed rpms" for rpms which are not in cachedir
- do not say "removing installed rpms" for rpms which were not scheduled to be installed, instead remove those rpms from cachedir with a special error message
Diffstat (limited to 'urpm/install.pm')
-rw-r--r--urpm/install.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/urpm/install.pm b/urpm/install.pm
index 683047ce..ec069548 100644
--- a/urpm/install.pm
+++ b/urpm/install.pm
@@ -167,6 +167,7 @@ sub install {
$urpm->{error}("unable to remove package " . $_);
}
}
+ my @trans_pkgs;
foreach my $mode ($install, $upgrade) {
foreach (keys %$mode) {
my $pkg = $urpm->{depslist}[$_];
@@ -186,8 +187,15 @@ sub install {
sprintf('trans: scheduling %s of %s (id=%d, file=%s)',
$update ? 'update' : 'install',
scalar($pkg->fullname), $_, $mode->{$_}));
+ push @trans_pkgs, $pkg;
+
} else {
$urpm->{error}(N("unable to install package %s", $mode->{$_}));
+ my $cachefile = "$urpm->{cachedir}/rpms/" . $pkg->filename;
+ if (-e $cachefile) {
+ $urpm->{error}(N("removing bad rpm (%s) from %s", $pkg->name, "$urpm->{cachedir}/rpms"));
+ unlink $cachefile;
+ }
}
}
++$update;
@@ -230,7 +238,7 @@ sub install {
$index++;
}
};
- if ($options{verbose} >= 0 && (scalar keys %$install || scalar keys %$upgrade)) {
+ if ($options{verbose} >= 0 && @trans_pkgs) {
$options{callback_inst} ||= \&install_logger;
$options{callback_trans} ||= \&install_logger;
}
@@ -239,9 +247,10 @@ sub install {
#- don't clear cache if transaction failed. We might want to retry.
if (@l == 0 && !$options{test} && $options{post_clean_cache}) {
#- examine the local cache to delete packages which were part of this transaction
- my @pkgs = map { $urpm->{depslist}[$_]->filename } keys %$install, keys %$upgrade;
- $urpm->{log}(N("removing installed rpms (%s) from %s", join(' ', @pkgs), "$urpm->{cachedir}/rpms"));
- unlink "$urpm->{cachedir}/rpms/$_" foreach @pkgs;
+ my $cachedir = "$urpm->{cachedir}/rpms";
+ my @pkgs = grep { -e "$cachedir/$_" } map { $_->filename } @trans_pkgs;
+ $urpm->{log}(N("removing installed rpms (%s) from %s", join(' ', @pkgs), $cachedir));
+ unlink "$cachedir/$_" foreach @pkgs;
}
if ($options{verbose} >= 0) {