diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Emi.pm | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Iurt/Emi.pm b/lib/Iurt/Emi.pm index 1222ca0..3b7ce5a 100644 --- a/lib/Iurt/Emi.pm +++ b/lib/Iurt/Emi.pm @@ -106,6 +106,18 @@ sub find_prefixes_ready_to_upload { return %targets; } +sub generate_upload_command { + my ($config, $prefix, $media, $target, $user, $packages, $finish, $youri_file) = @_; + # Most of this function should be in the config... + my $base_command = "/usr/bin/perl -I/usr/share/mga-youri-submit/lib /usr/share/mga-youri-submit/bin/youri-submit --config /etc/youri/submit-upload.conf"; + my $all_posts = `$base_command --list posts $target`; + $all_posts =~ s/\n/ /g; + $all_posts =~ s/(^| +)/ --skip-post /g; + $all_posts =~ s/--skip-post *$//; + my $skip = $finish ? "" : $all_posts; + "$base_command --verbose --define user=$user --define prefix=$prefix --define section=$media $skip $target @$packages &> $youri_file"; +} + sub upload_prefix_in_media { my ($config, $pkg_tree, $prefix, $media, $o_finish) = @_; @@ -143,13 +155,7 @@ sub upload_prefix_in_media { $user ||= $config->{upload_user}; - my $base_command = "/usr/bin/perl -I/usr/share/mga-youri-submit/lib /usr/share/mga-youri-submit/bin/youri-submit --config /etc/youri/submit-upload.conf"; - my $all_posts = `$base_command --list posts $target`; - $all_posts =~ s/\n/ /g; - $all_posts =~ s/(^| +)/ --skip-post /g; - $all_posts =~ s/--skip-post *$//; - my $skip = $o_finish ? "" : $all_posts; - my $command = "$base_command --verbose --define user=$user --define prefix=$prefix --define section=$media $skip $target @packages &> $done$path/$youri_file"; + my $command = generate_upload_command($config, $prefix, $media, $target, $user, \@packages, $o_finish, "$done$path/$youri_file"); plog('DEBUG', "running $command"); if (!system($command)) { plog('INFO', "upload succeeded"); |