summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-04-09 15:35:31 +0000
committerFrancois Pons <fpons@mandriva.com>2001-04-09 15:35:31 +0000
commitd6f68a433db6660ffceaba8cd5bace78defdc32f (patch)
tree1e0bc49b43b8d3b242c4fed67e7caf564e9aab81 /perl-install
parent5a81d628f143b14165310f3c85b36a1695e8295f (diff)
downloaddrakx-backup-do-not-use-d6f68a433db6660ffceaba8cd5bace78defdc32f.tar
drakx-backup-do-not-use-d6f68a433db6660ffceaba8cd5bace78defdc32f.tar.gz
drakx-backup-do-not-use-d6f68a433db6660ffceaba8cd5bace78defdc32f.tar.bz2
drakx-backup-do-not-use-d6f68a433db6660ffceaba8cd5bace78defdc32f.tar.xz
drakx-backup-do-not-use-d6f68a433db6660ffceaba8cd5bace78defdc32f.zip
changed transaction error management this way: if a transaction fails, DrakX
tries to make as many transaction as there are package that have failed to be installed (this means one transaction of only one package). This help installing most package that are correct (as a transaction that failed cause all remaining package to be not installed).
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/pkgs.pm65
1 files changed, 33 insertions, 32 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index cb2f70e47..efc01d2aa 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -1293,8 +1293,8 @@ sub install($$$;$$) {
#- and make sure there are no staling open file descriptor too (before forking)!
install_any::getFile('XXX');
- my $retry = 3;
- while (@transToInstall) {
+ my $retry;
+ while ($retry || @transToInstall) {
local (*INPUT, *OUTPUT); pipe INPUT, OUTPUT;
if (my $pid = fork()) {
close OUTPUT;
@@ -1327,10 +1327,16 @@ sub install($$$;$$) {
select((select(OUTPUT), $| = 1)[0]);
$db = c::rpmdbOpen($prefix) or die "error opening RPM database: ", c::rpmErrorString();
my $trans = c::rpmtransCreateSet($db, $prefix);
- log::l("opened rpm database for transaction of ". scalar @transToInstall ." new packages, still $nb after that to do");
-
- c::rpmtransAddPackage($trans, $_->[$HEADER], packageName($_), $isUpgrade && allowedToUpgrade(packageName($_)))
- foreach @transToInstall;
+ if ($retry) {
+ log::l("opened rpm database for retry transaction of 1 package only");
+ c::rpmtransAddPackage($trans, $retry->[$HEADER], packageName($retry),
+ $isUpgrade && allowedToUpgrade(packageName($retry)));
+ } else {
+ log::l("opened rpm database for transaction of ". scalar @transToInstall ." new packages, still $nb after that to do");
+ c::rpmtransAddPackage($trans, $_->[$HEADER], packageName($_),
+ $isUpgrade && allowedToUpgrade(packageName($_)))
+ foreach @transToInstall;
+ }
c::rpmdepOrder($trans) or die "error ordering package list: " . c::rpmErrorString();
c::rpmtransSetScriptFd($trans, fileno LOG);
@@ -1398,37 +1404,32 @@ sub install($$$;$$) {
c::_exit(0);
}
- #- after enough retry, abort.
- my @badPackages;
- foreach (@transToInstall) {
- if (!packageFlagInstalled($_) && $_->[$MEDIUM]{selected} && !exists($ignoreBadPkg{packageName($_)})) {
- push @badPackages, $_;
- } else {
- packageFreeHeader($_);
- }
- }
- @transToInstall = @badPackages;
- $retry or last;
-
- #- examine each package, check they have been installed accordingly.
- if (@transToInstall) {
+ #- if we are using a retry mode, this means we have to split the transaction with only
+ #- one package for each real transaction.
+ unless ($retry) {
+ my @badPackages;
foreach (@transToInstall) {
- log::l("bad package $_->[$FILE]");
+ if (!packageFlagInstalled($_) && $_->[$MEDIUM]{selected} && !exists($ignoreBadPkg{packageName($_)})) {
+ push @badPackages, $_;
+ log::l("bad package $_->[$FILE]");
+ } else {
+ packageFreeHeader($_);
+ }
+ }
+ @transToInstall = @badPackages;
+ #- if we are in retry mode, we have to fetch only one package at a time.
+ $retry = shift @transToInstall;
+ } else {
+ if (!packageFlagInstalled($retry) && $retry->[$MEDIUM]{selected} && !exists($ignoreBadPkg{packageName($retry)})) {
+ log::l("bad package $retry->[$FILE] unable to be installed");
+ packageSetFlagSelected($retry, 0);
+ cdie ("error installing package list: $retry->[$FILE]");
}
- log::l("retrying transaction on bad packages");
- --$retry;
+ packageFreeHeader($retry);
+ $retry = shift @transToInstall;
}
}
- packageFreeHeader($_) foreach @transToInstall;
cleanHeaders($prefix);
-
- if (@transToInstall) {
- foreach (@transToInstall) {
- log::l("bad package $_->[$FILE] unable to be installed");
- packageSetFlagSelected($_, 0);
- }
- cdie ("error installing package list: " . join(", ", map { $_->[$FILE] } @transToInstall));
- }
} while ($nb > 0 && !$pkgs::cancel_install);
cleanHeaders($prefix);