aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-03-31 14:42:26 +0000
committerFlorent Villard <warly@mandriva.com>2006-03-31 14:42:26 +0000
commitbefe8d625f6900d3c992faeb7cd16c4152eb2629 (patch)
treecce10ec46c3ed25eca37233e30f38dad64305918
parent275abdcc960d12efb338d298913b25ec7fea85ce (diff)
downloadiurt-befe8d625f6900d3c992faeb7cd16c4152eb2629.tar
iurt-befe8d625f6900d3c992faeb7cd16c4152eb2629.tar.gz
iurt-befe8d625f6900d3c992faeb7cd16c4152eb2629.tar.bz2
iurt-befe8d625f6900d3c992faeb7cd16c4152eb2629.tar.xz
iurt-befe8d625f6900d3c992faeb7cd16c4152eb2629.zip
split cache by media too
-rwxr-xr-xiurt218
1 files changed, 12 insertions, 6 deletions
diff --git a/iurt2 b/iurt2
index 676156a..69e9379 100755
--- a/iurt2
+++ b/iurt2
@@ -247,7 +247,7 @@ if ($run{distro} ne 'cooker') {
if (!$run{debug} && $run{media} || $run{chroot}) {
$run{pidfile_home} = "$config->{cache_home}/";
- $run{pidfile} = "iurt.$run{distro_tag}.$run{my_arch}";
+ $run{pidfile} = "iurt.$run{distro_tag}.$run{my_arch}.$run{media}";
check_pid(\%run)
}
@@ -258,7 +258,7 @@ if ($run{chroot}) {
check_chroot($chroot, $chroot_tar, \%run)
}
-my $cachefile = "$config->{cache_home}/iurt.$run{distro_tag}.$run{my_arch}.cache";
+my $cachefile = "$config->{cache_home}/iurt.$run{distro_tag}.$run{my_arch}.$run{media}.cache";
$run{cachefile} = $cachefile;
my $cache;
my $clear_cache = 1;
@@ -269,13 +269,13 @@ if (-f $cachefile && $run{use_cache}) {
opendir my $cache_dir, $config->{cache_home};
my $to_load;
foreach my $file (readdir $cache_dir) {
- (my $date) = $file =~ /iurt\.$run{distro_tag}\.$run{my_arch}\.cache\.tmp\.(\d{8})/ or next;
+ (my $date) = $file =~ /iurt\.$run{distro_tag}\.$run{my_arch}\.$run{media}\.cache\.tmp\.(\d{8})/ or next;
if ($date > $to_load && -s "$config->{cache_home}/$file" > $config->{cache_min_size}) {
$to_load = $date;
$cachefile = "$config->{cache_home}/$file"
}
}
- print "To load: $to_load\n";
+ print {$run{LOG}} "iurt: loading alternate cache file $cachefile\n";
$cache = do $cachefile or print "FATAL iurt: could not load cache $cachefile ($!)\n"
}
$clear_cache = 0 if $cache
@@ -1049,8 +1049,14 @@ sub check_pid {
my $pid = <$test_PID>;
my (@stat) = stat $pf;
my $time = $stat[9];
- print {$run->{LOG}} "iurt: an other iurt is running for $run->{my_arch} on $pid_host, pid $pid, since ",time - $time," seconds\n";
- exit
+ my $diff = time - $time;
+ my $msg = "iurt: an other iurt is running for $run->{my_arch} on $pid_host, pid $pid, since $diff seconds";
+ if ($diff < 36000) {
+ print {$run->{LOG}} "$msg\n";
+ exit
+ } else {
+ print {$run->{LOG}} "$msg, ignoring it\n"
+ }
}
}
$run->{pidfile} .= ".pid";