Index: fakeupstream.cgi
===================================================================
--- fakeupstream.cgi (revision 3453)
+++ fakeupstream.cgi (working copy)
@@ -46,6 +46,7 @@
my $project_char_re = '[a-zA-Z0-9\-]';
my $pypi_project_char_re = '[a-zA-Z0-9\-\.]';
my $npmjs_project_char_re = '[a-zA-Z0-9\-\.]';
+my $cratesio_project_char_re = '[a-zA-Z0-9_.-]';
my $hg_repository_re = '[a-zA-Z0-9\.\-:/]+';
my $href_char_re = '[a-zA-Z0-9\-\._/]';
my $href_p_char_re = '[a-zA-Z0-9\-\._/%]';
@@ -735,6 +736,35 @@
} );
}
+# https://packages.qa.debian.org/c/cargo.html
+# https://crates.io/crates/cargo
+# http://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=crates.io/cargo
+if( $upstream_param =~ m%^crates\.io/($cratesio_project_char_re+)% )
+{
+ my $project = $1;
+
+ my $url = "https://crates.io/api/v1/crates/$project/versions";
+ my $ua = LWP::UserAgent->new;
+ my $response = $ua->get( $url );
+ return_error( "failed to read $url : $response->status_line" ) if( not $response->is_success );
+ my $json = JSON::decode_json( $response->decoded_content );
+ print $q->header;
+ print $q->start_html;
+ print $q->start_ul;
+ foreach my $vers ( @{$json->{"versions"}} )
+ {
+ next if $vers->{"yanked"};
+ my $version = $vers->{"num"};
+ my $dl_uri = URI->new_abs($vers->{"dl_path"}, $url);
+
+ print $q->li( $q->a( { -href => $dl_uri }, $version ) );
+ }
+
+ print $q->end_ul;
+ print $q->end_html;
+ exit 0;
+}
+
my %upstream_info_per_package =
(
'stopwatch' =>