diff options
Diffstat (limited to 'lib/MGA/DrakISO/BuildMedia.pm')
-rw-r--r-- | lib/MGA/DrakISO/BuildMedia.pm | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm index dced6e5..8d589b4 100644 --- a/lib/MGA/DrakISO/BuildMedia.pm +++ b/lib/MGA/DrakISO/BuildMedia.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2018 Mageia +# Copyright (C) 2017-2022 Mageia # Martin Whitaker <mageia@martin-whitaker.me.uk> # # This program is free software; you can redistribute it and/or modify @@ -101,8 +101,10 @@ sub prepare_media { build_installer_media($build); - check_installer_media($build, ${$build->{urpmi_media}{enabled_sections}}[0]); - check_installer_media($build, '*'); + my $base_section = ${$build->{urpmi_media}{enabled_sections}}[0]; + foreach my $section (@{$build->{urpmi_media}{enabled_sections}}) { + check_installer_media($build, $section, $base_section); + } my $arch_dir = $build->get_build_dir('files/' . $build->{settings}{arch}); @@ -323,23 +325,16 @@ sub add_rated_packages { my ($ratings, $flag_expressions) = partition { /^\d$/ } @values; my ($rating) = @$ratings or die "ERROR: missing rating at $file line $line_number\n"; - # In the installer, the set of flag expressions is treated as a - # list of conditions, all of which must be true for the package - # to be selected. But we need to include the packages for any - # possible selection of categories, so we need to determine - # whether any individual flag matches one of groups specified by - # the user and whether the package rating meets the specified - # threshold for that group. - my @flags = map { split('\|\|', $_) } @$flag_expressions; - # Skip any architecture-specific packages that don't match our # architecture. my $arch = $build->{settings}{arch}; - next if $arch eq 'x86_64' && member('!TYPE"64bit"', @flags); - next if $arch ne 'x86_64' && member( 'TYPE"64bit"', @flags); + next if $arch eq 'x86_64' && member('!TYPE"64bit"', @$flag_expressions); + next if $arch ne 'x86_64' && member( 'TYPE"64bit"', @$flag_expressions); # Skip any packages that don't match the user's requirements. - next if !any { defined $group_threshold{$_} && $rating >= $group_threshold{$_} } @flags; + next if any { + !any { $_ =~ /^!/ || !defined $group_threshold{$_} || $rating >= $group_threshold{$_} } split('\|\|', $_) + } @$flag_expressions; # For each package, set the package class to 1 to indicate it is # an explicitly selected package. @@ -552,14 +547,15 @@ sub create_media_cfg { } sub check_installer_media { - my ($build, $section) = @_; + my ($build, $section, $base_section) = @_; print "Checking installer media [$section]\n" if $::verbose; my $arch = $build->{settings}{arch}; my $media_dir = $build->get_build_dir('files/' . $arch . '/media'); my $log_file = $build->get_build_dir('tmp') . '/rpmcheck.log'; - run_("zcat -q $media_dir/$section/media_info/hdlist.cz | rpmcheck -explain -failures > $log_file") + my $base = $section ne $base_section ? "-base $media_dir/$base_section/media_info/hdlist.cz" : ""; + run_("cat $media_dir/$section/media_info/hdlist.cz | rpmcheck -explain -failures -compressed-input $base > $log_file") or die "ERROR: failed to run rpmcheck\n"; if (system('grep', '-q', 'FAILED', $log_file) == 0) { @@ -579,7 +575,7 @@ sub read_repo_product_id { my $src_file = $build->{settings}{repository} . '/' . $build->{settings}{arch} . '/product.id'; my $product_id; - if ($src_file =~ m!^(ftp|http)://!) { + if ($src_file =~ m!^(ftp|https?)://!) { $product_id = `curl --silent $src_file`; $? and die "ERROR: couldn't fetch product.id file from repository\n"; } else { @@ -622,26 +618,24 @@ sub create_index { my $media_dir = $build->get_build_dir('files/' . $arch . '/media/'); my @hdlists = glob("$media_dir/*/media_info/hdlist.cz"); - my @tab; + my %pkgs; my $urpm = URPM->new; foreach (@hdlists) { $urpm->parse_hdlist($_); - $urpm->traverse(sub { - my $pkg = shift; - my $pkgname = $pkg->name; - my $version = $pkg->version; - my $arch = $pkg->arch; - push @tab, "$pkgname-$version ($arch)"; - }); } - - my %hashtab = map { $_ => 1 } @tab; - my @orderedpkgs = sort keys %hashtab; + $urpm->traverse(sub { + my ($pkg) = @_; + my $pkgname = $pkg->name; + my $version = $pkg->version; + my $arch = $pkg->arch; + $pkgs{"$pkgname-$version ($arch)"} = 1; + }); + my @ordered_pkgs = sort keys %pkgs; my $label = $build->{media}{label}; open(my $f, '>', $file); - foreach (@orderedpkgs) { + foreach (@ordered_pkgs) { print $f "$label $_\n"; } close($f); |