diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-08-11 00:59:17 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-08-11 00:59:17 +0000 |
commit | add972b102e4d2d75a8a8c5615213fa2e7086542 (patch) | |
tree | 753452136c16f89764c6dcf5232c58055364b928 | |
parent | 9bd5a8ef4476071a69e3ad80e754038d97895489 (diff) | |
download | rpmdrake-add972b102e4d2d75a8a8c5615213fa2e7086542.tar rpmdrake-add972b102e4d2d75a8a8c5615213fa2e7086542.tar.gz rpmdrake-add972b102e4d2d75a8a8c5615213fa2e7086542.tar.bz2 rpmdrake-add972b102e4d2d75a8a8c5615213fa2e7086542.tar.xz rpmdrake-add972b102e4d2d75a8a8c5615213fa2e7086542.zip |
(get_pkgs) factorize code by reusing urpm::get_updates_description()
-rwxr-xr-x | Rpmdrake/pkg.pm | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index cbf8b8e5..5cfa59eb 100755 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -251,7 +251,6 @@ sub open_urpmi_db() { our $probe_only_for_updates; sub get_pkgs { my ($opts) = @_; - my %update_descr; @update_medias = (); my $w = $::main_window; @@ -267,29 +266,9 @@ sub get_pkgs { Rpmdrake::gurpm::label(N("Reading updates description")); Rpmdrake::gurpm::progress(0.05); - my ($cur, $section); + #- parse the description file - foreach my $medium (@update_medias) { - foreach (cat_(urpm::media::statedir_descriptions($urpm, $medium))) { - /^%package +(.+)/ and do { - my @pkg_list = split /\s+/, $1; - exists $cur->{importance} && $cur->{importance} !~ /^(?:security|bugfix)\z/ - and $cur->{importance} = 'normal'; - $update_descr{$_} = $cur foreach @{$cur->{pkgs} || []}; - $cur = { pkgs => \@pkg_list, medium => $medium->{name} }; - $section = 'pkg'; - next; - }; - /^%(pre|description)/ and do { $section = $1; next }; - /^Updated?: +(.+)/ && $section eq 'pkg' - and do { $cur->{update} = $1; next }; - /^Importance: +(.+)/ && $section eq 'pkg' - and do { $cur->{importance} = $1; next }; - /^(ID|URL): +(.+)/ && $section eq 'pkg' - and do { $cur->{$1} = $2; next }; - $section =~ /^(pre|description)\z/ and $cur->{$1} .= $_; - } - } + my %update_descr = urpm::get_updates_description($urpm, @update_medias); my $_unused = N("Please wait, finding available packages..."); |