From 9e771836253d72c0e2a9f813a4ed79d2e7df3f22 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 27 Feb 2012 21:58:14 +0000 Subject: (get_filesize_from_synthesis) read back real filesizes from synthesis (filter_existing_hdlist) readd back real filesizes read from synthesis else, since hdlist no more have filesizes since 2008, URPM will put a bogus estimation in newly generated synthesis --- genhdlist2 | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'genhdlist2') diff --git a/genhdlist2 b/genhdlist2 index 325456f..a77e510 100644 --- a/genhdlist2 +++ b/genhdlist2 @@ -115,7 +115,7 @@ sub do_it { } my @xml_media_info = $options{xml_info} ? ('info', 'files', 'changelog') : (); - build($urpm, \%rpms_todo, $media_info_dir, $rpms_dir, \@xml_media_info, $options{no_incremental}, $options{no_hdlist}, $xml_info_suffix, $xml_info_filter); + build($urpm, \%rpms_todo, $media_info_dir, $rpms_dir, \@xml_media_info, $options{no_incremental}, $options{no_hdlist}, $xml_info_suffix, $xml_info_filter, $synthesis); build_synthesis($urpm, "$synthesis.tmp", $synthesis_filter); if (1) { @@ -162,7 +162,7 @@ sub read_file_deps { } sub build { - my ($urpm, $rpms_todo, $media_info_dir, $rpms_dir, $xml_media_info, $b_no_incremental, $b_no_hdlist, $xml_info_suffix, $xml_info_filter) = @_; + my ($urpm, $rpms_todo, $media_info_dir, $rpms_dir, $xml_media_info, $b_no_incremental, $b_no_hdlist, $xml_info_suffix, $xml_info_filter, $synthesis) = @_; my $hdlist = "$media_info_dir/hdlist.cz"; @@ -181,9 +181,13 @@ sub build { map { $_ => open_xml_filter("$media_info_dir/$_.xml${xml_info_suffix}.tmp", $xml_info_filter) } @$xml_media_info }; + # keep real filesizes from synthesis since hdlist no more have filesizes since 2008 + # else URPM will put a bogus estimation: + my $sizes = get_filesize_from_synthesis($urpm, $rpms_todo, $synthesis); + if (-e $hdlist && !$b_no_incremental) { print "filtering $hdlist into hdlist.cz.tmp\n" if $verbose >= 0; - filter_existing_hdlist($urpm, $rpms_todo, $hdlist, $out); + filter_existing_hdlist($urpm, $rpms_todo, $hdlist, $out, $sizes); } add_new_rpms_to_hdlist($urpm, $rpms_todo, $out, $rpms_dir); @@ -191,8 +195,23 @@ sub build { close_xml($out->{$_}) foreach @$xml_media_info; } +sub get_filesize_from_synthesis { + my ($urpm, $rpms_todo, $synthesis) = @_; + + return {} if !-r $synthesis; + + my %sizes; + $urpm->parse_synthesis($synthesis, packing => 1, callback => sub { + my (undef, $pkg) = @_; + my $fullname = $pkg->fullname; + $sizes{$fullname} = $pkg->filesize if $rpms_todo->{$fullname}; + 0; # don't keep in memory + }); + \%sizes; +} + sub filter_existing_hdlist { - my ($urpm, $rpms_todo, $in_hdlist, $out) = @_; + my ($urpm, $rpms_todo, $in_hdlist, $out, $sizes) = @_; if ($urpm->parse_hdlist($in_hdlist, packing => 1, callback => sub { my (undef, $pkg) = @_; @@ -200,6 +219,9 @@ sub filter_existing_hdlist { if (delete $rpms_todo->{$fullname}) { print "keeping $fullname\n" if $verbose > 1; add_pkg($out, $pkg); + # readd back real filesize from synthesis since hdlist no more have filesizes since 2008 + # else URPM will put a bogus estimation: + $pkg->set_filesize($sizes->{$fullname}) if $sizes->{$fullname}; 1; # do keep in memory } else { print "removing $fullname\n" if $verbose > 0; -- cgit v1.2.1 n> Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
path: root/tools/i386/netboot/ne
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2015-02-19 10:12:45 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2015-02-19 10:29:38 +0100
commit8303c61eeea4fffd6953ca7178bc58878953f560 (patch)
treeb0dddc43409a207bb649698ad1cc18fc5d322484 /tools/i386/netboot/ne
parentf3c7c3356286dba238bac199ff6210a8e415a964 (diff)
downloaddrakx-16.62.tar
drakx-16.62.tar.gz
drakx-16.62.tar.bz2
drakx-16.62.tar.xz
drakx-16.62.zip