aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2006-05-16 11:38:23 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2006-05-16 11:38:23 +0000
commitd821903f8b55b56df3b839af9a06597a5392942a (patch)
treeddd11ecf2a897157af7b3396188acf0fc45b38d2
parente525675a9314337390d8c11536b775ce519b64f6 (diff)
downloadrpmdrake-d821903f8b55b56df3b839af9a06597a5392942a.tar
rpmdrake-d821903f8b55b56df3b839af9a06597a5392942a.tar.gz
rpmdrake-d821903f8b55b56df3b839af9a06597a5392942a.tar.bz2
rpmdrake-d821903f8b55b56df3b839af9a06597a5392942a.tar.xz
rpmdrake-d821903f8b55b56df3b839af9a06597a5392942a.zip
some perl_checker cleanups
-rwxr-xr-xrpmdrake27
-rw-r--r--rpmdrake.pm18
2 files changed, 23 insertions, 22 deletions
diff --git a/rpmdrake b/rpmdrake
index 3476300f..23991f89 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -131,7 +131,7 @@ sub progress {
$mainw->flush;
}
-sub end {
+sub end() {
$mainw and $mainw->destroy;
$mainw = undef;
$cancel = undef; #- in case we'll do another one later
@@ -152,11 +152,11 @@ sub validate_cancel {
$cancel->show;
}
-sub invalidate_cancel {
+sub invalidate_cancel() {
$cancel and $cancel->set_sensitive(0);
}
-sub invalidate_cancel_forever {
+sub invalidate_cancel_forever() {
$hbox_cancel or return;
$hbox_cancel->destroy;
$mainw->shrink_topwindow;
@@ -328,7 +328,7 @@ sub urpm_name {
"$name-$version-$release.$arch";
}
-sub parse_compssUsers_flat {
+sub parse_compssUsers_flat() {
my (%compssUsers, $category);
my $compss = '/var/lib/urpmi/compssUsers.flat';
-r $compss or $compss = '/usr/share/rpmdrake/compssUsers.flat.default';
@@ -383,7 +383,7 @@ sub extract_header {
} else {
my ($p, $medium) = ($pkg->{pkg}, pkg2medium($pkg->{pkg}, $urpm));
my $hdlist = $medium->{virtual} ? "$medium->{url}/$medium->{with_hdlist}" : "$urpm->{statedir}/$medium->{hdlist}";
- $hdlist =~ s/^file:\/+//;
+ $hdlist =~ s!^file:/+!!;
if (-r $hdlist) {
my $packer;
# TODO use more modern API
@@ -452,7 +452,7 @@ sub do_search($$$$$$$) {
$w->{rwindow},
sub {
db->traverse(sub {
- push @search_results, map { if_(($_ =~ $entry_rx), my_fullname($_[0])) } $_[0]->files;
+ push @search_results, map { if_($_ =~ $entry_rx, my_fullname($_[0])) } $_[0]->files;
});
@search_results = grep { exists $pkgs->{$_} } uniq(@search_results);
},
@@ -461,7 +461,7 @@ sub do_search($$$$$$$) {
} else {
my @hdlists = map {
my $h = $_->{virtual} ? "$_->{url}/$_->{with_hdlist}" : "$urpm->{statedir}/$_->{hdlist}";
- $h =~ s/^file:\/+//;
+ $h =~ s!^file:/+!!;
if_(!$_->{ignore} && ($MODE ne 'update' || $_->{update}) && -r $h, $h);
} @{$urpm->{media}};
my $total_size = sum(
@@ -490,6 +490,7 @@ sub do_search($$$$$$$) {
$searchw->sync;
open my $sf, 'parsehdlist --fileswinfo --description --summary ' . join(' ', map { "'$_'" } @hdlists) . ' |';
my ($pkg, $progresscount);
+ local $_;
while (<$sf>) {
$searchstop and last;
if (/^NAME<([^>]+)> VERSION<([^>]+)> RELEASE<([^>]+)>/) {
@@ -713,7 +714,7 @@ or you already installed all of them."));
@nodes = grep { exists $pkgs->{$_} } @nodes
or return;
#- avoid selecting too many packages at once
- return if !$dont_show_selections && (($MODE ne 'update' && @nodes == keys %$pkgs) || @nodes > 2000);
+ return if !$dont_show_selections && ($MODE ne 'update' && @nodes == keys %$pkgs || @nodes > 2000);
my $new_state = !$pkgs->{$nodes[0]}{selected};
my @nodes_with_deps;
@@ -1199,7 +1200,7 @@ Is it ok to continue?",
gtkpack_(
Gtk2::VBox->new(0, 3),
0, $menu,
- 0, getbanner,
+ 0, getbanner(),
1, gtkadd(
gtkset_shadow_type(gtkset_border_width(Gtk2::Frame->new, 3), 'none'),
gtkpack_(
@@ -1663,7 +1664,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-(
translate_message => 1,
post_clean_cache => 1,
callback_open => sub {
- my ($data, $type, $id) = @_;
+ my ($_data, $_type, $id) = @_;
my $f = $sources_install{$id} || $sources{$id};
open $fh, $f or $urpm->{error}(N("unable to access rpm file [%s]", $f));
return fileno $fh;
@@ -1677,7 +1678,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-(
my $pkg = $urpm->{depslist}[$pkgid];
my $fullname = $pkg->fullname;
my $trtype = (any { /\Q$fullname/ } values %sources_install) ? 'install' : '(update|upgrade)';
- for ($pkg->files) { /\bREADME(\.$trtype)?\.urpmi$/ and $Readmes{$_} = $fullname }
+ foreach ($pkg->files) { /\bREADME(\.$trtype)?\.urpmi$/ and $Readmes{$_} = $fullname }
close $fh;
},
);
@@ -1757,7 +1758,7 @@ you may now inspect some in order to take actions:"),
# -=-=-=---=-=-=---=-=-=-- remove packages -=-=-=---=-=-=---=-=-=-
-sub get_installed_pkgs {
+sub get_installed_pkgs() {
my $wait = wait_msg_with_banner(N("Please wait, reading packages database..."));
gtkflush();
my $urpm = urpm->new;
@@ -1790,7 +1791,7 @@ sub get_installed_pkgs {
selected => 0, pkg => $pkg, urpm_name => urpm_name($pkg),
summary => rpm_summary($pkg->summary),
description => rpm_description($pkg->description),
- } unless $installed_pkgs{$fullname} && $installed_pkgs{$fullname}{description};
+ } if !($installed_pkgs{$fullname} && $installed_pkgs{$fullname}{description});
if ($base{$fullname}) {
$installed_pkgs{$fullname}{base} = \${$base{$fullname}};
if (${$base{$fullname}} == 1) { $pkg->set_flag_base(1) }
diff --git a/rpmdrake.pm b/rpmdrake.pm
index 29fbf894..3c31340d 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -153,19 +153,19 @@ our %config = (
changelog_first_config => { var => \our $changelog_first_config, default => [ 0 ] },
);
-sub readconf {
+sub readconf() {
${$config{$_}{var}} = $config{$_}{default} foreach keys %config;
foreach my $l (cat_($configfile)) {
$l =~ /^\Q$_\E (.*)/ and ${$config{$_}{var}} = [ split ' ', $1 ] foreach keys %config;
}
}
-sub writeconf {
+sub writeconf() {
unlink $configfile;
output $configfile, map { "$_ " . join(' ', @${$config{$_}{var}}) . "\n" } keys %config;
}
-sub getbanner () {
+sub getbanner() {
$::MODE or return undef;
Gtk2::Banner->new("title-$::MODE", {
remove => N("Software Packages Removal"),
@@ -179,7 +179,7 @@ sub interactive_msg {
my $d = ugtk2->new($title, grab => 1, if_(exists $options{transient}, transient => $options{transient}));
$d->{rwindow}->set_position($options{transient} ? 'center_on_parent' : 'center_always');
$contents = formatAlaTeX($contents) unless $options{scroll}; #- because we'll use a WrappedLabel
- my $banner = $options{banner} ? getbanner : undef;
+ my $banner = $options{banner} ? getbanner() : undef;
gtkadd(
$d->{window},
gtkpack_(
@@ -298,7 +298,7 @@ sub wait_msg {
my $mainw = ugtk2->new('Rpmdrake', grab => 1, if_(exists $options{transient}, transient => $options{transient}));
$mainw->{real_window}->set_position($options{transient} ? 'center_on_parent' : 'center_always');
my $label = ref($msg) =~ /^Gtk/ ? $msg : Gtk2::WrappedLabel->new($msg);
- my $banner = $options{banner} ? getbanner : undef;
+ my $banner = $options{banner} ? getbanner() : undef;
gtkadd(
$mainw->{window},
gtkpack__(
@@ -450,7 +450,7 @@ my %sites2countries = (
);
#- get distrib release number (2006.0, etc)
-sub etc_version {
+sub etc_version() {
(my $v) = split / /, cat_('/etc/version');
return $v;
}
@@ -461,7 +461,7 @@ sub distro_type {
my ($want_base_distro) = @_;
return 'cooker' if $mandrake_release =~ /cooker/i;
#- we can't use updates for community while official is not out (release ends in ".0")
- if ($want_base_distro || ($mandrake_release =~ /community/i && etc_version() =~ /\.0$/)) {
+ if ($want_base_distro || $mandrake_release =~ /community/i && etc_version() =~ /\.0$/) {
return 'official' if $mandrake_release =~ /official|limited/i;
return 'community' if $mandrake_release =~ /community/i;
#- unknown: fallback to updates
@@ -671,7 +671,7 @@ sub update_sources {
no_wait_cursor => 1,
banner => $options{banner},
widgets => [
- (my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 300, -1)),
+ my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 300, -1),
gtkpack(
create_hbox(),
gtksignal_connect(
@@ -850,7 +850,7 @@ It will be disabled.",
$_->{name}, $mdk_version)
);
$_->{ignore} = 1;
- $urpm->write_config if -w $urpm->{config};
+ $urpm->write_config() if -w $urpm->{config};
return 0;
}
}