diff options
author | Colin Guthrie <colin@mageia.org> | 2014-08-12 20:50:43 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2014-08-12 20:50:43 +0100 |
commit | 5443c35fdf8fc36278060e9da445784d46952f4c (patch) | |
tree | 8c2d97c8a0ac69e6a5514cac82a0fecea886ec7f | |
parent | 4e4906002b08e8510ab8dc899c42df575f46a887 (diff) | |
download | mgaadvisories-5443c35fdf8fc36278060e9da445784d46952f4c.tar mgaadvisories-5443c35fdf8fc36278060e9da445784d46952f4c.tar.gz mgaadvisories-5443c35fdf8fc36278060e9da445784d46952f4c.tar.bz2 mgaadvisories-5443c35fdf8fc36278060e9da445784d46952f4c.tar.xz mgaadvisories-5443c35fdf8fc36278060e9da445784d46952f4c.zip |
Check that SRPMs exist when publishing updates.
This is thanks to a small, but simple API available via http://repository.mageia.org/
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | lib/MGA/Advisories.pm | 24 |
2 files changed, 24 insertions, 1 deletions
@@ -1,3 +1,4 @@ +- check that SRPMs exist when publishing updates - add a sleep when delivering mails to attempt to force ordering Version 0.18 diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index 1b50460..2d066b6 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -8,6 +8,7 @@ use DateTime; use Email::Sender::Simple qw(try_to_sendmail); use Email::Simple; use Email::Simple::Creator; +use HTTP::Request; use LWP::UserAgent; use File::Basename; use XMLRPC::Lite; @@ -263,8 +264,29 @@ sub assign_id { print "\n"; } + printf "%-40s", "Checking SRPMs… "; + my $ua = LWP::UserAgent->new; + $ua->max_redirect(0); + foreach my $rel (keys %{$adv->{src}}) { + foreach my $media (keys %{$adv->{src}{$rel}}) { + foreach my $srpm (@{$adv->{src}{$rel}{$media}}) { + my $req = HTTP::Request->new(GET => "http://repository.mageia.org/qa/checksrpm/update/$rel/$media/$srpm"); + my $resp = $ua->request($req); + + if ($resp->code eq 302 && $resp->header('Location') =~ /\/qa\/checksrpm\/found$/) { + print "✔ "; + } else { + print "✘ ($rel/$media/$srpm) "; + $failed = 1; + } + + } + } + } + print "\n"; + if ($failed) { - print STDERR "Error: Bugzilla cross check failed.\n"; + print STDERR "Error: Cross check failed.\n"; return; } } else { |