diff options
Diffstat (limited to 'lib/MGA/DrakISO')
-rw-r--r-- | lib/MGA/DrakISO/BuildBoot.pm | 2 | ||||
-rw-r--r-- | lib/MGA/DrakISO/BuildMedia.pm | 54 | ||||
-rw-r--r-- | lib/MGA/DrakISO/BuildRoot.pm | 4 | ||||
-rw-r--r-- | lib/MGA/DrakISO/Utils.pm | 2 |
4 files changed, 28 insertions, 34 deletions
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm index 861f56a..83f158c 100644 --- a/lib/MGA/DrakISO/BuildBoot.pm +++ b/lib/MGA/DrakISO/BuildBoot.pm @@ -273,7 +273,7 @@ sub prepare_iso_bootloader { # Give it a label, to try to work around mga#23939. my $esp_image = $images_dir . '/esp.img'; eval { rm_rf($esp_image) }; - run_('/sbin/mkdosfs', '-n', 'MGALIVE-ESP', '-F12', '-C', $esp_image, '4096'); + run_('/sbin/mkdosfs', '-n', 'MGAISO-ESP', '-F12', '-C', $esp_image, '4096'); run_('mcopy', '-s', '-i', $esp_image, $efi_root_dir, '::'); # Now we've built the ESP image, we can delete the grub2 image. We need 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); diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm index b20dc34..995b419 100644 --- a/lib/MGA/DrakISO/BuildRoot.pm +++ b/lib/MGA/DrakISO/BuildRoot.pm @@ -62,7 +62,7 @@ sub install_live_system { my $base_repository = $build->{settings}{repository}; my $arch_repository = $base_repository . '/' . $arch; - my $remote_method = $arch_repository =~ m!^(ftp|http)://! && $1; + my $remote_method = $arch_repository =~ m!^(ftp|https?)://! && ($1 =~ s/https/http/r); my $chroot = $build->get_chroot_dir; @@ -683,7 +683,7 @@ sub copy_file_to_root { my ($root, $dst_dir, $mode, $src_file) = @_; my $dst_file = $dst_dir . '/' . basename($src_file); - if ($src_file =~ m!^(ftp|http)://!) { + if ($src_file =~ m!^(ftp|https?)://!) { run_as_root('curl', '--silent', '-o', $root . $dst_file, $src_file) or die "ERROR: couldn't copy $src_file to $dst_file\n"; } else { diff --git a/lib/MGA/DrakISO/Utils.pm b/lib/MGA/DrakISO/Utils.pm index cb2702d..e604652 100644 --- a/lib/MGA/DrakISO/Utils.pm +++ b/lib/MGA/DrakISO/Utils.pm @@ -84,7 +84,7 @@ sub run_in_root { sub copy_or_link { my ($src_file, $dst_file) = @_; mkdir_p(dirname($dst_file)); - if ($src_file =~ m!^(ftp|http)://!) { + if ($src_file =~ m!^(ftp|https?)://!) { run_as_root('curl', '--silent', '-o', $dst_file, $src_file) or die "ERROR: couldn't copy $src_file to $dst_file\n"; } else { |