aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Emi.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Iurt/Emi.pm')
-rw-r--r--lib/Iurt/Emi.pm39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/Iurt/Emi.pm b/lib/Iurt/Emi.pm
index cce3aed..1bf595c 100644
--- a/lib/Iurt/Emi.pm
+++ b/lib/Iurt/Emi.pm
@@ -91,24 +91,25 @@ sub find_prefixes_ready_to_upload {
}
sub upload_prefix_in_media {
- my ($config, %pkg_tree, $prefix, $media, $o_finish) = @_;
+ my ($config, $pkg_tree, $prefix, $media, $o_finish) = @_;
+
my $todo = "$config->{queue}/todo";
my $done = "$config->{queue}/done";
my $reject = "$config->{queue}/rejected";
my (@packages, @duplicate_packages);
my ($user) = $prefix =~ /\d{14}\.(\w+)\.\w+\.\d+$/;
- my $target = $pkg_tree{$prefix}{target};
+ my $target = $pkg_tree->{$prefix}{target};
my $youri_file = "$prefix.youri";
- if ($pkg_tree{$prefix}{media}{$media}{uploaded}) {
+ if ($pkg_tree->{$prefix}{media}{$media}{uploaded}) {
$youri_file .= "." . time();
}
- my $path = $pkg_tree{$prefix}{media}{$media}{path};
+ my $path = $pkg_tree->{$prefix}{media}{$media}{path};
plog('OK', "all mandatory archs done: $prefix");
- foreach my $rpm (@{$pkg_tree{$prefix}{media}{$media}{rpms}}) {
- my $rpmpath = "$done/$path/${prefix}_$rpm";
- if ($pkg_tree{$prefix}{media}{$media}{uploaded}) {
+ foreach my $rpm (@{$pkg_tree->{$prefix}{media}{$media}{rpms}}) {
+ my $rpmpath = "$done$path/${prefix}_$rpm";
+ if ($pkg_tree->{$prefix}{media}{$media}{uploaded}) {
# if already uploaded for mandatory arches, do not try to upload again src or noarch packages
# but still remember these duplicate files for removal
if (my ($type) = $rpm =~ /\.(noarch|src)\.rpm$/) {
@@ -124,23 +125,23 @@ sub upload_prefix_in_media {
$user ||= $config->{upload_user};
# FIXME we want to skip all post, we should not hardcode them here
my $skip = $o_finish ? "" : "--skip-post genhdlist2 --skip-post mirror --skip-post clean_rpmsrate";
- my $command = "/usr/bin/perl -I/usr/share/mga-youri-submit/lib /usr/share/mga-youri-submit/bin/youri-submit --verbose --config /etc/youri/submit-upload.conf --define user=$user --define prefix=$prefix --define section=$media $skip $target @packages &> $done/$path/$youri_file";
+ my $command = "/usr/bin/perl -I/usr/share/mga-youri-submit/lib /usr/share/mga-youri-submit/bin/youri-submit --verbose --config /etc/youri/submit-upload.conf --define user=$user --define prefix=$prefix --define section=$media $skip $target @packages &> $done$path/$youri_file";
plog('DEBUG', "running $command");
if (!system($command)) {
plog('INFO', "upload succeeded");
} else {
# should send a mail or something
- plog('ERROR', "upload failed ($!), rejecting files in $reject/$path/");
- make_path("$reject/$path");
- foreach my $rpm (@{$pkg_tree{$prefix}{media}{$media}{rpms}}) {
- link("$done/$path/${prefix}_$rpm", "$reject/$path/${prefix}_$rpm") or plog('ERROR', "ERROR: link of $rpm failed ($!)");
+ plog('ERROR', "upload failed ($!), rejecting files in $reject$path/");
+ make_path("$reject$path");
+ foreach my $rpm (@{$pkg_tree->{$prefix}{media}{$media}{rpms}}) {
+ link("$done$path/${prefix}_$rpm", "$reject$path/${prefix}_$rpm") or plog('ERROR', "ERROR: link of $rpm failed ($!)");
}
- link("$done/$path/$youri_file", "$reject/$path/$youri_file");
+ link("$done$path/$youri_file", "$reject$path/$youri_file");
my ($user) = $prefix =~ /\d{14}\.(\w+)\.\w+\.\d+/;
if ($user) {
- my @pkgs = grep { !/src\.rpm$/ } @{$pkg_tree{$prefix}{media}{$media}{rpms}};
+ my @pkgs = grep { !/src\.rpm$/ } @{$pkg_tree->{$prefix}{media}{$media}{rpms}};
my $text = join("\n", qq(The upload of the following packages failed:\n), map { "- $_" } @pkgs) . "\n";
my $rpms = join(' ', @pkgs, undef);
my $to = get_author_email($user) || "Unknown <$config->{admin}>";
@@ -157,20 +158,20 @@ sub upload_prefix_in_media {
# unlink the sources rpm unless some non mandatory arch still need to be done
my $all_done = 1;
- if (!defined($pkg_tree{$prefix}{media}{$media}{arch}{noarch})) {
+ if (!defined($pkg_tree->{$prefix}{media}{$media}{arch}{noarch})) {
my $arch_list = find { ref($_) eq 'ARRAY' } $config->{arch}, (ref($config->{arch}) eq 'HASH' ? ($config->{arch}{$target}, $config->{arch}{default}) : ());
my @arch_list = $arch_list ? @$arch_list : keys %{$config->{bot}};
# If we are here, mandatory arches are done, no need to check them
my $mandatory_arch = get_mandatory_arch($config, $target);
foreach my $arch (difference2(\@arch_list, $mandatory_arch)) {
- next if $pkg_tree{$prefix}{media}{$media}{arch}{$arch};
+ next if $pkg_tree->{$prefix}{media}{$media}{arch}{$arch};
$all_done = 0;
}
}
if ($all_done) {
- foreach (@{$pkg_tree{$prefix}{srpms}}) {
- plog('DEBUG', "unlink $todo/$path/${prefix}_$_");
- unlink("$todo/$path/${prefix}_$_");
+ foreach (@{$pkg_tree->{$prefix}{srpms}}) {
+ plog('DEBUG', "unlink $todo$path/${prefix}_$_");
+ unlink("$todo$path/${prefix}_$_");
}
}
}