diff options
author | Pascal Terjan <pterjan@gmail.com> | 2016-12-31 12:26:20 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@gmail.com> | 2016-12-31 12:26:20 +0000 |
commit | dfedbb57f1e3e4bed00773b72ae7b2ae9e251353 (patch) | |
tree | 1424c44dcec8f4efd8ce8b1ff69597735d43adf3 | |
parent | ef7f3213ef1dee91a9392b5060455e778ec63960 (diff) | |
download | iurt-dfedbb57f1e3e4bed00773b72ae7b2ae9e251353.tar iurt-dfedbb57f1e3e4bed00773b72ae7b2ae9e251353.tar.gz iurt-dfedbb57f1e3e4bed00773b72ae7b2ae9e251353.tar.bz2 iurt-dfedbb57f1e3e4bed00773b72ae7b2ae9e251353.tar.xz iurt-dfedbb57f1e3e4bed00773b72ae7b2ae9e251353.zip |
Move youri command into a separate function
-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"); |