summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO/BuildClassic.pm
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-12-22 19:53:53 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-12-22 20:39:20 +0000
commitc3802a7f2b424abfb77c88104357877bf43ab2c6 (patch)
tree1137e17f09bbde154094fb7b6be11138bc2af53e /lib/MGA/DrakISO/BuildClassic.pm
parent2e7c611d1b25c6ccf99585089c9372bdd3701f88 (diff)
downloaddrakiso-c3802a7f2b424abfb77c88104357877bf43ab2c6.tar
drakiso-c3802a7f2b424abfb77c88104357877bf43ab2c6.tar.gz
drakiso-c3802a7f2b424abfb77c88104357877bf43ab2c6.tar.bz2
drakiso-c3802a7f2b424abfb77c88104357877bf43ab2c6.tar.xz
drakiso-c3802a7f2b424abfb77c88104357877bf43ab2c6.zip
Add comand line option to set force and verbosity level.
Diffstat (limited to 'lib/MGA/DrakISO/BuildClassic.pm')
-rwxr-xr-xlib/MGA/DrakISO/BuildClassic.pm38
1 files changed, 17 insertions, 21 deletions
diff --git a/lib/MGA/DrakISO/BuildClassic.pm b/lib/MGA/DrakISO/BuildClassic.pm
index 503b044..384a64f 100755
--- a/lib/MGA/DrakISO/BuildClassic.pm
+++ b/lib/MGA/DrakISO/BuildClassic.pm
@@ -36,10 +36,6 @@ use MGA::DrakISO::Utils;
# Global Variables
###############################################################################
-my $force = 1;
-
-my $verbose = 1;
-
# This hash contains the currently enabled media in our urpmi chroot.
# The hash key is the media name and the hash value is the media URL.
my %media;
@@ -173,7 +169,7 @@ sub include_groups {
# Read the lists of groups requested by the user.
foreach my $file (@$file_list) {
-f $file or die "ERROR: cannot open group list file '$file'\n";
- print "Including groups from $file\n" if $verbose > 1;
+ print "Including groups from $file\n" if $::verbose > 1;
my $line_number = 0;
foreach my $line (cat_($file)) {
chomp($line);
@@ -315,7 +311,7 @@ sub include_packages {
my ($build, $file_list) = @_;
foreach my $file (@$file_list) {
- print "Including packages from $file\n" if $verbose;
+ print "Including packages from $file\n" if $::verbose;
update_package_selection($build, $file, \&add_to_selected_packages, 1, 'warn');
report_package_count();
}
@@ -325,7 +321,7 @@ sub exclude_packages {
my ($build, $file_list) = @_;
foreach my $file (@$file_list) {
- print "Excluding packages from $file\n" if $verbose;
+ print "Excluding packages from $file\n" if $::verbose;
update_package_selection($build, $file, \&remove_from_selected_packages, 0, 'warn');
report_package_count();
}
@@ -338,7 +334,7 @@ sub exclude_packages {
sub update_dependencies {
my ($build) = @_;
- print "Calculating dependencies\n" if $verbose;
+ print "Calculating dependencies\n" if $::verbose;
# Remove any existing dependencies.
my @dependencies = grep { $package_class{$_} == 2 } keys %package_class;
@@ -378,7 +374,7 @@ sub get_known_conflicts {
my $file = $build->{known_conflicts};
-f $file or return;
- print "Reading known conflicts from $file\n" if $verbose;
+ print "Reading known conflicts from $file\n" if $::verbose;
foreach my $line (cat_($file)) {
my ($data, $comment) = split('#', $line);
next if !$data; # skip pure comment lines
@@ -408,7 +404,7 @@ sub handle_conflicts {
return if !($error || %known_conflicts);
if ($error) {
- print "Attempting to resolve package conflicts\n" if $verbose;
+ print "Attempting to resolve package conflicts\n" if $::verbose;
my $tries = 0;
do {
if (++$tries > 5) {
@@ -422,7 +418,7 @@ sub handle_conflicts {
foreach my $pkg (cat_($conflicts_file)) {
chomp($pkg);
$pkg =~ s/^(\S+)-\d+(\.\d+)*-\d+\.mga\d+(\.\w+)+$/$1/;
- print " $pkg\n" if $verbose > 1;
+ print " $pkg\n" if $::verbose > 1;
delete $package_class{$pkg};
$known_conflicts{$pkg} = 1;
}
@@ -450,7 +446,7 @@ sub handle_conflicts {
}
}
if ($errors) {
- die if !$force;
+ die if !$::force;
print "NOTE: **** continuing due to --force option ****\n";
print "NOTE: **** this ISO is not suitable for final release ****\n";
}
@@ -459,7 +455,7 @@ sub handle_conflicts {
sub check_for_conflicts {
my ($build, $packages, $log_file, $o_skip_list) = @_;
- print "Checking for package conflicts and unsatisfied dependencies\n" if $verbose > 1;
+ print "Checking for package conflicts and unsatisfied dependencies\n" if $::verbose > 1;
my $options = '-q --test --auto --ignoresize --no-verify-rpm';
if ($o_skip_list) {
$options .= ' --skip ' . $o_skip_list;
@@ -474,7 +470,7 @@ sub check_for_conflicts {
sub build_installer_media {
my ($build) = @_;
- print "Building installer media\n" if $verbose;
+ print "Building installer media\n" if $::verbose;
# Create a clean set of media directories
my $arch = $build->{settings}{arch};
@@ -484,7 +480,7 @@ sub build_installer_media {
mkdir_p($media_dir . 'media_info');
mkdir_p($media_dir . $_ . '/media_info') foreach @{$build->{repo}{classes}};
- print " adding RPMs\n" if $verbose > 1;
+ print " adding RPMs\n" if $::verbose > 1;
# Use urpmq to list the full source paths to the selected RPMs.
my @packages = keys %package_class;
@@ -503,7 +499,7 @@ sub build_installer_media {
copy_or_link($src_file, $dst_file);
}
- print " generating media info\n" if $verbose > 1;
+ print " generating media info\n" if $::verbose > 1;
# Copy the pubkeys from the repository. Use the pubkeys from the first
# media type in each class.
@@ -523,7 +519,7 @@ sub build_installer_media {
copy_or_link($repo_media_dir . '/media_info/rpmsrate', $media_dir . 'media_info/rpmsrate');
# Generate the remaining media info.
- my $silent = $verbose < 3 ? ' -s' : '';
+ my $silent = $::verbose < 3 ? ' -s' : '';
print "-- messages from gendistrib -----------------------\n" if !$silent;
system("gendistrib $silent $arch_dir\n") == 0
or die "ERROR: gendistrib failed to generate the media info.\n";
@@ -635,7 +631,7 @@ sub add_to_selected_packages {
if ($package_class{$pkg}) {
print "WARNING <$source>: $pkg is already selected\n" if $o_warn;
} else {
- print "INFO: Selecting package $pkg\n" if $verbose > 2;
+ print "INFO: Selecting package $pkg\n" if $::verbose > 2;
$package_class{$pkg} = $class;
}
}
@@ -644,7 +640,7 @@ sub remove_from_selected_packages {
my ($source, $pkg, $class, $o_warn) = @_;
if (defined $package_class{$pkg}) {
- print "INFO: Deselecting package $pkg\n" if $verbose > 2;
+ print "INFO: Deselecting package $pkg\n" if $::verbose > 2;
delete $package_class{$pkg};
} else {
print "WARNING <$source>: $pkg is not currently selected\n" if $o_warn;
@@ -667,7 +663,7 @@ sub update_package_selection {
$action->($file, $alternative, $class);
}
} elsif ($pkg =~ /-$/) {
- print " expanding package $pkg\n" if $verbose > 1;
+ print " expanding package $pkg\n" if $::verbose > 1;
my $available_list = $build->get_builddir('tmp') . '/pkg-available.lst';
my @candidates = split('\n', `LC_ALL=C grep '^$pkg' $available_list`);
foreach (@candidates) {
@@ -681,7 +677,7 @@ sub update_package_selection {
}
sub report_package_count() {
- print " package count = ", scalar keys %package_class, "\n" if $verbose > 1;
+ print " package count = ", scalar keys %package_class, "\n" if $::verbose > 1;
}
1;