aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2002-08-27 08:51:51 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2002-08-27 08:51:51 +0000
commit704a9f5ee16ff8371aa5c5e1c8a2a28e50fc6553 (patch)
treefba9c43f4cfd69e9af96199470234f0120ab32db
parentaf2b5b56dff7f62f1d50ce6752831078a5939be8 (diff)
downloadrpmdrake-704a9f5ee16ff8371aa5c5e1c8a2a28e50fc6553.tar
rpmdrake-704a9f5ee16ff8371aa5c5e1c8a2a28e50fc6553.tar.gz
rpmdrake-704a9f5ee16ff8371aa5c5e1c8a2a28e50fc6553.tar.bz2
rpmdrake-704a9f5ee16ff8371aa5c5e1c8a2a28e50fc6553.tar.xz
rpmdrake-704a9f5ee16ff8371aa5c5e1c8a2a28e50fc6553.zip
when computing installed_pkgs, since the $db is opened a bit
long, mimic urpmi and its local sig handlers to ensure the db it closed before exiting
-rwxr-xr-xrpmdrake21
1 files changed, 12 insertions, 9 deletions
diff --git a/rpmdrake b/rpmdrake
index 988a337f..0c2cacf6 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -743,6 +743,9 @@ sub get_installed_pkgs {
my @base = qw(basesystem);
my (%base, %basepackages);
my $db = db;
+ my $sig_handler = sub { undef $db; exit 3 };
+ local $SIG{INT} = $sig_handler;
+ local $SIG{QUIT} = $sig_handler;
while (defined($_ = shift @base)) {
exists $basepackages{$_} and next;
$db->traverse_tag(/^\// ? 'path' : 'whatprovides', [ $_ ], sub {
@@ -757,15 +760,15 @@ sub get_installed_pkgs {
}
}
my %installed_pkgs;
- db->traverse(sub {
- my ($pkg) = @_;
- my $fullname = my_fullname($pkg);
- $base{$fullname} && ${$base{$fullname}}
- #- I need to extract summary and description since they'll be lost when $pkg->pack_header
- or $installed_pkgs{$fullname} = { selected => 0, pkg => $pkg, summary => $pkg->summary,
- description => beautify_description($pkg->description) };
- $pkg->pack_header;
- });
+ $db->traverse(sub {
+ my ($pkg) = @_;
+ my $fullname = my_fullname($pkg);
+ $base{$fullname} && ${$base{$fullname}}
+ #- I need to extract summary and description since they'll be lost when $pkg->pack_header
+ or $installed_pkgs{$fullname} = { selected => 0, pkg => $pkg, summary => $pkg->summary,
+ description => beautify_description($pkg->description) };
+ $pkg->pack_header;
+ });
remove_wait_msg($w);
(new urpm, \%installed_pkgs);
}