From 098761b262cb0a18641dde8e8823e2c42c441729 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Tue, 3 Dec 2002 12:10:07 +0000 Subject: make it $::testing aware --- perl-install/pkgs.pm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'perl-install/pkgs.pm') diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 42c45d5ae..4d793fda5 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -974,9 +974,16 @@ sub install($$$;$$) { $SIG{SEGV} = sub { log::l("segmentation fault on transactions"); c::_exit(0) }; my @prev_pids = grep { /^\d+$/ } all("/proc"); my $db; - eval { - close INPUT; - select((select(OUTPUT), $| = 1)[0]); + close INPUT; + select((select(OUTPUT), $| = 1)[0]); + if ($::testing) { + my $size_typical = $nb ? int($total/$nb) : 0; + foreach (@transToInstall) { + log::l("i would install ", $_->name, " now"); + my $id = $_->id; + print OUTPUT "inst:$id:start:0:$size_typical\ninst:$id:progress:0:$size_typical\nclose:$id\n"; + } + } else { eval { my $db = URPM::DB::open($prefix, 1) or die "error opening RPM database: ", c::rpmErrorString(); my $trans = $db->create_transaction($prefix); if ($retry_pkg) { @@ -1019,7 +1026,7 @@ sub install($$$;$$) { install_any::getFile('XXX'); #- close still opened fd. @probs and die "installation of rpms failed:\n ", join("\n ", @probs); - }; $@ and print OUTPUT "die:$@\n"; + }; $@ and print OUTPUT "die:$@\n"; } close OUTPUT; #- now search for child process which may be locking the cdrom, making it unable to be ejected. @@ -1036,7 +1043,7 @@ sub install($$$;$$) { if (@killpid) { foreach (@killpid) { my $s = "$_: " . join(' ', split("\0", cat_("/proc/$_/cmdline"))); - log::l("ERROR: DrakX should not have to clean the packages shit. Killing $s"); + log::l("ERROR: DrakX should not have to clean the packages shit. Killing $s."); } kill 15, @killpid; sleep 2; @@ -1230,7 +1237,7 @@ sub hashtree2list { while (@todo) { my $e = shift @todo; push @l, $e; - push @todo, @{$h->{$e}}; + push @todo, @{$h->{$e} || []}; } @l; } -- cgit v1.2.1