From 5443c35fdf8fc36278060e9da445784d46952f4c Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 12 Aug 2014 20:50:43 +0100 Subject: Check that SRPMs exist when publishing updates. This is thanks to a small, but simple API available via http://repository.mageia.org/ --- NEWS | 1 + lib/MGA/Advisories.pm | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index aca364b..69c167f 100644 --- a/NEWS +++ b/NEWS @@ -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 { -- cgit v1.2.1