summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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) || "";