Package: qa.debian.org
Severity: wishlist
Tags: patch

Dear QA team,

I'm the maintainer of some puppet modules and a couple of days ago the
debian/watch files are no longer working because puppetlabs changed the
way howto get the information about available versions.

It's now possible to get the available versions in json format. ie on

https://forgeapi.puppetlabs.com/v3/modules/puppetlabs-firewall

for the module firewall from the user puppetlabs. I have written a patch
(see attachment) for a puppetlabs redirector. The patch can be applied
on top of svn.debian.org/svn/qa/trunk/cgi-bin/fakeupstream.cgi

I tested the patch locally with the following debian/watch file:

version=3
http://localhost/cgi-bin/fakeupstream.cgi?upstream=forge.puppetlabs/puppetlabs/firewall
 \
.*/puppetlabs-firewall-(.+)\.tar\.gz

Can you review and apply the patch to fakeupstream.cgi if you are happy
with it? And what's the procedure to get this patch rolled out so the
debian/watch files can use the new redirector?


TIA

Tom



-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Index: fakeupstream.cgi
===================================================================
--- fakeupstream.cgi	(revision 3102)
+++ fakeupstream.cgi	(working copy)
@@ -565,6 +565,32 @@
 	exit 0;
 }
 
+# http://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=forge.puppetlabs/puppetlabs/stdlib
+if( undef2empty( $q->param('upstream') ) =~ m%^forge.puppetlabs/($project_char_re+)/($project_char_re+)$% )
+{
+	my $user = $1;
+	my $project = $2;
+	my $url = "https://forgeapi.puppetlabs.com/v3/modules/$user-$project";;
+	my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } );
+	my $response = $ua->get( $url );
+	my $refs_page = $response->decoded_content;
+	return_error( "failed to read $url : $response->status_line" ) if( not $response->is_success );
+	my $json_ref = JSON::decode_json( $refs_page );
+        print $q->header;
+        print $q->start_html;
+        print $q->start_ul;
+        foreach my $release ( @{$json_ref->{"releases"}} )
+        {
+	    my $basename = join "", $user, "-", $project, "-", $release->{version}, ".tar.gz";
+	    print "<li>";
+	    print "<a href='https://forgeapi.puppetlabs.com/v3/files/";, $basename, "'>", $basename, "</a>\n";
+	    print "</li>";
+        }
+        print $q->end_ul;
+        print $q->end_html;
+	exit 0;
+}
+
 my %upstream_info_per_package =
 (
 	'stopwatch' =>

Reply via email to