aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MGA/Advisories.pm
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-08-03 19:12:40 +0100
committerColin Guthrie <colin@mageia.org>2014-08-03 19:12:59 +0100
commitd715427162dea4dff161104350ad4e568a51a395 (patch)
tree8f4bf69f7ba07d321d44afd2aef32eb5f16bf549 /lib/MGA/Advisories.pm
parentaf119daf37015b8f8f787a6ac9b60e9bc666a4f3 (diff)
downloadmgaadvisories-d715427162dea4dff161104350ad4e568a51a395.tar
mgaadvisories-d715427162dea4dff161104350ad4e568a51a395.tar.gz
mgaadvisories-d715427162dea4dff161104350ad4e568a51a395.tar.bz2
mgaadvisories-d715427162dea4dff161104350ad4e568a51a395.tar.xz
mgaadvisories-d715427162dea4dff161104350ad4e568a51a395.zip
Add a new command to move the packages.
This shells out to a separate command that actually implements this. Such a tool exists already in mgatools called 'mga-move-pkg'
Diffstat (limited to 'lib/MGA/Advisories.pm')
-rw-r--r--lib/MGA/Advisories.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index ac0aa9e..d408dc3 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -143,6 +143,36 @@ sub download_advisories {
close $fh;
}
+sub move_packages {
+ my ($advdb) = @_;
+ return unless $config->{mode} eq 'site';
+ return unless $config->{move_pkg_cmd};
+ my @cmd = (
+ $config->{move_pkg_cmd},
+ '--sync',
+ '--no-confirm'
+ );
+ foreach my $adv (keys %{$advdb->{advisories}}) {
+ next if $advdb->{advisories}{$adv}{status}{moved};
+ foreach my $rel (keys %{$advdb->{advisories}{$adv}{src}}) {
+ foreach my $media (keys %{$advdb->{advisories}{$adv}{src}{$rel}}) {
+ foreach my $srpm (@{$advdb->{advisories}{$adv}{src}{$rel}{$media}}) {
+ push(@cmd, "$rel/$media/$srpm.src.rpm");
+ }
+ }
+ }
+ }
+
+ return if scalar(@cmd) < 4;
+ report_exit("Could not move packages") if (0 != system(@cmd));
+
+ foreach my $adv (keys %{$advdb->{advisories}}) {
+ next if $advdb->{advisories}{$adv}{status}{moved};
+ $advdb->{advisories}{$adv}{status}{moved} = time();
+ save_status($advdb, $adv);
+ }
+}
+
sub publish_advisories {
my ($advdb) = @_;
foreach my $adv (sort keys %{$advdb->{advisories}}) {