From 790d2219715e7a8026b4a18addbd08afb34ff51f Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Sun, 13 Aug 2006 14:54:46 +0000 Subject: call youri with the section defined; remove files when uploaded --- emi | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'emi') diff --git a/emi b/emi index 167ff51..2f69e38 100755 --- a/emi +++ b/emi @@ -93,6 +93,7 @@ check_upload_tree(\%run, $done, $pkg_tree{$prefix}{path} = "/$f/$m/$s"; $pkg_tree{$prefix}{arch}{$arch} = 1; $pkg_tree{$prefix}{target} = $f; + $pkg_tree{$prefix}{section} = "$m/$s"; push @{$pkg_tree{$prefix}{srpms}}, $rpm if ($arch eq 'src'); push @{$pkg_tree{$prefix}{rpms}} , $rpm; } elsif ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*)\.done$/) { @@ -106,6 +107,7 @@ foreach my $prefix (keys %pkg_tree) { my $ok = 1; my $target = $pkg_tree{$prefix}{target}; my $path = $pkg_tree{$prefix}{path}; + my $section = $pkg_tree{$prefix}{section}; print {$run{LOG}} "$program_name: processing $prefix in $path\n"; my %missing; foreach my $mandatory_arch (@{$config->{mandatory_arch}}, 'src') { @@ -124,9 +126,10 @@ foreach my $prefix (keys %pkg_tree) { foreach my $rpm (@{$pkg_tree{$prefix}{rpms}}) { push @packages, "$done/$path/${prefix}_$rpm" } - my $command = "/usr/bin/sudo -H -u $config->{upload_user} /usr/bin/perl -I/usr/local/lib/perl/ /usr/local/bin/youri-upload --verbose --test --config /etc/youri/upload-queue.conf --define user=$user,prefix=$prefix $target @packages &> $done/$path/$prefix.youri"; + my $command = "/usr/bin/sudo -H -u $config->{upload_user} /usr/bin/perl -I/usr/local/lib/perl/ /usr/local/bin/youri-upload --verbose --config /etc/youri/upload-queue.conf --define user=$user --define prefix=$prefix --define section=$section $target @packages &> $done/$path/$prefix.youri"; print {$run{LOG}} "$program_name: running $command\n"; if (!system($command)) { + # now check if we need to keep the current srpm in todo my $all_uploaded = 1; foreach my $arch (@{$config->{arch}}) { if (!$cache->{arch}{$prefix}{$arch}) { @@ -134,11 +137,11 @@ foreach my $prefix (keys %pkg_tree) { } } if ($all_uploaded) { - print {$run{LOG}} "Cleaning upload tree for $prefix\n" + print {$run{LOG}} "Cleaning upload tree for $prefix\n"; } } else { # should send a mail or something - print {$run{LOG}} "$program_name: upload failed, rejecting files in $reject/$path/\n"; + print {$run{LOG}} "$program_name: upload failed ($!), rejecting files in $reject/$path/\n"; foreach my $rpm (@{$pkg_tree{$prefix}{rpms}}) { my $err = link "$done/$path/${prefix}_$rpm", "$reject/$path/${prefix}_$rpm"; print {$run{LOG}} "ERROR $program_name: link of $rpm failed ($!)\n" @@ -146,6 +149,9 @@ foreach my $prefix (keys %pkg_tree) { link "$done/$path/$prefix.youri", "$reject/$path/$prefix.youri" # should delete the files } + # delete the files which should have heen either put in queue or rejected + unlink $_ foreach @packages; + unlink $done/$path/$prefix.youri } else { print {$run{LOG}} "WARNING $program_name: mandatory arch (", join(' ', keys %missing),") are missing for $prefix, waiting\n" } -- cgit v1.2.1