aboutsummaryrefslogtreecommitdiffstats
path: root/iurt
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2012-12-10 20:50:42 +0000
committerPascal Terjan <pterjan@mageia.org>2012-12-10 20:50:42 +0000
commitc24757c923841de1901501b227d1411eafefc4e4 (patch)
tree61022c6dfb5831a6cdb7946544aef5cc0683416e /iurt
parent80a8c36ba24372b0dcf0b893228e72f7e69940fd (diff)
downloadiurt-c24757c923841de1901501b227d1411eafefc4e4.tar
iurt-c24757c923841de1901501b227d1411eafefc4e4.tar.gz
iurt-c24757c923841de1901501b227d1411eafefc4e4.tar.bz2
iurt-c24757c923841de1901501b227d1411eafefc4e4.tar.xz
iurt-c24757c923841de1901501b227d1411eafefc4e4.zip
Get rid of cache
Diffstat (limited to 'iurt')
-rwxr-xr-xiurt139
1 files changed, 31 insertions, 108 deletions
diff --git a/iurt b/iurt
index 0bfdbcb..0c361fb 100755
--- a/iurt
+++ b/iurt
@@ -33,7 +33,7 @@
use strict;
use RPM4::Header;
-use Iurt::Config qw(config_usage get_date get_prefix config_init dump_cache_par get_maint check_arch %arch_comp get_package_prefix);
+use Iurt::Config qw(config_usage get_date get_prefix config_init get_maint check_arch %arch_comp get_package_prefix);
use Data::Dumper;
use URPM;
use Iurt::DKMS;
@@ -91,10 +91,10 @@ $run{todo} = [];
#
# no_rsync, config_help and copy_srpm kept for compatibility reasons
#
- [ "", $program_name, 0, "[--cache] [--chrooted-urpmi <media prefix>] [--concurrent-run] [--config foo value] [--warn] [--verbose integer]
+ [ "", $program_name, 0, "[--chrooted-urpmi <media prefix>] [--config foo value] [--warn] [--verbose integer]
[--copy-srpm] [--debug] [--distro] [--no-rsync] [--clean user1 user2 user3] [--clean-all] [--shell] [--stop {p|c|i|l|b|a|s}]
[--use-system-distrib] [--dir] [--help foo?] [--log filename] [--group]
- [--upload [--markrelease] [--source]] [--dir] [--help foo?] [--log filename] [--status] [--ignore-failure]
+ [--upload [--markrelease] [--source]] [--dir] [--help foo?] [--log filename] [--status]
[--repository <distribution path>]
[--rpmmacros <macro definition> [<macro definition>...]]
{--config_help | --dkms {--media <media regexp>}
@@ -137,9 +137,6 @@ $run{todo} = [];
[ "a", "arch", 1, "<architecture>",
"Set the architecture",
sub { ($run{my_arch}) = @_; 1 }, "Setting architecture" ],
- [ "", "cache", 0, "",
- "Use the global cache file",
- sub { $run{use_cache} = 1 }, "Activating cache use" ],
[ "", "copy-srpm", 0, "",
"Copy also the regenerated SRPM",
sub { $run{copy_srpm} = 1 }, "Activating the copy_srpm mode" ],
@@ -170,9 +167,6 @@ $run{todo} = [];
[ "", "clean", -1, "<user 1> <user 2> ... <user n>",
"Clean remaining chroot before runing",
sub { $run{clean} = \@_ }, "Activating clean chroot flag" ],
- [ "", "concurrent-run", 0, "",
- "Allow several iurt to run on different machines (slower)",
- sub { $run{concurrent_run} = 1 }, "Activating concurrent run checks" ],
[ "", "parallel", 1, "<n>",
"Build up to <n> packages in parallel",
sub {($run{parallel}) = @_; 1}, "Enabling parallel build" ],
@@ -194,9 +188,6 @@ $run{todo} = [];
[ "g", "group", 0, "",
"Activate group mode, packages will be compiled as a global set, not as individual packages",
sub { $run{group} = 1 }, "Activating the group mode" ],
- [ "", "ignore-failure", 0, "",
- "Do not take into account the failure cache, try to recompile all the packages not synchronized",
- sub { $run{ignore_failure} = 1 }, "Activating the mode ignoring previous failure" ],
[ "l", "log", 1, "<log file>",
"Log file.",
sub {
@@ -454,14 +445,10 @@ my %config_usage = (
default => 300,
},
},
- cache_home => {
- desc => 'Where to store the cache files',
+ pidfile_home => {
+ desc => 'Where to store the pidfile files',
default => "$HOME/.bugs"
},
- cache_min_size => {
- desc => 'Minimal size to consider a cache file valid',
- default => 1000000
- },
check_binary_file => {
desc => 'Packages rebuild should be checked, however sometime rpm is segfaulting and the test is not correct',
default => 0
@@ -598,14 +585,9 @@ if (!$lock && $run{dkms}) {
}
$run{lock} = $lock;
-# cache file name is needed early to remove the manual lock file if the
-# lock mechanism does not work
-
-mkpath $config->{cache_home};
-my $cachefile = "$config->{cache_home}/iurt.$run{distro_tag}.$run{my_arch}.$lock.cache";
-$run{cachefile} = $cachefile;
if (!$run{debug} && $run{media} || $run{chroot}) {
- $run{pidfile_home} = "$config->{cache_home}/";
+ $run{pidfile_home} = $config->{pidfile_home};
+ mkpath $run{pidfile_home};
$run{pidfile} = "iurt.$run{distro_tag}.$run{my_arch}.$lock";
check_pid(\%run);
}
@@ -630,43 +612,13 @@ if (!-d "$local_spool/log") {
}
$run{local_spool} = $local_spool;
-my $cache;
-my $clear_cache = 1;
-if (-f $cachefile && $run{use_cache}) {
- plog('INFO', "loading cache file $cachefile");
-
- $cache = eval(cat_($cachefile))
- or plog('ERROR', "FATAL: could not load cache $cachefile ($!)");
-
- if (!$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}\.$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";
- }
- }
-
- plog('NOTIFY', "loading alternate cache file $cachefile");
- $cache = eval(cat_($cachefile))
- or plog('ERROR', "FATAL: could not load cache $cachefile ($!)");
- }
- $clear_cache = 0 if $cache;
-}
-
-if ($clear_cache) {
- $cache = {
- rpm_srpm => {},
- failure => {},
- queue => {},
- warning => {},
- run => 1,
- needed => {},
- };
-}
+my $cache = {
+ rpm_srpm => {},
+ queue => {},
+ warning => {},
+ run => 1,
+ needed => {},
+};
$run{cache} = $cache;
my (%srpm_version, @wrong_rpm, %provides, %pack_provide, $to_compile, %maint);
@@ -683,18 +635,10 @@ if ($run{dkms}) {
}
$run{to_compile} = $to_compile;
-dump_cache_par(\%run);
-
plog("Packages to build: $to_compile");
my ($fulldate, $daydate) = get_date();
-if ($run{use_cache}) {
- $run{run} = $cache->{run};
- $run{run} ||= 1;
- $cache->{run} = $run{run} + 1;
-} else {
- $run{run} = "0.$fulldate";
-}
+$run{run} = "0.$fulldate";
$run{daydate} = $daydate;
plog('DEBUG', "using $run{run} as chroot extension");
$run{user} ||= $ENV{USER};
@@ -803,8 +747,6 @@ if ($run{dkms} && $run{dkms_todo}) {
# FIXME: (tv) kill this dead code or use it!!
my $_s = sub {
if ($run{main}) {
- plog("dumping cache...");
- dump_cache_par(\%run);
$Data::Dumper::Indent = 0;
$Data::Dumper::Terse = 1;
plog("Running environment:\n", Data::Dumper->Dump([\%run]), "\n");
@@ -831,18 +773,12 @@ sub rebuild_one {
plog('NOTIFY', "Build package $srpm [$done/$to_compile]");
# When rebuilding all the media, src.rpm can be removed from mirror before we work on them
unless (-f "$dir/$srpm") {
- $cache->{failure}{$srpm} = 1;
$run{status}{$srpm} = 'missing';
return;
}
# FIXME unfortunately urpmi stalls quite often
my $retry = 0;
- # current rpm is sometime segfaulting, and iurt is them blocked
- # and cannot
- #
- # $cache->{failure}{$srpm} = 1;
- # dump_cache(\%run);
retry:
$urpmi->clean_urpmi_process;
@@ -888,7 +824,6 @@ retry:
# This should eliminate bouncers that block the input queue
#
$srpm = $old_srpm;
- $cache->{failure}{$srpm} = 1;
$run{status}{$srpm} = 'recreate_srpm_failure';
return;
}
@@ -986,7 +921,6 @@ retry:
},
freq => 1)) {
- $cache->{failure}{$srpm} = 1;
$run{status}{$srpm} = 'build_failure';
return;
}
@@ -1015,7 +949,6 @@ retry:
}
$run{status}{$srpm} = 'ok';
- delete $cache->{failure}{$srpm} if defined $cache->{failure}{$srpm};
if ($run{debug}) {
plog("debug mode, skip other packages");
exit();
@@ -1086,7 +1019,6 @@ do {
} elsif ($pid == 0) { #child
$chroot_tmp .= "_" . int($i);
rebuild_one($dir, $srpm, $status);
- dump_cache_par(\%run);
dump_status($local_spool, \%run);
exit;
} else {
@@ -1094,7 +1026,6 @@ do {
}
} else {
rebuild_one($dir, $srpm, $status);
- dump_cache_par(\%run);
dump_status($local_spool, \%run);
}
}
@@ -1135,8 +1066,6 @@ if (!$run{debug} && !$run{use_old_chroot}) {
plog("reprocess generated packages queue");
process_queue($config, \%run, \@wrong_rpm);
-dump_cache_par(\%run);
-
plog('FAIL', "ERROR: RPM with a wrong SRPM name") if @wrong_rpm;
if (@wrong_rpm && open my $file, ">$local_spool/log/wrong_srpm_names.log") {
foreach (@wrong_rpm) {
@@ -1268,24 +1197,22 @@ sub check_pid {
close $lock2;
}
}
- if (!$run->{concurrent_run}) {
- opendir my $dir, $run->{pidfile_home};
- foreach my $f (readdir $dir) {
- my ($pid_host) = $f =~ /$pidfile\.pid\.(.*)\.pid$/ or next;
- if ($pid_host ne $hostname) {
- my $pf = "$run->{pidfile_home}/$f";
- open my $test_PID, $pf;
- my $pid = <$test_PID>;
- my (@stat) = stat $pf;
- my $time = $stat[9];
- my $diff = time()-$time;
- my $msg = "$program_name: an other iurt is running for $run->{my_arch} on $pid_host, pid $pid, since $diff seconds";
- if ($diff < 36000) {
- plog("$msg\n");
- exit();
- } else {
- plog("$msg, ignoring it");
- }
+ opendir my $dir, $run->{pidfile_home};
+ foreach my $f (readdir $dir) {
+ my ($pid_host) = $f =~ /$pidfile\.pid\.(.*)\.pid$/ or next;
+ if ($pid_host ne $hostname) {
+ my $pf = "$run->{pidfile_home}/$f";
+ open my $test_PID, $pf;
+ my $pid = <$test_PID>;
+ my (@stat) = stat $pf;
+ my $time = $stat[9];
+ my $diff = time()-$time;
+ my $msg = "$program_name: an other iurt is running for $run->{my_arch} on $pid_host, pid $pid, since $diff seconds";
+ if ($diff < 36000) {
+ plog("$msg\n");
+ exit();
+ } else {
+ plog("$msg, ignoring it");
}
}
}
@@ -1411,10 +1338,6 @@ sub search_packages {
if ($config->{unwanted_packages} && $srpm =~ /$config->{unwanted_packages}/) { next }
my $ok = 1;
if (check_version($run, $srpm, $srpm_version)) {
- if (!$run->{ignore_failure} && defined $cache->{failure}{$srpm}) {
- $run->{status}{$srpm} = 'build_failure';
- next;
- }
my $check_needed = check_needed($srpm, $cache, $provides);
$run->{status}{$srpm} = 'missing_buildrequires' if !$check_needed;
-f "$dir/$srpm" or next;