aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Config.pm
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 /lib/Iurt/Config.pm
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 'lib/Iurt/Config.pm')
-rw-r--r--lib/Iurt/Config.pm85
1 files changed, 0 insertions, 85 deletions
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 =~ /(.*)-[^-]+-[^-]+\.[^.]+$/;