From c5a396886fbfbfd785c3509e380bdd3f5e4496f0 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 24 Dec 2017 21:57:27 +0000 Subject: Better handling of excluded packages. --- lib/MGA/DrakISO/BuildMedia.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm index 32dc1ee..2455c03 100644 --- a/lib/MGA/DrakISO/BuildMedia.pm +++ b/lib/MGA/DrakISO/BuildMedia.pm @@ -51,6 +51,10 @@ my %package_class; # in that group. my %group_threshold; +# This array contains the list of packages the user has asked to be excluded. +# Each array element is the name of a package. +my @excluded_packages; + # This hash contains the selected packages known to conflict with other # selected packages. It is optionally seeded from a list provided by the # user, and will be added to when we run a test installation and detect @@ -338,7 +342,7 @@ sub update_dependencies { # Calculate the dependencies and update the package list. my @packages = keys %package_class; - my $skip_list = %known_conflicts ? join(',', keys %known_conflicts) : ''; + my $skip_list = join(',', keys %known_conflicts, @excluded_packages); add_dependencies_to_selected_packages($build, \@packages, $skip_list); } @@ -394,7 +398,7 @@ sub handle_conflicts { my @packages = keys %package_class; my $log_file = $build->get_builddir('tmp') . '/test-install.log'; - my $skip_list = %known_conflicts ? join(',', keys %known_conflicts) : ''; + my $skip_list = join(',', keys %known_conflicts, @excluded_packages); my $error = check_for_conflicts($build, \@packages, $log_file, $skip_list); return if !($error || %known_conflicts); @@ -420,7 +424,7 @@ sub handle_conflicts { } @packages = keys %package_class; $log_file = $build->get_builddir('tmp') . '/test-install-' . $tries . '.log'; - $skip_list = join(',', keys %known_conflicts); + $skip_list = join(',', keys %known_conflicts, @excluded_packages); } while check_for_conflicts($build, \@packages, $log_file, $skip_list); print "NOTE: some package conflicts were automatically resolved.\n"; } @@ -428,6 +432,7 @@ sub handle_conflicts { update_dependencies($build); my $errors = 0; + $skip_list = join(',', @excluded_packages); foreach my $pkg (keys %known_conflicts) { $error = check_for_conflicts($build, [ $pkg ], $log_file); if ($error) { @@ -438,7 +443,7 @@ sub handle_conflicts { $errors++; } else { $package_class{$pkg} = 1; - add_dependencies_to_selected_packages($build, [ $pkg ]); + add_dependencies_to_selected_packages($build, [ $pkg ], $skip_list); } } if ($errors) { @@ -452,7 +457,7 @@ sub check_for_conflicts { my ($build, $packages, $log_file, $o_skip_list) = @_; print "Checking for package conflicts and unsatisfied dependencies\n" if $::verbose > 1; - my $options = '-q --test --auto --ignoresize --no-verify-rpm'; + my $options = '-q --test --auto --no-recommends --ignoresize --no-verify-rpm'; if ($o_skip_list) { $options .= ' --skip ' . $o_skip_list; } @@ -641,6 +646,7 @@ sub remove_from_selected_packages { } else { print "WARNING <$source>: $pkg is not currently selected\n" if $o_warn; } + push @excluded_packages, $pkg; } sub update_package_selection { -- cgit v1.2.1