diff options
Diffstat (limited to 'lib/Iurt')
-rw-r--r-- | lib/Iurt/Chroot.pm | 1 | ||||
-rw-r--r-- | lib/Iurt/Config.pm | 85 | ||||
-rw-r--r-- | lib/Iurt/DKMS.pm | 5 | ||||
-rw-r--r-- | lib/Iurt/Process.pm | 2 | ||||
-rw-r--r-- | lib/Iurt/Urpmi.pm | 5 |
5 files changed, 3 insertions, 95 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 3995d21..447ef23 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -5,7 +5,6 @@ use base qw(Exporter); use MDV::Distribconf::Build; use MDK::Common; use Iurt::Process qw(sudo); -use Iurt::Config qw(dump_cache_par); use Iurt::Util qw(plog); # perl_checker: use Iurt::Urpmi use File::Temp 'mktemp'; diff --git a/lib/Iurt/Config.pm b/lib/Iurt/Config.pm index 173ed9e..c793cba 100644 --- a/lib/Iurt/Config.pm +++ b/lib/Iurt/Config.pm @@ -13,8 +13,6 @@ our @EXPORT = qw( config_usage config_init get_date - dump_cache - dump_cache_par get_maint get_date get_prefix @@ -123,89 +121,6 @@ sub get_package_prefix { "$prefix1$prefix2"; } -=head2 dump_cache($run, $config) - -Create a string based on the current date and time -I<%run> is the current running options -Dump the cache - -=cut - -sub dump_cache { - my ($run) = @_; - my $program_name = $run->{program_name}; - my $filename = $run->{cachefile}; - my $cache = $run->{cache}; - my $daydate = $run->{daydate}; - open my $file, ">$filename.tmp.$daydate" or die "FATAL $program_name dump_cache: cannot open $filename.tmp"; - $Data::Dumper::Indent = 1; - $Data::Dumper::Terse = 1; - print $file Data::Dumper->Dump([ $cache ], [ "cache" ]); - # flock does not work on network files and lockf seems to fail too - plog('DEBUG', "locking to dump the cache in $filename"); - if (-f "$filename.lock") { - plog('ERROR', 'ERROR: manual file lock exist, do not save the cache'); - } else { - open my $lock, ">$filename.lock"; - print $lock $$; - close $lock; - unlink $filename; - link "$filename.tmp.$daydate", $filename; - unlink "$filename.lock"; - } -} - -# FIXME need to merge with the simpler dump_cache -sub dump_cache_par { - my ($run) = @_; - my $filename = $run->{cachefile}; - my $cache = $run->{cache}; - my $daydate = $run->{daydate}; - - # Right now there are no mechanism of concurrent access/write to the cache. There is - # on global lock for one iurt session. A finer cache access would allow several iurt running - # but the idea is more to have a global parrallel build than several local ones. - return if $run->{debug} || !$run->{use_cache}; - open my $file, ">$filename.tmp.$daydate" or die "FATAL iurt dump_cache: cannot open $filename.tmp"; - if ($run->{concurrent_run}) { - plog('DEBUG', "merging cache"); - my $old_cache; - if (-f $filename) { - plog('DEBUG', "loading cache file $filename"); - $old_cache = eval(cat_($filename)); - - foreach my $k ('rpm_srpm', 'failure', 'queue', 'needed', 'warning', 'buildrequires') { - foreach my $rpm (%{$old_cache->{$k}}) { - $cache->{$k}{$rpm} ||= $old_cache->{$k}{$rpm}; - } - } - } - # $cache = { rpm_srpm => {}, failure => {}, queue => {}, warning => {}, run => 1, needed => {} } - } - $Data::Dumper::Indent = 1; - $Data::Dumper::Terse = 1; - print $file Data::Dumper->Dump([ $cache ], [ "cache" ]); - # flock does not work on network files and lockf seems to fail too - my $status = 1; #File::lockf::lock($file); - if (!$status) { - unlink $filename; - link "$filename.tmp.$daydate", $filename; - File::lockf::ulock($file); - } else { - plog('WARN', "WARNING: locking the cache file $filename failed (status $status $!), try to lock manually"); - if (-f "$filename.lock") { - plog('ERROR', "ERROR: manual file lock exist, do not save the cache"); - } else { - open my $lock, ">$filename.lock"; - print $lock $$; - close $lock; - unlink $filename; - link "$filename.tmp.$daydate", $filename; - unlink "$filename.lock"; - } - } -} - sub get_maint { my ($run, $srpm) = @_; my ($srpm_name) = $srpm =~ /(.*)-[^-]+-[^-]+\.[^.]+$/; diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm index 82bcdc3..d7d6d2f 100644 --- a/lib/Iurt/DKMS.pm +++ b/lib/Iurt/DKMS.pm @@ -4,7 +4,7 @@ use strict; use base qw(Exporter); use MDV::Distribconf::Build; use Iurt::Chroot qw(clean_and_build_chroot add_local_user dump_rpmmacros); -use Iurt::Config qw(get_maint get_prefix dump_cache); +use Iurt::Config qw(get_maint get_prefix); use Iurt::Mail qw(sendmail); use File::NCopy qw(copy); use Iurt::Process qw(sudo); @@ -120,7 +120,7 @@ sub search_dkms { foreach my $k (@kernel) { my ($kernel, $modulesdir) = @$k; plog("checking $realmodule-kernel-$modulesdir-$realversion"); - next if $cache->{dkms}{"$realmodule-kernel-$modulesdir-$realversion"} && !$run->{ignore_failure}; + next if $cache->{dkms}{"$realmodule-kernel-$modulesdir-$realversion"}; if (!$modules{$realmodule}{$realversion}{$modulesdir}) { my (@choices); if (my ($prefix, $v) = $kernel =~ /^(.*?-?)(2\..*)/) { @@ -293,7 +293,6 @@ sub dkms_compile { process_dkms_queue($self, 0, 0, $media, "$dkms_spool/$media"); # compile dkms modules } - dump_cache($run); $done; } # FIXME will replace the iurt process_qeue when youri-queue is active diff --git a/lib/Iurt/Process.pm b/lib/Iurt/Process.pm index d05e4c4..66b604f 100644 --- a/lib/Iurt/Process.pm +++ b/lib/Iurt/Process.pm @@ -5,7 +5,6 @@ use base qw(Exporter); use MDK::Common; use Filesys::Df qw(df); use Iurt::Mail qw(sendmail); -use Iurt::Config qw(dump_cache_par); use Iurt::Util qw(plog); use POSIX ":sys_wait_h"; use Sys::Load qw(getload); @@ -161,7 +160,6 @@ sub handle_command_error { plog('INFO', "--------------- end of command output ---------------"); if ($opt{die}) { - dump_cache_par($run); die "FATAL: $opt{error}."; } } diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index 96c9d96..8ecee8c 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -7,7 +7,7 @@ use File::NCopy qw(copy); use MDV::Distribconf::Build; use Iurt::Chroot qw(add_local_user create_temp_chroot); use Iurt::Process qw(perform_command clean_process sudo); -use Iurt::Config qw(dump_cache_par get_maint get_package_prefix); +use Iurt::Config qw(get_maint get_package_prefix); use Iurt::Util qw(plog); use urpm; @@ -404,7 +404,6 @@ sub install_packages_old { wait_regexp => { 'database locked' => \&wait_urpmi }, error_regexp => 'unable to access', log => $log_spool)) { - $cache->{failure}{$srpm} = 1; $run->{status}{$srpm} = 'binary_test_failure'; return 0; } @@ -541,7 +540,6 @@ sub install_packages { )) { plog('DEBUG', "urpmi command failed."); if (!clean_process("$self->{urpmi_command} @to_install")) { - dump_cache_par($run); die "FATAL $program_name: Could not have urpmi working !"; } $ok = 0; @@ -565,7 +563,6 @@ sub clean_urpmi_process { if (!$run->{chrooted_urpmi}) { my $match = $self->{urpmi_command} or return; if (!clean_process($match)) { - dump_cache_par($run); die "FATAL $program_name: Could not have urpmi working !"; } } |