summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-02-19 11:03:16 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-02-19 11:03:16 +0000
commit2fe61e07370ca3ccec7d686abf7d497a75d435c0 (patch)
tree446c7e2f2d2af0a82d29ba101a96f8b8357429bd
parent21681af94d62b41899acc768111b34fe1dd8cdb5 (diff)
downloadperl-MDV-Distribconf-2fe61e07370ca3ccec7d686abf7d497a75d435c0.tar
perl-MDV-Distribconf-2fe61e07370ca3ccec7d686abf7d497a75d435c0.tar.gz
perl-MDV-Distribconf-2fe61e07370ca3ccec7d686abf7d497a75d435c0.tar.bz2
perl-MDV-Distribconf-2fe61e07370ca3ccec7d686abf7d497a75d435c0.tar.xz
perl-MDV-Distribconf-2fe61e07370ca3ccec7d686abf7d497a75d435c0.zip
- considere rpm more recent than index needing to be repacked
-rw-r--r--lib/MDV/Distribconf/Utils.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/MDV/Distribconf/Utils.pm b/lib/MDV/Distribconf/Utils.pm
index 20259b4..81cc8d1 100644
--- a/lib/MDV/Distribconf/Utils.pm
+++ b/lib/MDV/Distribconf/Utils.pm
@@ -13,13 +13,13 @@ MDV::Distribconf::Utils
=head1 DESCRIPTION
-Contains basic functions use by Distribconf
+Contains basic functions used by Distribconf
=head1 FUNCTIONS
=head2 hdlist_vs_dir($hdlistfile, @dirs)
-Return two array ref about rpm include only in hdlist or in directories
+Return two arrayrefs about rpms included only in hdlist or in directories
=cut
@@ -28,18 +28,23 @@ sub hdlist_vs_dir {
my (@only_pack, @only_dir);
my @rpms;
foreach my $dir (@dir) {
- push(@rpms, map { m:.*/+(.*): ; $1 } glob("$dir/*.rpm"));
+ push(@rpms, glob("$dir/*.rpm"));
}
- @rpms = sort { $b cmp $a } @rpms;
+ @rpms = sort { ($b =~ m:.*/+(.*):)[0] cmp ($a =~ m:.*/+(.*):)[0] } @rpms;
if (my $pack = MDV::Packdrakeng->open(archive => $hdlist)) {
+ my $hdlisttime = (stat($hdlist))[9];
my (undef, $files, undef) = $pack->getcontent();
my @hdrs = sort { $b cmp $a } map { "$_.rpm" } @{$files || []};
my ($r, $h) = ("", "");
do {
- my $comp = $r cmp $h;
+ my $comp = (($r =~ m:.*/+(.*):)[0] || '') cmp $h;
# print "< $r - $h > $comp\n";
if ($comp < 0) { push(@only_pack, $h); }
- elsif ($comp > 0) { push(@only_dir, $r); }
+ elsif ($comp > 0) { push(@only_dir, ($r =~ m:.*/+(.*):)[0]); }
+ elsif ($r && (stat($r))[9] > $hdlisttime) {
+ push(@only_pack, $h);
+ push(@only_dir, ($r =~ m:.*/+(.*):)[0]);
+ }
if ($comp <= 0) {
$h = shift(@hdrs) || "";