aboutsummaryrefslogtreecommitdiffstats
path: root/ulri
diff options
context:
space:
mode:
Diffstat (limited to 'ulri')
-rwxr-xr-xulri99
1 files changed, 6 insertions, 93 deletions
diff --git a/ulri b/ulri
index b662232..5fb309d 100755
--- a/ulri
+++ b/ulri
@@ -35,7 +35,7 @@ use strict;
use MDK::Common qw(any cat_ if_ find);
use Iurt::Config qw(config_usage get_date config_init get_author_email check_arch check_noarch);
use Iurt::Process qw(check_pid);
-use Iurt::File qw(check_upload_tree cleanup_failed_build);
+use Iurt::File qw(cleanup_failed_build get_upload_tree_state);
use Iurt::Mail qw(sendmail);
use Iurt::Util qw(plog_init plog ssh_setup ssh sout sget sput);
use File::Copy 'move';
@@ -204,8 +204,6 @@ if ($df->{per} == 100) {
($fulldate, $daydate) = get_date();
-my %pkg_tree;
-
my $todo = "$config->{queue}/todo";
my $failure = "$config->{queue}/failure";
my $done = "$config->{queue}/done";
@@ -219,78 +217,7 @@ plog('MSG', "check uploads tree");
plog('DEBUG', "input queue is $todo");
-sub todo_func {
- my ($todo, $f, $m, $s, $r) = @_;
-
- my $media = "$m/$s";
-
- if ($r =~ /(\d{14}\.(\w+)\.\w+\.\d+)_(.*\.src\.rpm)$/) {
- my ($prefix, $user, $srpm) = ($1, $2, $3);
-
- plog('DEBUG', "found srpm $srpm ($prefix)");
- $pkg_tree{$prefix}{media}{$media}{path} = "/$f/$m/$s";
- $pkg_tree{$prefix}{target} = $f;
- $pkg_tree{$prefix}{user} = $user;
- push @{$pkg_tree{$prefix}{srpms}} , $srpm;
- my ($name) = $srpm =~ /(.*)-[^-]+-[^-]+\.src\.rpm$/;
-
- return $pkg_tree{$prefix}{srpm_name}{$name} = $srpm;
- }
-
- if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_([\w-]+)\.(\w+)\.(\w+)\.(\d{14})\.(\d+)\.lock$/) {
- my ($prefix, $arch, $bot, $host, $date, $pid) = ($1, $2, $3, $4, $5, $6);
-
- # Set path here too has we may have a lock without the src.rpm
- $pkg_tree{$prefix}{media}{$media}{path} = "/$f/$m/$s";
-
- $arch = $config->{arch_translation}{$arch} if $config->{arch_translation}{$arch};
- plog('DEBUG', "found lock on $host/$arch for $prefix");
-
- if ($arch =~ /noarch/) {
- plog('DEBUG', "... and $prefix is noarch");
- $pkg_tree{$prefix}{media}{$media}{arch}{noarch} = 1;
- $arch =~ s/-.*//;
- }
-
- # this should be in the cache, but waiting for a cache-clean option
- $pkg_tree{$prefix}{media}{$media}{arch}{$arch} = 1;
-
- my $time = read_line("$todo/$f/$m/$s/$r");
- $time = (split ' ', $time)[2];
- push @{$pkg_tree{$prefix}{media}{$media}{bot}}, {
- bot => $bot,
- host => $host,
- date => $date,
- pid => $pid,
- 'arch' => $arch,
- 'time' => $time
- };
- }
-
- if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_.*\.deps$/) {
- my $prefix = $1;
- my @deps = map { chomp(); $_ } cat_("$todo/$f/$m/$s/$r");
- plog('DEBUG', "Adding dependency $_ ($prefix)") foreach @deps;
-
- $pkg_tree{$prefix}{deps} = \@deps;
- }
-}
-
-sub done_func {
- my ($_todo, $_f, $m, $s, $r) = @_;
-
- my $media = "$m/$s";
-
- if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*)\.(done|fail|excluded)$/) {
- my ($prefix, $arch) = ($1, $2);
- $arch = $config->{arch_translation}{$arch} if $config->{arch_translation}{$arch};
- $pkg_tree{$prefix}{media}{$media}{arch}{$arch} = 1;
- } elsif ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*\.([^.]+)\.rpm)$/) {
- my ($prefix, $rpm) = ($1, $2);
- plog('DEBUG', "found already built rpm $rpm ($prefix)");
- push @{$pkg_tree{$prefix}{rpms}} , $rpm;
- }
-}
+my %pkg_tree = get_upload_tree_state($config);
sub exclude_machine {
my ($config, $host) = @_;
@@ -300,15 +227,8 @@ sub exclude_machine {
}
}
-check_upload_tree($todo, \&todo_func);
-
-# getting already compiled packages
-# The cache should not be needed if the .done file are removed as the same
-# time as the src.rpm in the todo tree
-check_upload_tree($done, \&done_func);
-
# Load bot status
-
+#
foreach my $prefix (keys %pkg_tree) {
my $ent = $pkg_tree{$prefix};
foreach my $media (keys %{$ent->{media}}) {
@@ -586,9 +506,10 @@ foreach my $prefix (sort keys %pkg_tree) {
foreach my $arch (@arch_list) {
# Skip this arch if package is already building as noarch or for this arch
- #
+ # or if it should not be built on this arch
next if $pkg_tree{$prefix}{media}{$media}{arch}{noarch};
next if $pkg_tree{$prefix}{media}{$media}{arch}{$arch};
+ next if $pkg_tree{$prefix}{media}{$media}{excluded_arch}{$arch};
# If all packages in a group are noarch, consider the entire group
# as noarch
@@ -603,6 +524,7 @@ foreach my $prefix (sort keys %pkg_tree) {
plog('WARN', "excluding from $arch: $excluded");
create_file("$done_dir/${prefix}_$arch.excluded",
"ulri $arch excluded");
+ $pkg_tree{$prefix}{media}{$media}{excluded_arch}{$arch} = 1;
next;
}
@@ -830,15 +752,6 @@ sub create_file {
print $FILE "@contents";
}
-sub read_line {
- my $file = shift;
-
- open my $FILE, "<$file" or die "FATAL: can't open $file for reading";
- my $contents = <$FILE>;
-
- $contents;
-}
-
sub check_file_timeout {
my ($file, $time) = @_;