aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Build.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-02 00:03:20 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-02 00:03:20 +0000
commit17a0eb83d851331bad1e2c1185d1751910197846 (patch)
treee237a3e1fce1e8a7a7f1c3d48e52bf04aa6bc39c /URPM/Build.pm
parentc1e1c394c9f708066aa5b39d02c9ae0be7dcfaf0 (diff)
downloadperl-URPM-17a0eb83d851331bad1e2c1185d1751910197846.tar
perl-URPM-17a0eb83d851331bad1e2c1185d1751910197846.tar.gz
perl-URPM-17a0eb83d851331bad1e2c1185d1751910197846.tar.bz2
perl-URPM-17a0eb83d851331bad1e2c1185d1751910197846.tar.xz
perl-URPM-17a0eb83d851331bad1e2c1185d1751910197846.zip
Make perl_checker a bit more happy
Diffstat (limited to 'URPM/Build.pm')
-rw-r--r--URPM/Build.pm41
1 files changed, 23 insertions, 18 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm
index f8a6932..b40b005 100644
--- a/URPM/Build.pm
+++ b/URPM/Build.pm
@@ -27,16 +27,17 @@ sub parse_rpms_build_headers {
while (defined (my $file = readdir $dirh)) {
my ($fullname, $filename) = $file =~ /(.+?-[^:\-]+-[^:\-]+\.[^:\-\.]+)(?::(\S+))?$/ or next;
my @stat = stat "$dir/$file";
- $cache{$filename || $fullname} = { file => $file,
- size => $stat[7],
- time => $stat[9],
- };
+ $cache{$filename || $fullname} = {
+ file => $file,
+ size => $stat[7],
+ 'time' => $stat[9],
+ };
}
closedir $dirh;
}
foreach (@{$options{rpms}}) {
- my ($key) = m{([^/]*)\.rpm$} or next; #- get rpm filename.
+ my ($key) = /([^\/]*)\.rpm$/ or next; #- get rpm filename.
my ($id, $filename);
if ($cache{$key} && $cache{$key}{time} > 0 && $cache{$key}{time} >= (stat $_)[9]) {
@@ -139,9 +140,9 @@ sub parse_rpms {
rpms => $rpms,
%options,
callback => sub {
- my ($urpm, $id) = @_;
- $start = $id if($start > $id || ! defined($start));
- $end = $id if($end < $id || ! defined($end));
+ my (undef, $id) = @_;
+ $start = $id if $start > $id || ! defined($start);
+ $end = $id if $end < $id || ! defined($end);
}
) ? ($start, $end) : ();
}
@@ -177,10 +178,11 @@ sub fuzzy_parse {
#- callback : callback to relocate reference to package id.
sub compute_deps {
my ($urpm, %options) = @_;
- my %propagated_weight = ( basesystem => 10000,
- msec => 20000,
- filesystem => 50000,
- );
+ my %propagated_weight = (
+ basesystem => 10000,
+ msec => 20000,
+ filesystem => 50000,
+ );
my ($locales_weight, $step_weight, $fixed_weight) = (-5000, 10000, $propagated_weight{basesystem});
#- avoid recomputing already present infos, take care not to modify
@@ -213,9 +215,11 @@ sub compute_deps {
while (my $req = shift @requires) {
$req =~ /^basesystem/ and next; #- never need to requires basesystem directly as always required! what a speed up!
- my $treq = ($req =~ /^\d+$/ && [ $req ] ||
- $urpm->{provides}{$req} && [ keys %{$urpm->{provides}{$req}} ] ||
- [ ($req !~ /NOTFOUND_/ && "NOTFOUND_") . $req ]);
+ my $treq = (
+ $req =~ /^\d+$/ ? [ $req ]
+ : $urpm->{provides}{$req} ? [ keys %{$urpm->{provides}{$req}} ]
+ : [ ($req !~ /NOTFOUND_/ ? "NOTFOUND_" : "") . $req ]
+ );
if (@$treq > 1) {
#- this is a choice, no closure need to be done here.
push @required_packages, $treq;
@@ -302,7 +306,7 @@ sub compute_deps {
exists $prereqs{$b}{$a} && ! exists $prereqs{$a}{$b} ? 1 :
$ordered{$b} <=> $ordered{$a} or do {
my ($na, $nb) = map { $urpm->{depslist}[$_]->name } ($a, $b);
- my ($sa, $sb) = map { /^lib(.*)/ and $1 } ($na, $nb);
+ my ($sa, $sb) = map { /^lib(.*)/ ? $1 : '' } ($na, $nb);
$sa && $sb ? $sa cmp $sb : $sa ? -1 : $sb ? 1 : $na cmp $nb;
} } ($start .. $end)} = ($start .. $end);
@@ -397,7 +401,7 @@ sub build_hdlist {
-d $dir or die "no directory $dir\n";
@idlist = @{$options{idlist} || []} > 0 ? @{$options{idlist}} :
- ($options{start} || 0 .. $options{end} || $#{$urpm->{depslist}});
+ (($options{start} || 0) .. ($options{end} || $#{$urpm->{depslist}}));
@idlist or return;
#- compression ratio are not very high, sample for cooker
@@ -414,7 +418,8 @@ sub build_hdlist {
open my $fh, "| " . ($ENV{LD_LOADER} || '') . " packdrake -b${ratio}ds '$options{hdlist}' '$dir' $split";
foreach my $pkg (@{$urpm->{depslist}}[@idlist]) {
my $filename = $pkg->fullname;
- "$filename.rpm" ne $pkg->filename && $pkg->filename =~ m{([^/]*)\.rpm$} and $filename .= ":$1";
+ "$filename.rpm" ne $pkg->filename && $pkg->filename =~ /([^\/]*)\.rpm$/
+ and $filename .= ":$1";
-s "$dir/$filename" or die "bad header $dir/$filename\n";
print $fh "$filename\n";
}