summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-03 13:34:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-03 13:34:29 +0000
commit91d1d5e40d3ba242573012a093e8b5cc1e7c5bc4 (patch)
tree4414c5721935b629d82eca700270194e71de0f46
parentc00ac473861f824abb28efd94645276893868bb6 (diff)
downloadurpmi-91d1d5e40d3ba242573012a093e8b5cc1e7c5bc4.tar
urpmi-91d1d5e40d3ba242573012a093e8b5cc1e7c5bc4.tar.gz
urpmi-91d1d5e40d3ba242573012a093e8b5cc1e7c5bc4.tar.bz2
urpmi-91d1d5e40d3ba242573012a093e8b5cc1e7c5bc4.tar.xz
urpmi-91d1d5e40d3ba242573012a093e8b5cc1e7c5bc4.zip
perl_checker compliance
-rw-r--r--urpm.pm61
-rw-r--r--urpm/args.pm10
-rw-r--r--urpm/cfg.pm6
-rw-r--r--urpm/download.pm6
-rw-r--r--urpm/ldap.pm2
-rw-r--r--urpm/msg.pm18
-rw-r--r--urpm/prompt.pm2
-rw-r--r--urpm/sys.pm8
-rw-r--r--urpm/util.pm2
-rwxr-xr-xurpmi42
10 files changed, 80 insertions, 77 deletions
diff --git a/urpm.pm b/urpm.pm
index 60d62dca..6c7327ed 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -72,14 +72,14 @@ sub sync_webfetch {
$urpm->{fatal}(10, $@) if $@;
delete @files{qw(removable file)};
}
- for my $cpt (qw(wget-options curl-options rsync-options prozilla-options)) {
+ foreach my $cpt (qw(wget-options curl-options rsync-options prozilla-options)) {
$options->{$cpt} = $urpm->{options}{$cpt} if defined $urpm->{options}{$cpt};
}
if ($files{ftp} || $files{http} || $files{https}) {
my @webfetch = qw(curl wget prozilla);
my %webfetch_executables = (curl => 'curl', wget => 'wget', prozilla => 'proz');
my @available_webfetch = grep {
- -x "/usr/bin/$webfetch_executables{$_}" || -x "/bin/$webfetch_executables{$_}"
+ -x "/usr/bin/$webfetch_executables{$_}" || -x "/bin/$webfetch_executables{$_}";
} @webfetch;
#- use user default downloader if provided and available
my $option_downloader = $urpm->{options}{downloader}; #- cmd-line switch
@@ -780,13 +780,13 @@ sub add_distrib_media {
if (my ($dir) = $url =~ m!^(?:removable[^:]*:/|file:/)?(/.*)!) {
$urpm->try_mounting($dir)
or $urpm->{error}(N("unable to mount the distribution medium")), return ();
- $distribconf = MDV::Distribconf->new($dir);
- $distribconf->load()
+ $distribconf = MDV::Distribconf->new($dir, undef);
+ $distribconf->load
or $urpm->{error}(N("this location doesn't seem to contain any distribution")), return ();
} else {
unlink "$urpm->{cachedir}/partial/media.cfg";
- $distribconf = MDV::Distribconf->new($url);
+ $distribconf = MDV::Distribconf->new($url, undef);
$distribconf->settree('mandriva');
eval {
@@ -800,7 +800,7 @@ sub add_distrib_media {
retry => $urpm->{options}{retry},
proxy => get_proxy(),
},
- reduce_pathname($distribconf->getfullpath(undef, 'infodir') .'/media.cfg'),
+ reduce_pathname($distribconf->getfullpath(undef, 'infodir') . '/media.cfg'),
);
$urpm->{log}(N("...retrieving done"));
};
@@ -823,7 +823,7 @@ sub add_distrib_media {
my $medium = $options{initial_number} || 1;
my @media_list_toadd;
- foreach my $media ($distribconf->listmedia()) {
+ foreach my $media ($distribconf->listmedia) {
my $skip = 0;
# if one of those values is set, by default, we skip adding the media
foreach (qw(noauto)) {
@@ -852,8 +852,8 @@ sub add_distrib_media {
reduce_pathname($distribconf->getfullpath($media, 'path')),
offset_pathname(
$url,
- $distribconf->getpath($media, 'path')
- ) . '/' . $distribconf->getpath( $media, ($options{probe_with} eq 'synthesis' ? 'synthesis' : 'hdlist') ),
+ $distribconf->getpath($media, 'path'),
+ ) . '/' . $distribconf->getpath($media, $options{probe_with} eq 'synthesis' ? 'synthesis' : 'hdlist'),
index_name => $name ? undef : 0,
no_reload_config => 1, #- no need to reload config each time, since we don't update the media
%options,
@@ -1456,7 +1456,7 @@ this could happen if you mounted manually the directory when creating the medium
#- failed, but the file still remains in partial/ because it was
#- moved from $urpm->{statedir} earlier. So we need to check if
#- the previous download failed.
- if ($@ || (! -e "$urpm->{cachedir}/partial/descriptions")) {
+ if ($@ || ! -e "$urpm->{cachedir}/partial/descriptions") {
eval {
#- try older location
$urpm->{sync}($syncopts, reduce_pathname("$medium->{url}/../descriptions"));
@@ -1835,7 +1835,7 @@ this could happen if you mounted manually the directory when creating the medium
my %key_ids;
$urpm->import_needed_pubkeys([ $urpm->parse_armored_file("$urpm->{cachedir}/partial/pubkey") ],
root => $urpm->{root}, callback => sub {
- my (undef, undef, $k, $id, $imported) = @_;
+ my (undef, undef, $_k, $id, $imported) = @_;
if ($id) {
$key_ids{$id} = undef;
$imported and $urpm->{log}(N("...imported key %s from pubkey file of \"%s\"",
@@ -2060,7 +2060,7 @@ sub try_mounting {
#- to mount an iso image, grab the first loop device
my $loopdev = urpm::sys::first_free_loopdev();
sys_log("mount iso $_ on $removable");
- $loopdev and system("mount '$removable' '$_' -t iso9660 -o loop=$loopdev");
+ $loopdev and system('mount', $removable, $_, '-t', 'iso9660', '-o', "loop=$loopdev");
} else {
sys_log("mount $_");
system("mount '$_' 2>/dev/null");
@@ -2107,7 +2107,7 @@ sub register_rpms {
/\.(?:rpm|spec)$/ or $error = 1, $urpm->{error}(N("invalid rpm file name [%s]", $_)), next;
#- if that's an URL, download.
- if (my ($basename) = m{^[^:]*:/.*/([^/]*\.(?:rpm|spec))\z}) {
+ if (my ($basename) = m!^[^:]*:/.*/([^/]*\.(?:rpm|spec))\z!) {
unlink "$urpm->{cachedir}/partial/$basename";
eval {
$urpm->{log}(N("retrieving rpm file [%s] ...", $_));
@@ -2144,7 +2144,7 @@ sub register_rpms {
($id) = $urpm->parse_rpm($_);
my $pkg = defined $id && $urpm->{depslist}[$id];
$pkg or $error = 1, $urpm->{error}(N("unable to register rpm file")), next;
- $pkg->arch eq 'src' || $pkg->is_arch_compat()
+ $pkg->arch eq 'src' || $pkg->is_arch_compat
or $error = 1, $urpm->{error}(N("Incompatible architecture for rpm [%s]", $_)), next;
$urpm->{source}{$id} = $_;
}
@@ -2153,7 +2153,7 @@ sub register_rpms {
defined $id && $start <= $id and @requested{($start .. $id)} = (1) x ($id-$start+1);
#- distribute local packages to distant nodes directly in cache of each machine.
- @files && $urpm->{parallel_handler} and $urpm->{parallel_handler}->parallel_register_rpms(@_);
+ @files && $urpm->{parallel_handler} and $urpm->{parallel_handler}->parallel_register_rpms($urpm, @files);
%requested;
}
@@ -2209,7 +2209,7 @@ sub search_packages {
#- search through provides to find if a provide matches this one;
#- but manage choices correctly (as a provides may be virtual or
#- defined several times).
- if (/$qv/ || (!$options{caseinsensitive} && /$qv/i)) {
+ if (/$qv/ || !$options{caseinsensitive} && /$qv/i) {
$urpm->_findindeps(\%found, $v, %options);
}
}
@@ -2322,7 +2322,7 @@ sub resolve_dependencies {
system "cat '$urpm->{statedir}/synthesis.$_->{hdlist}' >> '$file'";
}
#- let each node determine what is requested, according to handler given.
- $urpm->{parallel_handler}->parallel_resolve_dependencies($file, @_);
+ $urpm->{parallel_handler}->parallel_resolve_dependencies($file, $urpm, $state, $requested, %options);
} else {
my $db;
@@ -2407,10 +2407,10 @@ sub create_transaction {
#- get the list of packages that should not be upgraded or installed,
#- typically from the inst.list or skip.list files.
sub get_packages_list {
- my ($file, $extra) = @_;
+ my ($file, $o_extra) = @_;
my $val = [];
open my $f, $file or return [];
- foreach (<$f>, split /,/, $extra || '') {
+ foreach (<$f>, split /,/, $o_extra || '') {
chomp; s/#.*$//; s/^\s*//; s/\s*$//;
next if $_ eq '';
push @$val, $_;
@@ -2562,7 +2562,7 @@ sub get_source_packages {
#- examine package list to see if a package has not been found.
foreach (grep { ! exists($examined{$_}) } keys %fullname2id) {
# print list errors only once if any
- @list_error and map { $urpm->{error}($_) } @list_error;
+ $urpm->{error}($_) foreach @list_error;
@list_error = ();
$error = 1;
$urpm->{error}(N("package %s is not found.", $_));
@@ -2634,7 +2634,7 @@ sub shlock_rpm_db {
}
sub unlock_rpm_db {
- my ($urpm) = @_;
+ my ($_urpm) = @_;
#- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
my $LOCK_UN = 8;
#- now everything is finished.
@@ -2667,7 +2667,7 @@ sub shlock_urpmi_db {
}
sub unlock_urpmi_db {
- my ($urpm) = @_;
+ my ($_urpm) = @_;
#- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
my $LOCK_UN = 8;
#- now everything is finished.
@@ -3036,7 +3036,7 @@ sub install {
#- assume default value for some parameter.
$options{delta} ||= 1000;
$options{callback_open} ||= sub {
- my ($data, $type, $id) = @_;
+ my ($_data, $_type, $id) = @_;
$fh = $urpm->open_safe('<', $install->{$id} || $upgrade->{$id});
return defined $fh ? fileno $fh : undef;
};
@@ -3046,7 +3046,7 @@ sub install {
my $pkg = $urpm->{depslist}[$pkgid];
my $fullname = $pkg->fullname;
my $trtype = (grep { /\Q$fullname\E/ } values %$install) ? 'install' : '(upgrade|update)';
- for ($pkg->files) { /\bREADME(\.$trtype)?\.urpmi$/ and $readmes{$_} = $fullname }
+ foreach ($pkg->files) { /\bREADME(\.$trtype)?\.urpmi$/ and $readmes{$_} = $fullname }
close $fh if defined $fh;
};
if ($::verbose >= 0 && (scalar keys %$install || scalar keys %$upgrade)) {
@@ -3090,8 +3090,9 @@ sub install {
#- install all files to node as remembered according to resolving done.
sub parallel_install {
- my ($urpm, $remove, $install, $upgrade, %options) = @_;
- $urpm->{parallel_handler}->parallel_install(@_);
+ my @para = @_;
+ my ($urpm, $_remove, $_install, $_upgrade, %_options) = @para;
+ $urpm->{parallel_handler}->parallel_install(@para);
}
#- find packages to remove.
@@ -3169,7 +3170,7 @@ sub find_packages_to_remove {
push @notfound, $_;
}
if (!$options{force} && @notfound && @$l > 1) {
- $options{callback_notfound} and $options{callback_notfound}->($urpm, @notfound)
+ $options{callback_notfound} && $options{callback_notfound}->($urpm, @notfound)
or return ();
}
}
@@ -3192,10 +3193,10 @@ sub find_packages_to_remove {
if (!$options{force} && @notfound) {
if (@m) {
- $options{callback_fuzzy} and $options{callback_fuzzy}->($urpm, @$l > 1 ? $match : $l->[0], @m)
+ $options{callback_fuzzy} && $options{callback_fuzzy}->($urpm, @$l > 1 ? $match : $l->[0], @m)
or return ();
} else {
- $options{callback_notfound} and $options{callback_notfound}->($urpm, @notfound)
+ $options{callback_notfound} && $options{callback_notfound}->($urpm, @notfound)
or return ();
}
}
@@ -3262,7 +3263,7 @@ sub translate_why_unselected {
#- XXX in theory we shouldn't need this, dependencies (and not ids) should
#- already be present in @unsatisfied. But with biarch packages this is
#- not always the case.
- /\D/ ? $_ : scalar($urpm->{depslist}[$_]->fullname)
+ /\D/ ? $_ : scalar($urpm->{depslist}[$_]->fullname);
} @unsatisfied),
$rb->{promote} && !$rb->{keep} ? N("trying to promote %s", join(", ", @{$rb->{promote}})) : @{[]},
$rb->{keep} ? N("in order to keep %s", join(", ", @{$rb->{keep}})) : @{[]},
diff --git a/urpm/args.pm b/urpm/args.pm
index 4c24a803..c81942d3 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -9,7 +9,7 @@ use Getopt::Long;# 2.33;
use urpm::download;
use urpm::msg;
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
# The program that invokes us
(my $tool = $0) =~ s!.*/!!;
@@ -38,7 +38,7 @@ sub import {
# used by urpmf
sub add_param_closure {
my (@tags) = @_;
- return sub { $::qf .= join $::separator, '', map "%$_", @tags };
+ return sub { $::qf .= join $::separator, '', map { "%$_" } @tags };
}
# options specifications for Getopt::Long
@@ -305,7 +305,7 @@ my %options_spec = (
'force-key' => \$options{forcekey},
'limit-rate=s' => \$options{limit_rate},
'no-md5sum' => \$options{nomd5sum},
- 'noa|d' => \my $dummy, #- default, kept for compatibility
+ 'noa|d' => \my $_dummy, #- default, kept for compatibility
'q|quiet' => sub { --$options{verbose} },
'v|verbose' => sub { ++$options{verbose} },
'norebuild!' => sub { $urpm->{options}{norebuild} = $_[1]; $options{force} = 0 },
@@ -414,7 +414,7 @@ foreach my $k ("help|h", "version") {
sub parse_cmdline {
my %args = @_;
$urpm = $args{urpm};
- for my $k (keys %{$args{defaults} || {}}) {
+ foreach my $k (keys %{$args{defaults} || {}}) {
$options{$k} = $args{defaults}{$k};
}
my $ret = GetOptions(%{$options_spec{$tool}});
@@ -433,7 +433,7 @@ sub parse_cmdline {
die N("Too many arguments\n");
}
}
- $ret
+ $ret;
}
1;
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index f39679e1..30d9cc8b 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -7,7 +7,7 @@ use warnings;
use urpm::util;
use urpm::msg 'N';
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
=head1 NAME
@@ -104,7 +104,7 @@ sub expand_line {
}
sub load_config ($;$) {
- my ($file, $norewrite) = @_;
+ my ($file, $b_norewrite) = @_;
my %config;
my $priority = 0;
my $medium;
@@ -115,7 +115,7 @@ sub load_config ($;$) {
chomp;
next if /^\s*#/; #- comments
s/^\s+//; s/\s+$//;
- $_ = expand_line($_) unless $norewrite;
+ $_ = expand_line($_) unless $b_norewrite;
if ($_ eq '}') { #-{
if (!defined $medium) {
_syntax_error();
diff --git a/urpm/download.pm b/urpm/download.pm
index 0363f683..1eba2504 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -7,7 +7,7 @@ use urpm::msg;
use urpm::cfg;
use Cwd;
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
#- proxy config file.
our $PROXY_CFG = '/etc/urpmi/proxy.cfg';
@@ -480,7 +480,7 @@ sub sync_rsync {
}
our $SSH_PATH;
-sub _init_ssh_path {
+sub _init_ssh_path() {
for (qw(/usr/bin/ssh /bin/ssh)) {
-x $_ and $SSH_PATH = $_;
next;
@@ -557,7 +557,7 @@ END {
for my $socket (glob "$SSH_CONTROL_DIR/ssh-urpmi-$$-*") {
$socket =~ /ssh-urpmi-\d+-([^_]+)_\d+_(.*)$/;
my $server = $1 or next;
- my $login = $2 or next;
+ my $_login = $2 or next;
system("$SSH_PATH -q -f -N -o 'ControlPath $socket' -O exit $2\@$server");
}
}
diff --git a/urpm/ldap.pm b/urpm/ldap.pm
index e734c883..b65fc0c2 100644
--- a/urpm/ldap.pm
+++ b/urpm/ldap.pm
@@ -8,7 +8,7 @@ use urpm;
use urpm::msg 'N';
use Net::LDAP;
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
our $LDAP_CONFIG_FILE = '/etc/ldap.conf';
my @per_media_opt = (@urpm::PER_MEDIA_OPT, qw(ftp-proxy http-proxy));
diff --git a/urpm/msg.pm b/urpm/msg.pm
index e3986abe..2944f85c 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -6,7 +6,7 @@ use strict;
no warnings;
use Exporter;
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
our @ISA = 'Exporter';
our @EXPORT = qw(N bug_log to_utf8 message_input toMb from_utf8 sys_log);
@@ -33,7 +33,7 @@ sub from_utf8_dummy { $_[0] }
our $use_utf8_full = defined $codeset && $codeset eq 'UTF-8';
-*from_utf8 = $use_utf8_full ? *from_utf8_full : *from_utf8_dummy;
+sub from_utf8 { $use_utf8_full ? &from_utf8_full : &from_utf8_dummy }
sub N {
my ($format, @params) = @_;
@@ -71,23 +71,23 @@ sub bug_log {
sub to_utf8 { Locale::gettext::iconv($_[0], undef, "UTF-8") }
sub message_input {
- my ($msg, $default_input, %opts) = @_;
+ my ($msg, $o_default_input, %o_opts) = @_;
my $input;
while (1) {
print $msg;
- if ($default_input) {
- $urpm::args::options{bug} and bug_log($default_input);
- return $default_input;
+ if ($o_default_input) {
+ $urpm::args::options{bug} and bug_log($o_default_input);
+ return $o_default_input;
}
$input = <STDIN>;
defined $input or return undef;
chomp $input;
$urpm::args::options{bug} and bug_log($input);
- if ($opts{boolean}) {
+ if ($o_opts{boolean}) {
$input =~ /^[$noexpr$yesexpr]?$/ and last;
- } elsif ($opts{range}) {
+ } elsif ($o_opts{range}) {
$input eq "" and $input = 1; #- defaults to first choice
- (defined $opts{range_min} ? $opts{range_min} : 1) <= $input && $input <= $opts{range} and last;
+ (defined $o_opts{range_min} ? $o_opts{range_min} : 1) <= $input && $input <= $o_opts{range} and last;
} else {
last;
}
diff --git a/urpm/prompt.pm b/urpm/prompt.pm
index 6d7147d0..ec34db10 100644
--- a/urpm/prompt.pm
+++ b/urpm/prompt.pm
@@ -4,7 +4,7 @@ package urpm::prompt;
use strict;
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
sub new {
my ($class, $title, $prompts, $defaults, $hidden) = @_;
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 0b191265..9defc2f5 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -6,7 +6,7 @@ use strict;
use warnings;
use POSIX ();
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
#- find used mount point from a pathname, use a optional mode to allow
#- filtering according the next operation (mount or umount).
@@ -110,7 +110,7 @@ sub first_free_loopdev () {
sub trim_until_d {
my ($dir) = @_;
open my $mounts, '/proc/mounts' or do { warn "Can't read /proc/mounts: $!\n"; return $dir };
- local *_;
+ local $_;
while (<$mounts>) {
#- fail if an iso is already mounted
m!^/dev/loop! and return $dir;
@@ -171,14 +171,14 @@ sub mktempdir {
}
# temporary hack used by urpmi when restarting itself.
-sub fix_fd_leak {
+sub fix_fd_leak() {
opendir my $dirh, "/proc/$$/fd" or return undef;
my @fds = grep { /^(\d+)$/ && $1 > 2 } readdir $dirh;
closedir $dirh;
for (@fds) {
my $link = readlink("/proc/$$/fd/$_");
$link or next;
- next if $link =~ m(^/(usr|dev)/) || $link !~ m(^/);
+ next if $link =~ m!^/(usr|dev)/! || $link !~ m!^/!;
POSIX::close($_);
}
}
diff --git a/urpm/util.pm b/urpm/util.pm
index d112005a..fafc5c2e 100644
--- a/urpm/util.pm
+++ b/urpm/util.pm
@@ -12,7 +12,7 @@ our @EXPORT = qw(quotespace unquotespace
difference2
);
-(our $VERSION) = q$Revision$ =~ /(\d+)/;
+(our $VERSION) = q($Revision$) =~ /(\d+)/;
#- quoting/unquoting a string that may be containing space chars.
sub quotespace { my $x = $_[0] || ''; $x =~ s/(\s)/\\$1/g; $x }
diff --git a/urpmi b/urpmi
index 5aba76fb..2ffc7152 100755
--- a/urpmi
+++ b/urpmi
@@ -273,19 +273,20 @@ unless ($bug || $env || $test) {
my ($pid_out, $pid_err);
if ($logfile && !$INC{"Devel/Trace.pm"}) {
- bug_log(scalar localtime, " urpmi called with $command_line\n");
+ bug_log(scalar localtime(), " urpmi called with $command_line\n");
- open SAVEOUT, ">&STDOUT"; select SAVEOUT; $| = 1;
- open SAVEERR, ">&STDERR"; select SAVEERR; $| = 1;
+ open(my $SAVEOUT, ">&STDOUT"); select $SAVEOUT; $| = 1;
+ open(my $SAVEERR, ">&STDERR"); select $SAVEERR; $| = 1;
#- fork twice to copy stdout and stderr to $logfile
unless ($pid_out = open STDOUT, "|-") {
my $buf_r;
+ local $_;
while (<STDIN>) {
open my $fh, ">>$logfile"; select $fh; $| = 1;
- select SAVEOUT; $| = 1;
+ select $SAVEOUT; $| = 1;
$/ = \1;
- print SAVEOUT $_;
+ print $SAVEOUT $_;
print $fh $_;
close $fh;
}
@@ -293,11 +294,12 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
}
unless ($pid_err = open STDERR, "|-") {
my $buf_r;
+ local $_;
while (<STDIN>) {
open my $fh, ">>$logfile"; select $fh; $| = 1;
- select SAVEERR; $| = 1;
+ select $SAVEERR; $| = 1;
$/ = \1;
- print SAVEERR $_;
+ print $SAVEERR $_;
print $fh $_;
close $fh;
}
@@ -306,9 +308,9 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
#- 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] };
}
}
@@ -328,7 +330,7 @@ if (exists $urpm->{options}{'priority-upgrade'} && $urpm->{options}{'priority-up
require urpm::sys;
urpm::sys::fix_fd_leak();
# also, clean up rpm db log files, because rpm might have been upgraded
- unlink </var/lib/rpm/__db.00?> unless $root;
+ unlink glob('/var/lib/rpm/__db.00?') unless $root;
}
unless ($env || $nolock) {
@@ -361,7 +363,7 @@ if ($auto_update && !$bug && !$env) {
#- FIXME we need to configure it twice; otherwise
#- some settings are lost (like the skiplist) for
#- some reason.
- $urpm->configure( %config_hash );
+ $urpm->configure(%config_hash);
$urpm->update_media(
all => 1,
callback => \&urpm::download::sync_logger,
@@ -378,7 +380,7 @@ if ($auto_update && !$bug && !$env) {
}
}
-$urpm->configure( %config_hash );
+$urpm->configure(%config_hash);
#- get back activated default values of boolean options.
exists $urpm->{options}{'split-level'} or $urpm->{options}{'split-level'} = $split_level;
@@ -434,7 +436,7 @@ if (@src_names) {
}
sub ask_choice {
- my ($urpm, $db, $state, $choices) = @_;
+ my ($urpm, $_db, $_state, $choices) = @_;
my $n = 1; #- default value.
my (@l) = map {
(scalar $_->fullname)
@@ -653,7 +655,7 @@ foreach my $set (@{$state->{transaction} || []}) {
compress => $urpm->{options}{compress},
resume => $urpm->{options}{resume},
callback => sub {
- my ($mode, $file, $percent, $total, $eta, $speed) = @_;
+# my ($mode, $file, $percent, $total, $eta, $speed) = @_;
goto &urpm::download::sync_logger;
},
);
@@ -720,16 +722,16 @@ foreach my $set (@{$state->{transaction} || []}) {
excludepath => $urpm->{options}{excludepath}, excludedocs => $urpm->{options}{excludedocs});
} else {
my @packnames = (values %transaction_sources_install, values %transaction_sources);
- (my $common_prefix) = $packnames[0] =~ /^(.*)\//;
- if (length($common_prefix) && @packnames == grep { /^\Q$common_prefix\// } @packnames) {
+ (my $common_prefix) = $packnames[0] =~ m!^(.*)/!;
+ if (length($common_prefix) && @packnames == grep { m!^\Q$common_prefix/! } @packnames) {
#- there's a common prefix, simplify message
- print N("installing %s from %s", join(' ', map { s/.*\///; $_ } @packnames), $common_prefix), "\n";
+ print N("installing %s from %s", join(' ', map { s!.*/!!; $_ } @packnames), $common_prefix), "\n";
} else {
print N("installing %s", join "\n", @packnames), "\n";
}
- my $to_remove = $urpm->{options}{'allow-force'} ? [] : ($set->{remove} || []);
+ my $to_remove = $urpm->{options}{'allow-force'} ? [] : $set->{remove} || [];
@$to_remove and print N("removing %s", "@$to_remove"), "\n";
- bug_log(scalar localtime, " ", join(' ', values %transaction_sources_install, values %transaction_sources), "\n");
+ bug_log(scalar localtime(), " ", join(' ', values %transaction_sources_install, values %transaction_sources), "\n");
$urpm->{log}("starting installing packages");
my %install_options_common = (
test => $test,