From 1c44e4e5600ee7b981f6b5c8a0181e5323d50dbb Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 6 Jan 2012 19:43:44 +0000 Subject: perl_checker cleanups --- urpm/download.pm | 6 +++--- urpm/dudf.pm | 2 +- urpm/get_pkgs.pm | 8 ++++---- urpm/lock.pm | 8 ++++---- urpm/media.pm | 6 +++--- urpm/select.pm | 2 +- urpm/xml_info_pkg.pm | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/urpm/download.pm b/urpm/download.pm index bfe4139b..54aa963f 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -801,7 +801,7 @@ eval { }; sub progress_text { - my ($mode, $file, $percent, $total, $eta, $speed) = @_; + my ($mode, $_file, $percent, $total, $eta, $speed) = @_; $mode eq 'progress' ? (defined $total && defined $eta ? N(" %s%% of %s completed, ETA = %s, speed = %s", $percent, $total, $eta, $speed) : @@ -810,7 +810,7 @@ sub progress_text { #- default logger suitable for sync operation on STDERR only. sub sync_logger { - my ($mode, $file, $percent, $total, $eta, $speed) = @_; + my ($mode, $file, $percent, $_total, $_eta, $_speed) = @_; if ($mode eq 'start') { print STDERR " $file\n"; } elsif ($mode eq 'progress') { @@ -863,7 +863,7 @@ sub _all_options { dir => "$urpm->{cachedir}/partial", proxy => get_proxy_($urpm, $medium), metalink => $medium->{mirrorlist}, - $medium->{"disable-certificate-check"}?"no-certificate-check":(), + $medium->{"disable-certificate-check"} ? "no-certificate-check" : (), $urpm->{debug} ? (debug => $urpm->{debug}) : (), %$options, ); diff --git a/urpm/dudf.pm b/urpm/dudf.pm index 7057f98e..40c6633a 100644 --- a/urpm/dudf.pm +++ b/urpm/dudf.pm @@ -204,7 +204,7 @@ sub new { } sub set_error_msg { - my ($self,$m) = @_; + my ($self, $m) = @_; $self->{exit_msg} .= $m; } diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index 8e564c78..e0c375b8 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -140,7 +140,7 @@ sub _create_old_list_from_blists { my $medium = $_; my ($blist) = grep { $_->{medium} == $medium } @$blists; - { map { $_ => urpm::blist_pkg_to_url($blist, $blist->{pkgs}{$_}) } keys %{$blist->{pkgs}} }; + { map { $_ => urpm::blist_pkg_to_url($blist, $blist->{pkgs}{$_}) } keys %{$blist->{pkgs}} } } @$media ]; } @@ -224,8 +224,8 @@ sub download_packages_of_distant_media { if (%{$blist_distant{pkgs}}) { my ($remote_sources, $remote_errors) = _download_packages_of_distant_media($urpm, \%blist_distant, %options); - put_in_hash (\%new_sources, $remote_sources); - put_in_hash (\%errors, $remote_errors); + put_in_hash(\%new_sources, $remote_sources); + put_in_hash(\%errors, $remote_errors); } } @@ -280,7 +280,7 @@ sub _download_packages_of_distant_media { $errors{$id} = [ $url, 'missing' ]; } } - (\%sources, \%errors) + (\%sources, \%errors); } 1; diff --git a/urpm/lock.pm b/urpm/lock.pm index fc8cc5f4..bcc02627 100644 --- a/urpm/lock.pm +++ b/urpm/lock.pm @@ -52,14 +52,14 @@ sub new { sub get_lock_pid { my ($fh) = @_; - my ($dev,$ino,undef) = stat($fh); + my ($dev, $ino, undef) = stat($fh); my $major = int($dev/256); my $minor = $dev % 256; my $fileid = sprintf("%02x:%02x:%d",$major,$minor,$ino); open(LOCKS, "/proc/locks") || return; my @locks = ; close(LOCKS); - foreach (@locks) { /FLOCK.*WRITE\s*(\d+)\s*$fileid\s/ && return $1 }; + foreach (@locks) { /FLOCK.*WRITE\s*(\d+)\s*$fileid\s/ && return $1 } } sub _lock { @@ -76,11 +76,11 @@ sub _lock { flock($lock->{fh}, $mode) or $lock->{fatal}(N("aborting")); } else { my $pid = get_lock_pid($lock->{fh}); - if($pid) { + if ($pid) { my $name = urpm::util::cat_("/proc/$pid/cmdline"); $name =~ tr/\0/ /; $name =~ s/ *$//; - $lock->{fatal}(N("%s database is locked, process %d is already using it", $lock->{db_name}, $pid).($name?" ($name)":"")); + $lock->{fatal}(N("%s database is locked, process %d is already using it", $lock->{db_name}, $pid) . ($name ? " ($name)" : "")); } else { $lock->{fatal}(N("%s database is locked (another program is already using it)", $lock->{db_name})); } diff --git a/urpm/media.pm b/urpm/media.pm index d475c7b5..6195e2df 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -793,13 +793,13 @@ sub find_zeroconf_repository { my $path_suffix = join('/', lc($product_id->{branch}), $product_id->{version}, $product_id->{arch}); foreach my $entry ($res->entries) { - my $base_url = $entry->attribute('protocol') . '://' .$entry->address . ':' . $entry->port . $entry->attribute('path'); + my $base_url = $entry->attribute('protocol') . '://' . $entry->address . ':' . $entry->port . $entry->attribute('path'); my $url = $base_url . '/' . $path_suffix; my $distribconf = _new_distribconf_and_download($urpm, { url => $url }); if ($distribconf) { $urpm->{log}(sprintf("found zeroconf repository: %s", $url)); return $url; - }; + } } $urpm->{debug} and $urpm->{debug}("unable to find zeroconf repository"); @@ -896,7 +896,7 @@ sub _register_media_cfg { my $version = $distribconf->getvalue('media_info', 'version') || ''; #official mirrors define $branch but not $product, other RPM repos do the #opposite :-/ - my $media_dir = (($branch or $product) . '-' . $version . '-' . $arch); + my $media_dir = (($branch || $product) . '-' . $version . '-' . $arch); $media_dir =~ tr!/!-!; my $media_path = $urpm->{mediacfgdir} . '/' . $media_dir; require File::Path; diff --git a/urpm/select.pm b/urpm/select.pm index c757dd7e..11e36e56 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -605,7 +605,7 @@ sub rejected_unsatisfied { } sub conflicting_packages_msg_ { - my ($urpm, $state, $removed_packages_msgs) = @_; + my ($_urpm, $_state, $removed_packages_msgs) = @_; my $list = join("\n", @$removed_packages_msgs) or return; @$removed_packages_msgs == 1 ? diff --git a/urpm/xml_info_pkg.pm b/urpm/xml_info_pkg.pm index a8004987..94e96d07 100644 --- a/urpm/xml_info_pkg.pm +++ b/urpm/xml_info_pkg.pm @@ -41,7 +41,7 @@ sub version { exists $_[0]{pkg} ? $_[0]{pkg}->version : $_[0]{fn} =~ $fullname sub release { exists $_[0]{pkg} ? $_[0]{pkg}->release : $_[0]{fn} =~ $fullname_re && $3 } sub arch { exists $_[0]{pkg} ? $_[0]{pkg}->arch : $_[0]{fn} =~ $fullname_re && $4 } -sub fullname { wantarray ? $_[0]{pkg}->fullname : $_[0]{fn} } +sub fullname { wantarray() ? $_[0]{pkg}->fullname : $_[0]{fn} } sub filename { $_[0]{fn} . '.rpm' } -- cgit v1.2.1