diff options
-rw-r--r-- | urpm.pm | 102 | ||||
-rwxr-xr-x | urpmf | 4 | ||||
-rwxr-xr-x | urpmi | 10 | ||||
-rwxr-xr-x | urpmi.addmedia | 8 | ||||
-rw-r--r-- | urpmi.spec | 12 | ||||
-rwxr-xr-x | urpmi.update | 6 | ||||
-rwxr-xr-x | urpmq | 12 |
7 files changed, 79 insertions, 75 deletions
@@ -143,7 +143,7 @@ sub sync_webfetch { } sub propagate_sync_callback { my $options = shift @_; - if (ref $options && $options->{callback}) { + if (ref($options) && $options->{callback}) { my $mode = shift @_; if ($mode =~ /^(start|progress|end)$/) { my $file = shift @_; @@ -159,7 +159,7 @@ sub sync_file { foreach (@_) { my ($in) = /^(?:removable[^:]*|file):\/(.*)/; propagate_sync_callback($options, 'start', $_); - system("cp", "--preserve=mode,timestamps", "-R", $in || $_, ref $options ? $options->{dir} : $options) or die N("copy failed: %s", $@); + system("cp", "--preserve=mode,timestamps", "-R", $in || $_, ref($options) ? $options->{dir} : $options) or die N("copy failed: %s", $@); propagate_sync_callback($options, 'end', $_); } } @@ -169,17 +169,17 @@ sub sync_wget { my $options = shift @_; my ($buf, $total, $file) = ('', undef, undef); open WGET, join(" ", map { "'$_'" } "/usr/bin/wget", - (ref $options && $options->{limit_rate} ? "--limit-rate=$options->{limit_rate}" : ()), - (ref $options && $options->{proxy} ? set_proxy({ type => "wget", proxy => $options->{proxy} }) : ()), - (ref $options && $options->{callback} ? ("--progress=bar:force", "-o", "-") : - ref $options && $options->{quiet} ? "-q" : ()), + (ref($options) && $options->{limit_rate} ? "--limit-rate=$options->{limit_rate}" : ()), + (ref($options) && $options->{proxy} ? set_proxy({ type => "wget", proxy => $options->{proxy} }) : ()), + (ref($options) && $options->{callback} ? ("--progress=bar:force", "-o", "-") : + ref($options) && $options->{quiet} ? "-q" : @{[]}), "--retr-symlinks", "-NP", - (ref $options ? $options->{dir} : $options), @_) . " |"; + (ref($options) ? $options->{dir} : $options), @_) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<WGET>) { $buf .= $_; if ($_ eq "\r" || $_ eq "\n") { - if (ref $options && $options->{callback}) { + if (ref($options) && $options->{callback}) { if ($buf =~ /^--\d\d:\d\d:\d\d--\s+(\S.*)\n/ms) { $file && $file ne $1 and propagate_sync_callback($options, 'end', $file); ! defined $file and propagate_sync_callback($options, 'start', $file = $1); @@ -207,7 +207,7 @@ sub sync_curl { -x "/usr/bin/curl" or die N("curl is missing\n"); local *CURL; my $options = shift @_; - chdir(ref $options ? $options->{dir} : $options); + chdir(ref($options) ? $options->{dir} : $options); my (@ftp_files, @other_files); foreach (@_) { /^ftp:\/\/.*\/([^\/]*)$/ && -s $1 > 8192 and do { push @ftp_files, $_; next }; #- manage time stamp for large file only. @@ -220,16 +220,16 @@ sub sync_curl { #- prepare to get back size and time stamp of each file. open CURL, join(" ", map { "'$_'" } "/usr/bin/curl", - (ref $options && $options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), - (ref $options && $options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()) . + (ref($options) && $options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), + (ref($options) && $options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()) . "-s", "-I", @ftp_files) . " |"; while (<CURL>) { if (/Content-Length:\s*(\d+)/) { - !$cur_ftp_file || exists $ftp_files_info{$cur_ftp_file}{size} and $cur_ftp_file = shift @ftp_files; + !$cur_ftp_file || exists($ftp_files_info{$cur_ftp_file}{size}) and $cur_ftp_file = shift @ftp_files; $ftp_files_info{$cur_ftp_file}{size} = $1; } if (/Last-Modified:\s*(.*)/) { - !$cur_ftp_file || exists $ftp_files_info{$cur_ftp_file}{time} and $cur_ftp_file = shift @ftp_files; + !$cur_ftp_file || exists($ftp_files_info{$cur_ftp_file}{time}) and $cur_ftp_file = shift @ftp_files; $ftp_files_info{$cur_ftp_file}{time} = Date::Manip::ParseDate($1); $ftp_files_info{$cur_ftp_file}{time} =~ s/(\d{6}).{4}(.*)/$1$2/; #- remove day and hour. } @@ -256,19 +256,19 @@ sub sync_curl { #- http files (and other files) are correctly managed by curl to conditionnal download. #- options for ftp files, -R (-O <file>)* #- options for http files, -R (-z file -O <file>)* - if (my @all_files = ((map { ("-O", $_) } @ftp_files), (map { /\/([^\/]*)$/ ? ("-z", $1, "-O", $_) : () } @other_files))) { + if (my @all_files = ((map { ("-O", $_) } @ftp_files), (map { /\/([^\/]*)$/ ? ("-z", $1, "-O", $_) : @{[]} } @other_files))) { my @l = (@ftp_files, @other_files); my ($buf, $file) = ('', undef); open CURL, join(" ", map { "'$_'" } "/usr/bin/curl", - (ref $options && $options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), - (ref $options && $options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()), - (ref $options && $options->{quiet} && !$options->{verbose} ? "-s" : ()), "-R", "-f", "--stderr", "-", + (ref($options) && $options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), + (ref($options) && $options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()), + (ref($options) && $options->{quiet} && !$options->{verbose} ? "-s" : @{[]}), "-R", "-f", "--stderr", "-", @all_files) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<CURL>) { $buf .= $_; if ($_ eq "\r" || $_ eq "\n") { - if (ref $options && $options->{callback}) { + if (ref($options) && $options->{callback}) { unless (defined $file) { $file = shift @l; propagate_sync_callback($options, 'start', $file); @@ -292,7 +292,7 @@ sub sync_curl { sub sync_rsync { -x "/usr/bin/rsync" or die N("rsync is missing\n"); my $options = shift @_; - my $limit_rate = ref $options && $options->{limit_rate}; + my $limit_rate = ref($options) && $options->{limit_rate}; for ($limit_rate) { /^(\d+)$/ and $limit_rate = $1/1024; /^(\d+)[kK]$/ and $limit_rate = $1; @@ -309,13 +309,13 @@ sub sync_rsync { my $buf = ''; open RSYNC, join(" ", map { "'$_'" } "/usr/bin/rsync", ($limit_rate ? "--bwlimit=$limit_rate" : ()), - (ref $options && $options->{quiet} ? qw(-q) : qw(--progress -v)), - qw(--partial --no-whole-file), $file, (ref $options ? $options->{dir} : $options)) . " |"; + (ref($options) && $options->{quiet} ? qw(-q) : qw(--progress -v)), + qw(--partial --no-whole-file), $file, (ref($options) ? $options->{dir} : $options)) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<RSYNC>) { $buf .= $_; if ($_ eq "\r" || $_ eq "\n") { - if (ref $options && $options->{callback}) { + if (ref($options) && $options->{callback}) { if (my ($percent, $speed) = $buf =~ /^\s*\d+\s+(\d+)%\s+(\S+)\s+/) { propagate_sync_callback($options, 'progress', $file, $percent, undef, undef, $speed); } @@ -326,7 +326,7 @@ sub sync_rsync { } } close RSYNC; - } while ($? != 0 && --$count > 0 && -e (ref $options ? $options->{dir} : $options) . "/$basename"); + } while ($? != 0 && --$count > 0 && -e (ref($options) ? $options->{dir} : $options) . "/$basename"); propagate_sync_callback($options, 'end', $file); } $? == 0 or die N("rsync failed: exited with %d or signal %d\n", $? >> 8, $? & 127); @@ -335,7 +335,7 @@ sub sync_ssh { -x "/usr/bin/rsync" or die N("rsync is missing\n"); -x "/usr/bin/ssh" or die N("ssh is missing\n"); my $options = shift @_; - my $limit_rate = ref $options && $options->{limit_rate}; + my $limit_rate = ref($options) && $options->{limit_rate}; for ($limit_rate) { /^(\d+)$/ and $limit_rate = $1/1024; /^(\d+)[kK]$/ and $limit_rate = $1; @@ -351,13 +351,13 @@ sub sync_ssh { my $buf = ''; open RSYNC, join(" ", map { "'$_'" } "/usr/bin/rsync", ($limit_rate ? "--bwlimit=$limit_rate" : ()), - (ref $options && $options->{quiet} ? qw(-q) : qw(--progress -v)), - qw(--partial -e ssh), $file, (ref $options ? $options->{dir} : $options)) . " |"; + (ref($options) && $options->{quiet} ? qw(-q) : qw(--progress -v)), + qw(--partial -e ssh), $file, (ref($options) ? $options->{dir} : $options)) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<RSYNC>) { $buf .= $_; if ($_ eq "\r" || $_ eq "\n") { - if (ref $options && $options->{callback}) { + if (ref($options) && $options->{callback}) { if (my ($percent, $speed) = $buf =~ /^\s*\d+\s+(\d+)%\s+(\S+)\s+/) { propagate_sync_callback($options, 'progress', $file, $percent, undef, undef, $speed); } @@ -368,7 +368,7 @@ sub sync_ssh { } } close RSYNC; - } while ($? != 0 && --$count > 0 && -e (ref $options ? $options->{dir} : $options) . "/$basename"); + } while ($? != 0 && --$count > 0 && -e (ref($options) ? $options->{dir} : $options) . "/$basename"); propagate_sync_callback($options, 'end', $file); } $? == 0 or die N("rsync failed: exited with %d or signal %d\n", $? >> 8, $? & 127); @@ -416,13 +416,13 @@ sub read_config { #- check for boolean variables first, and after that valued variables. my ($no, $k, $v); if (($no, $k, $v) = /^(no-)?(verify-rpm|fuzzy|allow-(?:force|nodeps)|(?:pre|post)-clean)(?:\s*:\s*(.*))?$/) { - unless (exists $urpm->{options}{$k}) { + unless (exists($urpm->{options}{$k})) { $urpm->{options}{$k} = $v eq '' || $v =~ /^(yes|on|1)$/i || 0; $no and $urpm->{options}{$k} = ! $urpm->{options}{$k} || 0; } next; } elsif (($k, $v) = /^(limit-rate|excludepath)\s*:\s*(.*)$/) { - unless (exists $urpm->{options}{$k}) { + unless (exists($urpm->{options}{$k})) { $v =~ /^'([^']*)'$/ and $v = $1; $v =~ /^"([^"]*)"$/ and $v = $1; $urpm->{options}{$k} = $v; } @@ -464,11 +464,11 @@ sub read_config { #- the next probe. my (%hdlists, %lists); foreach (@{$urpm->{media}}) { - exists $hdlists{$_->{hdlist}} and + exists($hdlists{$_->{hdlist}}) and $_->{ignore} = 1, $urpm->{error}(N("medium \"%s\" trying to use an already used hdlist, medium ignored", $_->{name})); $hdlists{$_->{hdlist}} = undef; if ($_->{list}) { - exists $lists{$_->{list}} and + exists($lists{$_->{list}}) and $_->{ignore} = 1, $urpm->{error}(N("medium \"%s\" trying to use an already used list, medium ignored", $_->{name})); $lists{$_->{list}} = undef; } @@ -479,12 +479,12 @@ sub read_config { foreach (glob("$urpm->{statedir}/hdlist.*")) { if (/\/hdlist\.((.*)\.cz2?)$/) { #- check if it has already been detected above. - exists $hdlists{"hdlist.$1"} and next; + exists($hdlists{"hdlist.$1"}) and next; #- if not this is a new media to take care if #- there is a list file. if (-s "$urpm->{statedir}/list.$2") { - if (exists $lists{"list.$2"}) { + if (exists($lists{"list.$2"})) { $urpm->{error}(N("unable to take care of medium \"%s\" as list file is already used by another medium", $2)); } else { my $medium; @@ -598,7 +598,7 @@ sub probe_removable_device { } #- try to find device to open/close for removable medium. - if (exists $medium->{removable}) { + if (exists($medium->{removable})) { if (my ($dir) = $medium->{url} =~ /(?:file|removable)[^:]*:\/(.*)/) { my %infos; my @mntpoints = $urpm->find_mntpoints($dir, \%infos); @@ -770,7 +770,7 @@ sub configure { $db->traverse(sub { my ($p) = @_; #- this is not right but may be enough. - my $files = join '@', grep { exists $urpm->{provides}{$_} } $p->files; + my $files = join '@', grep { exists($urpm->{provides}{$_}) } $p->files; $p->pack_header; $p->build_info(fileno *RPMDB, $files); }); @@ -906,7 +906,7 @@ sub select_media { my %media; @media{@_} = undef; foreach (@{$urpm->{media}}) { - if (exists $media{$_->{name}}) { + if (exists($media{$_->{name}})) { $media{$_->{name}} = 1; #- keep it mind this one has been selected. #- select medium by setting modified flags, do not check ignore. @@ -1220,9 +1220,9 @@ sub update_media { foreach ($medium->{with_hdlist} || (), "synthesis.hdlist.cz", "synthesis.hdlist$suffix.cz", - !$suffix ? ("synthesis.hdlist1.cz", "synthesis.hdlist2.cz") : (), - "../synthesis.hdlist$suffix.cz", !$suffix ? "../synthesis.hdlist1.cz" : (), - "../base/hdlist$suffix.cz", !$suffix ? "../base/hdlist1.cz" : (), + !$suffix ? ("synthesis.hdlist1.cz", "synthesis.hdlist2.cz") : @{[]}, + "../synthesis.hdlist$suffix.cz", !$suffix ? "../synthesis.hdlist1.cz" : @{[]}, + "../base/hdlist$suffix.cz", !$suffix ? "../base/hdlist1.cz" : @{[]}, ) { $basename = /^.*\/([^\/]*)$/ && $1 || $_ or next; @@ -1626,7 +1626,7 @@ sub find_mntpoints { my ($device, $mntpoint, $fstype, $options) = /^\s*(\S+)\s+(\/\S+)\s+(\S+)\s+(\S+)/ or next; $mntpoint =~ s,/+,/,g; $mntpoint =~ s,/$,,; $fstab{$mntpoint} = 0; - if (ref $infos) { + if (ref($infos)) { if ($fstype eq 'supermount') { $options =~ /^(?:.*[\s,])?dev=([^\s,]+)/ and $infos->{$mntpoint} = { mounted => 0, device => $1, fs => $fstype }; } else { @@ -1639,7 +1639,7 @@ sub find_mntpoints { my ($device, $mntpoint, $fstype, $options) = /^\s*(\S+)\s+(\/\S+)\s+(\S+)\s+(\S+)/ or next; $mntpoint =~ s,/+,/,g; $mntpoint =~ s,/$,,; $fstab{$mntpoint} = 1; - if (ref $infos) { + if (ref($infos)) { if ($fstype eq 'supermount') { $options =~ /^(?:.*[\s,])?dev=([^\s,]+)/ and $infos->{$mntpoint} = { mounted => 1, device => $1, fs => $fstype }; } else { @@ -1668,8 +1668,8 @@ sub find_mntpoints { length($_) or next; $pdir .= "/$_"; $pdir =~ s,/+,/,g; $pdir =~ s,/$,,; - if (exists $fstab{$pdir}) { - ref $infos and push @mntpoints, $pdir; + if (exists($fstab{$pdir})) { + ref($infos) and push @mntpoints, $pdir; $infos eq 'mount' && ! $fstab{$pdir} and push @mntpoints, $pdir; $infos eq 'umount' && $fstab{$pdir} and unshift @mntpoints, $pdir; } @@ -1962,12 +1962,12 @@ sub deselect_unwanted_packages { close F; %skip or return; - foreach (grep { $options{force} || (exists $packages->{$_} && ! defined $packages->{$_}) } keys %$packages) { + foreach (grep { $options{force} || exists($packages->{$_}) && ! defined $packages->{$_} } keys %$packages) { my $pkg = $urpm->{depslist}[$_] or next; my $remove_it; #- check if fullname is matching a regexp. - if (grep { exists $skip{$_}{''} && /^\/(.*)\/$/ && $pkg->fullname =~ /$1/ } keys %skip) { + if (grep { exists($skip{$_}{''}) && /^\/(.*)\/$/ && $pkg->fullname =~ /$1/ } keys %skip) { delete $packages->{$pkg->id}; } else { #- check if a provides match at least one package. @@ -2076,7 +2076,7 @@ sub get_source_packages { next; } elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) { my ($fullname) = keys(%{$file2fullnames{$filename} || {}}); - unless (exists $list_examined{$fullname}) { + unless (exists($list_examined{$fullname})) { ++$list_warning; defined($id = $fullname2id{$fullname}) and $sources{$id} = "$medium->{url}/".$pkg->filename; $examined{$fullname} = undef; @@ -2094,12 +2094,12 @@ sub get_source_packages { } #- examine package list to see if a package has not been found. - foreach (grep { ! exists $examined{$_} } keys %fullname2id) { + foreach (grep { ! exists($examined{$_}) } keys %fullname2id) { $error = 1; $urpm->{error}(N("package %s is not found.", $_)); } - $error ? () : (\%local_sources, \@list); + $error ? @{[]} : (\%local_sources, \@list); } #- download package that may need to be downloaded. @@ -2312,7 +2312,7 @@ sub extract_packages_to_install { #- these package have version=1 and release=1mdk, and name contains version and release. $pkg->version eq '1' && $pkg->release eq '1mdk' && $pkg->name =~ /^.*-[^\-]*mdk$/ and next; - exists $sources->{$pkg->id} and $inst{$pkg->id} = delete $sources->{$pkg->id}; + exists($sources->{$pkg->id}) and $inst{$pkg->id} = delete $sources->{$pkg->id}; } } close F; @@ -2530,7 +2530,7 @@ sub find_packages_to_remove { #- check if a package to be removed is a part of basesystem requires. while (defined($_ = shift @base)) { - exists $basepackages{$_} and next; + exists($basepackages{$_}) and next; $db->traverse_tag(/^\// ? 'path' : 'whatprovides', [ $_ ], sub { my ($p) = @_; push @{$basepackages{$_} ||= []}, join '-', ($p->fullname)[0..2]; @@ -62,7 +62,7 @@ my $update = 0; my $media = ''; my $synthesis = ''; my $verbose = 0; -my $quiet = undef; +my $quiet; my $pattern = ''; my $full = ''; my %params; @@ -97,7 +97,7 @@ while (defined($_ = shift @ARGV)) { my $urpm = new urpm; $verbose or $urpm->{log} = sub {}; -for (scalar(keys %params)) { +foreach (scalar(keys %params)) { $_ eq 0 and do { defined $quiet or $quiet = 1; $params{files} = 1 }; $_ eq 1 and do { defined $quiet or $quiet = 1 }; $_ > 1 and do { defined $quiet or $quiet = 0 }; @@ -550,7 +550,7 @@ if (my @missing = grep { m|^/| && ! -e $_ } values %sources_install, values %sou #- install source package only (whatever the user is root or not, but use rpm for that). if ($install_src) { if (my @l = grep { /\.src\.rpm$/ } values %sources_install, values %sources) { - system("rpm", "-i$rpm_opt", @l, ($root ? ("--root", $root) : ())); + system("rpm", "-i$rpm_opt", @l, ($root ? ("--root", $root) : @{[]})); $? and message(N("Installation failed")), exit 1; } exit 0; @@ -577,7 +577,7 @@ if (%sources_install || %sources) { $urpm->{log}("starting installing packages"); if ($X && !$root && !$test) { system("rpm", "-e", "--nodeps", keys %{$state->{ask_remove} || {}}); - system("grpmi", $WID ? ("--WID=$WID") : (), + system("grpmi", $WID ? "--WID=$WID" : @{[]}, (map { ("-noupgrade", $_) } values %sources_install), values %sources); if ($?) { #- grpmi handles --nodeps and --force by itself, @@ -675,9 +675,9 @@ sub message_input { $bug and log_it($msg); } else { if ($bug) { - print STDOUT "$msg"; + print STDOUT $msg; } else { - print SAVEOUT "$msg"; + print SAVEOUT $msg; } } @@ -687,7 +687,7 @@ sub message_input { } sub untaint { - my @r = (); + my @r; foreach (@_) { /(.*)/; push @r, $1; diff --git a/urpmi.addmedia b/urpmi.addmedia index 179524de..c9f5261c 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -86,7 +86,7 @@ and [options] are from else { $options = { dir => $options, prefer => 'wget' } } urpm::sync_webfetch($options, @_) }, next; /^--curl/ and $urpm->{sync} = \&urpm::sync_webfetch, next; - /^--limit-rate$/ and do {$options{limit_rate} = shift @_; next }; + /^--limit-rate$/ and do { $options{limit_rate} = shift @_; next }; /^--proxy$/ and do { my ($proxy, $port) = ($_ = shift @_) =~ m,^(?:http://)?([^:]+(:\d+)?)/*$, or die N("bad proxy declaration on command line\n"); @@ -97,8 +97,8 @@ and [options] are from /^--proxy-user$/ and do { ($_ = shift @_) =~ /(.+):(.+)/, or die N("bad proxy declaration on command line\n"); - $urpm->{proxy}->{user} = $1; - $urpm->{proxy}->{pwd} = $2; + $urpm->{proxy}{user} = $1; + $urpm->{proxy}{pwd} = $2; next; }; /^--distrib$/ and $options{distrib} = undef, next; @@ -145,7 +145,7 @@ and [options] are from unlink "$urpm->{cachedir}/partial/$basename"; eval { $urpm->{log}(N("retrieving mirrors at %s ...", $options{from})); - $urpm->{sync}({dir => "$urpm->{cachedir}/partial", quiet => 1, proxy => $urpm->{proxy}}, $options{from}); + $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, proxy => $urpm->{proxy} }, $options{from}); $urpm->{log}(N("...retrieving done")); }; $@ and $urpm->{log}(N("...retrieving failed: %s", $@)); @@ -2,7 +2,7 @@ Name: urpmi Version: 4.2 -Release: 30mdk +Release: 31mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -22,7 +22,7 @@ You can compare rpm vs. urpmi with insmod vs. modprobe %package -n gurpmi Summary: User mode rpm GUI install -Requires: urpmi grpmi gchooser gmessage usermode menu +Requires: urpmi >= %{version}-%{release} grpmi gchooser gmessage usermode menu Group: %{group} %description -n gurpmi gurpmi is a graphical front-end to urpmi @@ -37,7 +37,7 @@ gurpmi is a graphical front-end to urpmi %package -n urpmi-parallel-ka-run Summary: Parallel extensions to urpmi using ka-run -Requires: urpmi >= 4.2-1mdk ka-run >= 2.0-15mdk +Requires: urpmi >= %{version}-%{release} ka-run >= 2.0-15mdk Group: %{group} %description -n urpmi-parallel-ka-run urpmi-parallel-ka-run is an extensions module to urpmi for handling @@ -45,7 +45,7 @@ distributed installation using ka-run tools. %package -n urpmi-parallel-ssh Summary: Parallel extensions to urpmi using ssh and scp -Requires: urpmi >= 4.2-1mdk openssh-clients +Requires: urpmi >= %{version}-%{release} openssh-clients Group: %{group} %description -n urpmi-parallel-ssh urpmi-parallel-ssh is an extensions module to urpmi for handling @@ -199,6 +199,10 @@ $urpm->update_media; %changelog +* Mon Mar 10 2003 François Pons <fpons@mandrakesoft.com> 4.2-31mdk +- try to be somewhat perl_checker compliant. +- strict require on urpmi. + * Thu Mar 6 2003 Pons François <fpons@mandrakesoft.com> 4.2-30mdk - fixed %%post script to be simpler and much faster. diff --git a/urpmi.update b/urpmi.update index a8854538..3f5093a2 100755 --- a/urpmi.update +++ b/urpmi.update @@ -38,7 +38,7 @@ sub main { else { $options = { dir => $options, prefer => 'wget' } } urpm::sync_webfetch($options, @_) }, next; /^--curl$/ and $urpm->{sync} = \&urpm::sync_webfetch, next; - /^--limit-rate$/ and do {$options{limit_rate} = shift @_; next }; + /^--limit-rate$/ and do { $options{limit_rate} = shift @_; next }; /^--proxy$/ and do { my ($proxy, $port) = ($_ = shift @_) =~ m,^(?:http://)?([^:]+(:\d+)?)/*$, or die N("bad proxy declaration on command line\n"); @@ -49,8 +49,8 @@ sub main { /^--proxy-user$/ and do { ($_ = shift @_) =~ /(.+):(.+)/, or die N("bad proxy declaration on command line\n"); - $urpm->{proxy}->{user} = $1; - $urpm->{proxy}->{pwd} = $2; + $urpm->{proxy}{user} = $1; + $urpm->{proxy}{pwd} = $2; next; }; /^--?noa/ and next; #- default, keeped for compability. @@ -97,7 +97,7 @@ while (defined($_ = shift @ARGV)) { /^--root$/ and do { push @nextargv, \$query->{root}; next }; /^--parallel$/ and do { push @nextargv, \$query->{parallel}; next }; /^--wget$/ and do { $urpm->{sync} = sub { my $options = shift @_; - if (ref $options) { $options->{prefer} = 'wget' } + if (ref($options)) { $options->{prefer} = 'wget' } else { $options = { dir => $options, prefer => 'wget' } } urpm::sync_webfetch($options, @_) }; next }; /^--curl$/ and do { $urpm->{sync} = \&urpm::sync_webfetch; next }; @@ -133,8 +133,8 @@ while (defined($_ = shift @ARGV)) { /f/ and do { $query->{version} = $query->{release} = $query->{arch} = 1; next }; print STDERR N("urpmq: unknown option \"-%s\", check usage with --help\n", $1); exit(1) } next }; @nextargv and do { my $r = shift @nextargv; $r and $$r = $_; next }; - /\.rpm$/ and do { if (-r $_) { push @files, $_; } - else { print STDERR N("urpmq: cannot read rpm file \"%s\"\n", $_); } + /\.rpm$/ and do { if (-r $_) { push @files, $_ } + else { print STDERR N("urpmq: cannot read rpm file \"%s\"\n", $_) } next }; if ($query->{src}) { push @src_names, $_; @@ -204,7 +204,7 @@ if ($query->{list_aliases}) { #- keep track of choices, do no propagate but mark them in selected. my $stop_on_choices = sub { my ($urpm, $db, $state, $choices) = @_; - $state->{selected}{join '|', sort { $a <=> $b } map { $_ ? ($_->id) : () } @$choices} = 0; + $state->{selected}{join '|', sort { $a <=> $b } map { $_ ? $_->id : () } @$choices} = 0; }; #- open/close of database should be moved here, in order to allow testing #- some bogus case and check for integrity. (note auto_select implies upgrade). @@ -275,7 +275,7 @@ if ($query->{list_aliases}) { auto_select => $query->{auto_select}, callback_choices => $stop_on_choices); $query->{deps} or delete @{$state->{selected}}{grep { exists $state->{selected}{$_} && - ! defined $state->{selected}{$_}} keys %{$state->{selected}}}; + ! defined $state->{selected}{$_} } keys %{$state->{selected}}}; } elsif ($query->{deps}) { #- only deps required. my $empty_db = new URPM; #- URPM has same methods as URPM::DB and empty URPM will be seen as empty URPM::DB. @@ -346,7 +346,7 @@ if ($query->{complete}) { } foreach my $id ($state->{selected} ? keys %{$state->{selected}} : keys %requested) { my $class = $state->{selected}{$id} || $requested{$id}; - if (ref $class eq 'ARRAY') { + if (ref($class) eq 'ARRAY') { foreach my $choices (@{$class || []}) { exists $hack_only_one{$choices} and next; print join('|', map { $query_sub->($_) } @$choices), "\n"; |