From fcf04b54434c7d4e433759a654479bdc77edef09 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 14 Oct 2002 09:03:34 +0000 Subject: - fix typos - when something is eating io bandwith, drakbug is very slow to scroll the menu, since on each item selection, it does rpm db access. solution : o cache rpm result in %packages o only call rpm & which if nothing is cached - if there's the selected package isn't installed, just print "package not installed" (and translate that) --- perl-install/standalone/drakbug | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index a6715bfbd..5957a07b3 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -1,7 +1,7 @@ #!/usr/bin/perl # Drak Bug Report -# C$opyright (C) 2002 MandrakeSoft (daouda@mandrakesoft.com) +# Copyright (C) 2002 MandrakeSoft (daouda@mandrakesoft.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -171,11 +171,18 @@ sub update_app { $app_choice ne '' ? $package->set_text("$app_choice") : $package->set_text(_("Not installed")); } +my %packages; + sub get_package { my ($executable) = @_; my ($rpm_package, $which_app); - $which_app = chomp_(`which '$executable' 2> /dev/null`); - $rpm_package = chomp_(`rpm -qf '$which_app' 2>&1`); + $rpm_package = $packages{$executable}; + if (!defined $rpm_package) { + $which_app = chomp_(`which '$executable' 2> /dev/null`); + # deush, rpm can takes some time aka it'll sleeps if something has opened rpm db ! + $rpm_package = $which_app eq "" ? _("Package not installed") : chomp_(`rpm -qf '$which_app' 2>&1`); + $packages{$executable} = $rpm_package; + } $rpm_package; } -- cgit v1.2.1