From fa1efafb5d4e75534a481f27f57976e332a4003d Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 6 Sep 2014 17:19:17 +0200 Subject: generates @recommends@ lines on mga5+ (instead of @suggests@ ones) --- genhdlist2 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'genhdlist2') diff --git a/genhdlist2 b/genhdlist2 index 3daf4aa..4b0a380 100755 --- a/genhdlist2 +++ b/genhdlist2 @@ -3,6 +3,7 @@ our ($VERSION) = q(Id: genhdlist2 20460 2006-11-23 13:19:11Z pixel ) =~ /(\d+\.\d+)/; use URPM; +use List::Util 'any'; use MDV::Packdrakeng; use Getopt::Long; use strict; @@ -61,6 +62,18 @@ sub main() { my ($no_bad_rpm, $verbose); my $tmp_header; +sub do_we_use_recommends { + my ($rpms_dir) = @_; + my @files = glob("$rpms_dir/../../core/release/mageia-release-common*"); + if (@files) { + # fast path: + return !any { /mga[1-4]/ } @files; + } else { + # slow path: + return glob("$rpms_dir/*mga[5-9].*.rpm") ? 1 : 0; + } +} + sub do_it { my ($rpms_dir, %options) = @_; @@ -114,9 +127,11 @@ sub do_it { $options{xml_info} = -e "$media_info_dir/info.xml$xml_info_suffix"; } my @xml_media_info = $options{xml_info} ? ('info', 'files', 'changelog') : @{[]}; + # default to "@suggests@" lines on older distros, "@recommends@" lines on newer: + my $output_recommends = do_we_use_recommends($rpms_dir); 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); + build_synthesis($urpm, "$synthesis.tmp", $synthesis_filter, $output_recommends); if (1) { my @media_info_files = ($options{no_hdlist} ? @{[]} : 'hdlist.cz', @@ -374,12 +389,13 @@ sub add_pkg_header { } sub build_synthesis { - my ($urpm, $synthesis, $synthesis_filter) = @_; + my ($urpm, $synthesis, $synthesis_filter, $output_recommends) = @_; $urpm->build_synthesis( start => 0, end => $#{$urpm->{depslist}}, synthesis => $synthesis, filter => $synthesis_filter, + recommends => $output_recommends, ) or die "build_synthesis failed (disk full?)\n"; } -- cgit v1.2.1