From 04c78941c004b63807cfd18b0566bf4dd1200180 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 6 Feb 2008 14:05:53 +0000 Subject: (build_expander,extract_header,format_pkg_simplifiedinfo) - stop downloading & parsing the XML meta data on selecting a package (side effect of urpmi-5.x) - download & parse the needed XML meta data on demand (aka only download & parse the needed ones and not all of them) --- Rpmdrake/pkg.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Rpmdrake/pkg.pm') diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 66c9dae2..9808974d 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -92,7 +92,7 @@ sub run_rpm { our $spacing = " "; sub extract_header { - my ($pkg, $urpm) = @_; + my ($pkg, $urpm, $xml_info) = @_; my $chg_prepro = sub { #- preprocess changelog for faster TextView insert reaction [ map { [ "$spacing$_\n", if_(/^\*/, { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD }) ] } split("\n", $_[0]) ]; @@ -112,7 +112,6 @@ sub extract_header { $local_source = "$dir/" . $p->filename; $urpm->{log}("getting information from rpms from $dir"); } else { - foreach my $xml_info ('info', 'files', 'changelog') { my $gurpm = Rpmdrake::gurpm->new(N("Please wait"), transient => $::main_window); if (my $xml_info_file = urpm::media::any_xml_info($urpm, $medium, $xml_info, undef, sub { download_callback($gurpm, @_) @@ -131,7 +130,6 @@ sub extract_header { $urpm->{error}(N("No xml info for medium \"%s\", unable to return any result for package %s", $medium->{name}, $name)); } } - } } #- even if non-root, search for a header in the global cachedir @@ -148,13 +146,17 @@ sub extract_header { [ $p->changelog_name ], [ $p->changelog_text ], [ $p->changelog_time ])) }); $p->pack_header; # needed in order to call methods on objects outside ->traverse } elsif ($xml_info_pkgs{$name}) { - add2hash($pkg, { description => rpm_description($xml_info_pkgs{$name}{description}) }); - add2hash($pkg, { - files => [ $xml_info_pkgs{$name}{files} || N("(none)") ], - changelog => $chg_prepro->(join("\n", map { - "* " . localtime2changelog($_->{time}) . " $_->{name}\n$_->{text}\n\n"; - } @{$xml_info_pkgs{$name}{changelogs}})) - }); + if ($xml_info eq 'info') { + add2hash($pkg, { description => rpm_description($xml_info_pkgs{$name}{description}) }); + } elsif ($xml_info eq 'files') { + add2hash($pkg, { files => [ $xml_info_pkgs{$name}{files} || N("(none)") ] }); + } elsif ($xml_info eq 'changelog') { + add2hash($pkg, { + changelog => $chg_prepro->(join("\n", map { + "* " . localtime2changelog($_->{time}) . " $_->{name}\n$_->{text}\n\n"; + } @{$xml_info_pkgs{$name}{changelogs}})) + }); + } $p->pack_header; # needed in order to call methods on objects outside ->traverse } else { goto header_non_available; -- cgit v1.2.1