diff options
author | Francois Pons <fpons@mandriva.com> | 2003-06-05 08:47:13 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-06-05 08:47:13 +0000 |
commit | 4e8bd2468f5472806ee66bd917ed6d18dadee91f (patch) | |
tree | a1b70f8f43c797a5608608e5aa05a8ca8a837ffe /URPM/Build.pm | |
parent | 468c2daada584c066dcb1ee42e2f038f64242e7a (diff) | |
download | perl-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/Build.pm')
-rw-r--r-- | URPM/Build.pm | 16 |
1 files changed, 10 insertions, 6 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"; |