mirror of
https://abf.rosa.ru/djam/rpmtools.git
synced 2025-02-24 03:12:49 +00:00
70 lines
2.8 KiB
Diff
70 lines
2.8 KiB
Diff
--- a/genhdlist2 2011-05-31 15:20:48.000000000 +0400
|
|
+++ b/genhdlist2 2012-11-25 22:00:39.725859678 +0400
|
|
@@ -114,7 +114,7 @@
|
|
}
|
|
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) {
|
|
@@ -161,7 +161,7 @@
|
|
}
|
|
|
|
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";
|
|
|
|
@@ -179,10 +179,13 @@
|
|
hdlist => $out_hdlist,
|
|
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);
|
|
@@ -190,8 +193,23 @@
|
|
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) = @_;
|
|
@@ -199,6 +217,9 @@
|
|
if (delete $rpms_todo->{$fullname}) {
|
|
print "keeping $fullname\n" if $verbose > 1;
|
|
add_pkg($out, $pkg);
|
|
+ # read 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;
|