summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2021-03-27 21:38:31 +0100
committerMaat <maat-pub@mageia.biz>2021-03-27 21:38:31 +0100
commite3173a683d398dfd305aa38390d32e51c973892b (patch)
tree045291ca9bdb920744cab12411e94703512dbb6f
parentce6970daa44f6cd66d62bcf391e648a7ca5d332d (diff)
downloadurpmi-e3173a683d398dfd305aa38390d32e51c973892b.tar
urpmi-e3173a683d398dfd305aa38390d32e51c973892b.tar.gz
urpmi-e3173a683d398dfd305aa38390d32e51c973892b.tar.bz2
urpmi-e3173a683d398dfd305aa38390d32e51c973892b.tar.xz
urpmi-e3173a683d398dfd305aa38390d32e51c973892b.zip
Cleaning indentation in urpmi
-rwxr-xr-xurpmi274
1 files changed, 137 insertions, 137 deletions
diff --git a/urpmi b/urpmi
index 81f90f96..80a3e767 100755
--- a/urpmi
+++ b/urpmi
@@ -169,13 +169,13 @@ if (member('--restricted', @ARGV)) {
@ARGVcopy = @ARGV;
} else {
foreach my $a (@ARGV) {
- if ($a =~ /\.urpmi$/) {
- open my $fh, '<', $a or do { warn "Can't open $a: $!\n"; next };
- push @ARGVcopy, map { chomp; $_ } <$fh>;
- close $fh;
- } else {
- push @ARGVcopy, $a;
- }
+ if ($a =~ /\.urpmi$/) {
+ open my $fh, '<', $a or do { warn "Can't open $a: $!\n"; next };
+ push @ARGVcopy, map { chomp; $_ } <$fh>;
+ close $fh;
+ } else {
+ push @ARGVcopy, $a;
+ }
}
@ARGV = @ARGVcopy;
}
@@ -201,14 +201,14 @@ my @spec_files;
# Process the rest of the arguments
foreach (@ARGV) {
if (/\.(?:rpm|spec)$/) {
- if (/\.src\.rpm$/) {
- push @src_files, $_;
- } elsif (/\.spec$/) {
- push @spec_files, $_;
- } else {
- push @files, untaint($_);
- }
- next;
+ if (/\.src\.rpm$/) {
+ push @src_files, $_;
+ } elsif (/\.spec$/) {
+ push @spec_files, $_;
+ } else {
+ push @files, untaint($_);
+ }
+ next;
}
push @names, $_;
}
@@ -228,8 +228,8 @@ if ($install_src) {
$options{nolock} = 1;
} elsif (@spec_files) {
if (!$options{buildrequires}) {
- $urpm->{error}(N("defaulting to --buildrequires"));
- $options{buildrequires} = 1;
+ $urpm->{error}(N("defaulting to --buildrequires"));
+ $options{buildrequires} = 1;
}
push @src_files, @spec_files;
} elsif (@src_files && !$options{buildrequires}) {
@@ -245,7 +245,7 @@ if ($restricted) {
#- forbid some other options
urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $force || $env || $parallel || $options{synthesis} || $auto_update || $options{auto_orphans};
foreach (qw(allow-nodeps allow-force curl-options rsync-options wget-options prozilla-options noscripts)) {
- urpm::error_restricted($urpm) if $urpm->{options}{$_};
+ urpm::error_restricted($urpm) if $urpm->{options}{$_};
}
}
@@ -253,13 +253,13 @@ if ($restricted) {
my $bug = $options{bug};
if ($bug) {
mkdir $bug or $urpm->{fatal}(8, (-d $bug
- ? N("Directory [%s] already exists, please use another directory for bug report or delete it", $bug)
- : N("Unable to create directory [%s] for bug report", $bug)));
+ ? N("Directory [%s] already exists, please use another directory for bug report or delete it", $bug)
+ : N("Unable to create directory [%s] for bug report", $bug)));
#- copy all synthesis file used, along with configuration of urpmi
my @list_files = grep { -e $_ } $urpm->{skiplist}, $urpm->{instlist},
$urpm->{prefer_list}, $urpm->{prefer_vendor_list}, '/root/.rpmdrake';
system("cp", "-af", @list_files, $urpm->{config}, $bug)
- and die N("Copying failed");
+ and die N("Copying failed");
#- log everything for bug report.
$logfile = "$bug/urpmi.log";
}
@@ -268,8 +268,8 @@ if ($env) {
urpm::set_env($urpm, $env);
} else {
if ($< != 0 && !$options{debug__do_not_install}) {
- #- need to be root if binary rpms are to be installed
- $auto_select || @names || @files and $urpm->{fatal}(1, N("Only superuser is allowed to install packages"));
+ #- need to be root if binary rpms are to be installed
+ $auto_select || @names || @files and $urpm->{fatal}(1, N("Only superuser is allowed to install packages"));
}
}
@@ -292,33 +292,33 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
#- fork twice to copy stdout and stderr to $logfile
unless ($pid_out = open STDOUT, "|-") {
- select $SAVEOUT; $| = 1;
- $/ = \1;
- binmode STDIN, ':raw'; #- since we read character by character, perl must not try to recognise utf8 strings since it really can't
- while (my $s = <STDIN>) {
- open my $fh, ">>$logfile";
- print $SAVEOUT $s;
- print $fh $s;
- }
- exit 0;
+ select $SAVEOUT; $| = 1;
+ $/ = \1;
+ binmode STDIN, ':raw'; #- since we read character by character, perl must not try to recognise utf8 strings since it really can't
+ while (my $s = <STDIN>) {
+ open my $fh, ">>$logfile";
+ print $SAVEOUT $s;
+ print $fh $s;
+ }
+ exit 0;
}
unless ($pid_err = open STDERR, "|-") {
- select $SAVEERR; $| = 1;
- $/ = \1;
- binmode STDIN, ':raw'; #- since we read character by character, perl must not try to recognise utf8 strings since it really can't
- while (my $s = <STDIN>) {
- open my $fh, ">>$logfile";
- print $SAVEERR $s;
- print $fh $s;
- }
- exit 0;
+ select $SAVEERR; $| = 1;
+ $/ = \1;
+ binmode STDIN, ':raw'; #- since we read character by character, perl must not try to recognise utf8 strings since it really can't
+ while (my $s = <STDIN>) {
+ open my $fh, ">>$logfile";
+ print $SAVEERR $s;
+ print $fh $s;
+ }
+ exit 0;
}
#- log to SAVEERR instead of STDERR
unless ($bug) {
- $urpm->{fatal} = sub { printf $SAVEERR "%s\n", $_[1]; exit($_[0]) };
- $urpm->{error} = sub { printf $SAVEERR "%s\n", $_[0] };
- $urpm->{log} = sub { printf $SAVEOUT "%s\n", $_[0] };
+ $urpm->{fatal} = sub { printf $SAVEERR "%s\n", $_[1]; exit($_[0]) };
+ $urpm->{error} = sub { printf $SAVEERR "%s\n", $_[0] };
+ $urpm->{log} = sub { printf $SAVEOUT "%s\n", $_[0] };
}
}
@@ -388,11 +388,11 @@ my $rpm_lock = !$env && !$options{nolock} && urpm::lock::rpm_db($urpm, 'exclusiv
my $search_result = '';
if (@names) {
$search_result = urpm::select::search_packages($urpm,
- \%requested, \@names,
- all => $all,
- use_provides => $use_provides,
- fuzzy => $urpm->{options}{fuzzy},
- no_substring => $urpm->{options}{auto}, # do not allow substring match if we can't prompt the user
+ \%requested, \@names,
+ all => $all,
+ use_provides => $use_provides,
+ fuzzy => $urpm->{options}{fuzzy},
+ no_substring => $urpm->{options}{auto}, # do not allow substring match if we can't prompt the user
) || $force or exit 1;
if (%requested) {
@@ -402,10 +402,10 @@ if (@names) {
}
if (@src_names) {
$search_result = urpm::select::search_packages($urpm, \%requested, \@src_names,
- all => $all,
- use_provides => $use_provides,
- fuzzy => $urpm->{options}{fuzzy},
- src => 1,
+ all => $all,
+ use_provides => $use_provides,
+ fuzzy => $urpm->{options}{fuzzy},
+ src => 1,
) || $force or exit 1;
}
@@ -417,16 +417,16 @@ sub ask_choice {
my @choices;
if ($prefered && @$prefered) {
- @choices = @$choices;
+ @choices = @$choices;
} else {
- ($prefered, my $other) = urpm::select::get_preferred($urpm, $choices, $options{prefer});
- @choices = (@$prefered, @$other);
+ ($prefered, my $other) = urpm::select::get_preferred($urpm, $choices, $options{prefer});
+ @choices = (@$prefered, @$other);
}
my $prefer = @$prefered && join(',', grep { member($choices[$_-1], @$prefered) } 1 .. @choices);
my (@l) = map {
- my ($name, $summary) = (scalar($_->fullname), translate($_->summary));
- $_->flag_installed ?
+ my ($name, $summary) = (scalar($_->fullname), translate($_->summary));
+ $_->flag_installed ?
($_->summary ?
#-PO: here format is "<package_name>: <summary> (to upgrade)"
N("%s: %s (to upgrade)", $name, $summary) :
@@ -447,12 +447,12 @@ sub ask_choice {
my $i = 0;
foreach (@l) { print " " . ++$i . "- $_\n" }
$n = message_input(N("What is your choice? (1-%d) ", $i), default => $prefer, range_min => 0, range => $i);
- defined($n) && $n ne "0" or exit 1; # abort.
- if ($n =~ /\D/) {
- my @nn = map { $choices[$_ - 1] } grep { !/\D/ } split /[, \t]+/, $n;
- @nn or exit 1;
- return @nn;
- }
+ defined($n) && $n ne "0" or exit 1; # abort.
+ if ($n =~ /\D/) {
+ my @nn = map { $choices[$_ - 1] } grep { !/\D/ } split /[, \t]+/, $n;
+ @nn or exit 1;
+ return @nn;
+ }
}
$choices[$n - 1];
}
@@ -488,16 +488,16 @@ my @unselected_uninstalled = @{$state->{unselected_uninstalled} || []};
if (@unselected_uninstalled) {
my $list = join "\n", map { $_->name . '-' . $_->version . '-' . $_->release } @unselected_uninstalled;
my $msg = @unselected_uninstalled == 1 ?
- N("The following package cannot be installed because it depends on packages
+ N("The following package cannot be installed because it depends on packages
that are older than the installed ones:\n%s", $list)
- : N("The following packages can't be installed because they depend on packages
+ : N("The following packages can't be installed because they depend on packages
that are older than the installed ones:\n%s", $list);
if ($urpm->{options}{auto}) {
- print "$msg\n";
+ print "$msg\n";
} else {
- my $noexpr = N("Nn");
- $msg .= N("\nContinue installation anyway?");
- $force || message_input($msg . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17;
+ my $noexpr = N("Nn");
+ $msg .= N("\nContinue installation anyway?");
+ $force || message_input($msg . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17;
}
# Whatever option we selected, the overall installation should fail if some packages are unselected
$urpm::postponed_msg .= $msg . "\n";
@@ -508,14 +508,14 @@ my @ask_unselect = urpm::select::unselected_packages($state);
if (@ask_unselect) {
my $list = urpm::select::translate_why_unselected($urpm, $state, @ask_unselect);
my $msg = @ask_unselect == 1 ?
- N("A requested package cannot be installed:\n%s", $list)
- : N("Some requested packages cannot be installed:\n%s", $list);
+ N("A requested package cannot be installed:\n%s", $list)
+ : N("Some requested packages cannot be installed:\n%s", $list);
if ($urpm->{options}{auto}) {
- print "$msg\n";
+ print "$msg\n";
} else {
- my $noexpr = N("Nn");
- $msg .= N("\nContinue installation anyway?");
- $force || message_input($msg . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17;
+ my $noexpr = N("Nn");
+ $msg .= N("\nContinue installation anyway?");
+ $force || message_input($msg . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17;
}
# Whatever option we selected, the overall installation should fail if some packages are unselected
$urpm::postponed_msg .= $msg . "\n";
@@ -525,34 +525,34 @@ if (@ask_unselect) {
if (my @conflicting_pkgs_msgs =
$urpm->{options}{'allow-force'} ? () : urpm::select::removed_packages_msgs($urpm, $state)) {
{
- my $db = urpm::db_open_or_die_($urpm);
- urpm::select::find_removed_from_basesystem($urpm, $db, $state, sub {
- my ($urpm, @pkgs) = @_;
- foreach (@pkgs) {
- $urpm->{error}(N("removing package %s will break your system", $_));
- }
- @pkgs and $no_remove = 1;
- });
+ my $db = urpm::db_open_or_die_($urpm);
+ urpm::select::find_removed_from_basesystem($urpm, $db, $state, sub {
+ my ($urpm, @pkgs) = @_;
+ foreach (@pkgs) {
+ $urpm->{error}(N("removing package %s will break your system", $_));
+ }
+ @pkgs and $no_remove = 1;
+ });
}
if ($no_remove && !$force) {
- my $list = join("\n", @conflicting_pkgs_msgs);
- my $msg = @conflicting_pkgs_msgs == 1 ?
- N("The installation cannot continue because the following package
+ my $list = join("\n", @conflicting_pkgs_msgs);
+ my $msg = @conflicting_pkgs_msgs == 1 ?
+ N("The installation cannot continue because the following package
has to be removed for others to be upgraded:\n%s\n", $list)
- : N("The installation cannot continue because the following packages
+ : N("The installation cannot continue because the following packages
have to be removed for others to be upgraded:\n%s\n", $list);
- print "$msg\n";
- exit 17;
+ print "$msg\n";
+ exit 17;
}
my $msg = urpm::select::conflicting_packages_msg_(\@conflicting_pkgs_msgs);
if ($test) {
- $msg = "$msg\n" . N("(test only, removal will not be actually done)");
+ $msg = "$msg\n" . N("(test only, removal will not be actually done)");
}
if ($urpm->{options}{auto}) {
- print "$msg\n";
+ print "$msg\n";
} else {
- $force || urpm::msg::ask_yes_or_no($msg) or exit 17;
+ $force || urpm::msg::ask_yes_or_no($msg) or exit 17;
}
}
@@ -564,21 +564,21 @@ my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selecte
{
my @binary = grep { $_->arch ne 'src' } @to_install;
if ($install_src) {
- if (@binary && $install_src && !$env) {
- my $list = join(' ', sort map { $_->name } @binary);
- $urpm->{fatal}(1, N("You must first call urpmi with --buildrequires to install the following dependencies:\n%s\n", $list));
- }
+ if (@binary && $install_src && !$env) {
+ my $list = join(' ', sort map { $_->name } @binary);
+ $urpm->{fatal}(1, N("You must first call urpmi with --buildrequires to install the following dependencies:\n%s\n", $list));
+ }
} else {
- @to_install = @binary;
+ @to_install = @binary;
}
}
if (@to_install && $options{auto_orphans}) {
urpm::orphans::compute_future_unrequested_orphans($urpm, $state);
if (my @orphans = map { scalar $_->fullname } @{$state->{orphans_to_remove}}) {
- print P("The following orphan package will be removed.",
- "The following orphan packages will be removed.", scalar(@orphans))
- . "\n" . urpm::orphans::add_leading_spaces(join("\n", @orphans) . "\n");
+ print P("The following orphan package will be removed.",
+ "The following orphan packages will be removed.", scalar(@orphans))
+ . "\n" . urpm::orphans::add_leading_spaces(join("\n", @orphans) . "\n");
}
}
@@ -612,9 +612,9 @@ warn_msg("--keep") if $urpm->{options}{keep};
if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env && !$options{debug__do_not_install}) {
my $msg = $urpm->{nb_install} == 1 ? N("To satisfy dependencies, the following package is going to be installed:")
- : N("To satisfy dependencies, the following packages are going to be installed:");
+ : N("To satisfy dependencies, the following packages are going to be installed:");
if ($test) {
- $msg = "$msg\n" . N("(test only, installation will not be actually done)");
+ $msg = "$msg\n" . N("(test only, installation will not be actually done)");
}
my ($size, $filesize) = $urpm->selected_size_filesize($state);
@@ -624,61 +624,61 @@ if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env && !$opt
N("%s of disk space will be freed.", formatXiB(-$size));
my $msg2_ = $filesize ? N("%s of packages will be retrieved.", formatXiB($filesize)) . "\n" : '';
my $msg3 = P("Proceed with the installation of one package?",
- "Proceed with the installation of the %d packages?",
- $urpm->{nb_install}, $urpm->{nb_install});
+ "Proceed with the installation of the %d packages?",
+ $urpm->{nb_install}, $urpm->{nb_install});
my $p = join("\n", $msg, @to_install_formatted, $msg2, $msg2_ . $msg3);
if ($env && !$options{debug__do_not_install}) {
- print "$p\n";
- exit 0; #- exit now for specific environment.
+ print "$p\n";
+ exit 0; #- exit now for specific environment.
}
my $noexpr = N("Nn");
$force || message_input($p . N(" (Y/n) "), boolean => 1) !~ /[$noexpr]/ or exit 17;
}
my $exit_code = urpm::main_loop::run($urpm, $state,
- int(@names || @src_names || @files || @src_files),
- \@ask_unselect, {
+ int(@names || @src_names || @files || @src_files),
+ \@ask_unselect, {
(!$urpm->{options}{auto} || $allow_medium_change ? (copy_removable => sub {
- my $msg = N("Please insert the medium named \"%s\"", $_[0]);
- if (eval { require Hal::Cdroms; 1 }) {
- print "$msg\n";
- Hal::Cdroms->new->wait_for_insert;
- 1;
- } else {
- my $msg2 = N("Press Enter when mounted...");
- defined message_input("$msg\n$msg2 ");
- }
+ my $msg = N("Please insert the medium named \"%s\"", $_[0]);
+ if (eval { require Hal::Cdroms; 1 }) {
+ print "$msg\n";
+ Hal::Cdroms->new->wait_for_insert;
+ 1;
+ } else {
+ my $msg2 = N("Press Enter when mounted...");
+ defined message_input("$msg\n$msg2 ");
+ }
}) : ()),
trans_log => \&urpm::download::sync_logger,
bad_signature => sub {
- my ($msg, $msg2) = @_;
- #- rurpmi always abort here
- if ($urpm->{options}{auto} || $restricted) {
- print "$msg\n";
- 0;
- } else {
- $force || urpm::msg::ask_yes_or_no("$msg$msg2");
- }
+ my ($msg, $msg2) = @_;
+ #- rurpmi always abort here
+ if ($urpm->{options}{auto} || $restricted) {
+ print "$msg\n";
+ 0;
+ } else {
+ $force || urpm::msg::ask_yes_or_no("$msg$msg2");
+ }
},
ask_yes_or_no => sub {
- my ($_title, $msg) = @_; # graphical title
- $force || urpm::msg::ask_yes_or_no($msg);
+ my ($_title, $msg) = @_; # graphical title
+ $force || urpm::msg::ask_yes_or_no($msg);
},
need_restart => sub {
- my ($need_restart_formatted) = @_;
- print "$_\n" foreach values %$need_restart_formatted;
+ my ($need_restart_formatted) = @_;
+ print "$_\n" foreach values %$need_restart_formatted;
},
message => sub {
- my ($_title, $msg) = @_; # graphical title
+ my ($_title, $msg) = @_; # graphical title
print $msg;
}
});
if ($exit_code == 0 && $auto_select && !$options{auto_orphans} && !$restart_itself) {
if (urpm::orphans::check_unrequested_orphans_after_auto_select($urpm)) {
- if (my $msg = urpm::orphans::get_now_orphans_msg($urpm)) {
- print "\n", $msg;
- }
+ if (my $msg = urpm::orphans::get_now_orphans_msg($urpm)) {
+ print "\n", $msg;
+ }
}
}
@@ -706,10 +706,10 @@ if ($restart_itself && !$exit_code) {
#- This permits to have in a same dir bug reports before and after the restart
@ARGV = @ARGVcopy;
my @arg = ($ARGV[0], map {
- $ARGV[$_] . ($ARGV[$_ - 1] eq '--bug' ? "/restarted" : "");
- } (1 .. $#ARGV));
+ $ARGV[$_] . ($ARGV[$_ - 1] eq '--bug' ? "/restarted" : "");
+ } (1 .. $#ARGV));
@arg = ('--previous-priority-upgrade=' . $urpm->{options}{'priority-upgrade'},
- grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @arg);
+ grep { !/^--no-priority-upgrade$|--previous-priority-upgrade=/ } @arg);
exec $0, @arg;
}