summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-12-28 18:30:39 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-12-28 18:30:39 +0000
commitaebbdb01b738956542494c4c2bd62ea1e672e633 (patch)
tree19d1ccce6df2371eef5308967c17e59408e5e407
parentffda35dfebb9125a08d494e099fe1f48769d2efb (diff)
downloadperl-MDV-Distribconf-aebbdb01b738956542494c4c2bd62ea1e672e633.tar
perl-MDV-Distribconf-aebbdb01b738956542494c4c2bd62ea1e672e633.tar.gz
perl-MDV-Distribconf-aebbdb01b738956542494c4c2bd62ea1e672e633.tar.bz2
perl-MDV-Distribconf-aebbdb01b738956542494c4c2bd62ea1e672e633.tar.xz
perl-MDV-Distribconf-aebbdb01b738956542494c4c2bd62ea1e672e633.zip
- avoid twice stat per file
-rw-r--r--lib/MDV/Distribconf/Utils.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/MDV/Distribconf/Utils.pm b/lib/MDV/Distribconf/Utils.pm
index 1551789..67cc4ee 100644
--- a/lib/MDV/Distribconf/Utils.pm
+++ b/lib/MDV/Distribconf/Utils.pm
@@ -29,7 +29,7 @@ sub hdlist_vs_dir {
my (@only_pack, @only_dir);
my @rpms;
foreach my $dir (@dir) {
- push(@rpms, grep { -e $_ } glob("$dir/*.rpm"));
+ push(@rpms, glob("$dir/*.rpm"));
}
@rpms = sort { ($b =~ m:.*/+(.*):)[0] cmp ($a =~ m:([^/]+)$:)[0] } @rpms;
if (-f $hdlist and my $pack = MDV::Packdrakeng->open(archive => $hdlist)) {
@@ -40,10 +40,10 @@ sub hdlist_vs_dir {
do {
my $base_r = ($r =~ m:([^/]+)$:)[0] || '';
my $comp = ($base_r cmp $h);
- my $st_d = (stat($r))[9] if ($r);
- if ($comp < 0) { push(@only_pack, $h); }
+ my $st_d = $r ? (stat($r))[9] : 0;
+ if ($comp < 0 || !defined($st_d)) { push(@only_pack, $h); }
elsif ($comp > 0) { push(@only_dir, $base_r); }
- elsif ($r && (!defined($st_d) || $st_d > $hdlisttime)) {
+ elsif ($r && ($st_d > $hdlisttime)) {
push(@only_pack, $h);
push(@only_dir, ($r =~ m:.*/+(.*):)[0]);
}