aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-06-05 08:47:13 +0000
committerFrancois Pons <fpons@mandriva.com>2003-06-05 08:47:13 +0000
commit4e8bd2468f5472806ee66bd917ed6d18dadee91f (patch)
treea1b70f8f43c797a5608608e5aa05a8ca8a837ffe /URPM
parent468c2daada584c066dcb1ee42e2f038f64242e7a (diff)
downloadperl-URPM-4e8bd2468f5472806ee66bd917ed6d18dadee91f.tar
perl-URPM-4e8bd2468f5472806ee66bd917ed6d18dadee91f.tar.gz
perl-URPM-4e8bd2468f5472806ee66bd917ed6d18dadee91f.tar.bz2
perl-URPM-4e8bd2468f5472806ee66bd917ed6d18dadee91f.tar.xz
perl-URPM-4e8bd2468f5472806ee66bd917ed6d18dadee91f.zip
added clever cache header management during build of hdlist.
removed no_flag_update obsoleted.
Diffstat (limited to 'URPM')
-rw-r--r--URPM/Build.pm16
-rw-r--r--URPM/Resolve.pm4
2 files changed, 12 insertions, 8 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm
index 18a02d6..d4921f2 100644
--- a/URPM/Build.pm
+++ b/URPM/Build.pm
@@ -26,8 +26,12 @@ sub parse_rpms_build_headers {
unless ($options{clean}) {
opendir DIR, $dir;
while (my $file = readdir DIR) {
- $file =~ /(.+?-[^:\-]+-[^:\-]+\.[^:\-\.]+)(?::(\S+))?$/ or next;
- $cache{$2 || $1} = $file;
+ my ($fullname, $filename) = $file =~ /(.+?-[^:\-]+-[^:\-]+\.[^:\-\.]+)(?::(\S+))?$/ or next;
+ my @stat = stat "$dir/$_";
+ $cache{$filename || $fullname} = { file => $file,
+ size => $stat[7],
+ time => $stat[9],
+ };
}
closedir DIR;
}
@@ -36,12 +40,12 @@ sub parse_rpms_build_headers {
my ($key) = m!([^/]*)\.rpm$! or next; #- get rpm filename.
my ($id, $filename);
- if ($cache{$key} && -s "$dir/$cache{$key}") {
- ($id, undef) = $urpm->parse_hdlist("$dir/$cache{$key}", !$options{callback});
- defined $id or die "bad header $dir/$cache{$key}\n";
+ if ($cache{$key} && $cache{$key}{time} > 0 && $cache{$key}{time} >= (stat $_)[9]) {
+ ($id, undef) = $urpm->parse_hdlist("$dir/$cache{$key}{file}", !$options{callback});
+ defined $id or die "bad header $dir/$cache{$key}{file}\n";
$options{callback} and $options{callback}->($urpm, $id, %options);
- $filename = $cache{$key};
+ $filename = $cache{$key}{file};
} else {
($id, undef) = $urpm->parse_rpm($_);
defined $id or die "bad rpm $_\n";
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 8b68932..a8489f6 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -383,7 +383,7 @@ sub resolve_requested {
next; #- always redo according to choices.
}
- #- now do the realy work, select the package.
+ #- now do the real work, select the package.
my ($pkg) = @chosen;
!$pkg || $pkg->flag_selected || exists $state->{selected}{$pkg->id} and next;
@@ -427,7 +427,7 @@ sub resolve_requested {
exists $dep->{from} ? (from => $dep->{from}) : @{[]},
};
- $options{no_flag_update} or $pkg->set_flag_required;
+ $pkg->set_flag_required;
#- check if package is not already installed before trying to use it, compute
#- obsoleted package too. this is valable only for non source package.