aboutsummaryrefslogtreecommitdiffstats
path: root/genhdlist2
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-02-27 21:58:14 +0000
committerThierry Vignaud <tv@mageia.org>2012-02-27 21:58:14 +0000
commit9e771836253d72c0e2a9f813a4ed79d2e7df3f22 (patch)
treecec19ddc7b3e76f7ecbe85e282ceaf6a05e8ec7b /genhdlist2
parenta00b17d122fc6a84a27af6c0ab7a6256a53a0870 (diff)
downloadrpmtools-9e771836253d72c0e2a9f813a4ed79d2e7df3f22.tar
rpmtools-9e771836253d72c0e2a9f813a4ed79d2e7df3f22.tar.gz
rpmtools-9e771836253d72c0e2a9f813a4ed79d2e7df3f22.tar.bz2
rpmtools-9e771836253d72c0e2a9f813a4ed79d2e7df3f22.tar.xz
rpmtools-9e771836253d72c0e2a9f813a4ed79d2e7df3f22.zip
(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
Diffstat (limited to 'genhdlist2')
-rw-r--r--genhdlist230
1 files changed, 26 insertions, 4 deletions
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;