r20262 - /scripts/qa/CPANTSdump

tincho at users.alioth.debian.org tincho at users.alioth.debian.org
Wed May 21 23:13:26 UTC 2008


Author: tincho
Date: Wed May 21 23:13:26 2008
New Revision: 20262

URL: http://svn.debian.org/wsvn/?sc=1&rev=20262
Log:
First draft of data exported to CPANTS

Added:
    scripts/qa/CPANTSdump   (with props)

Added: scripts/qa/CPANTSdump
URL: http://svn.debian.org/wsvn/scripts/qa/CPANTSdump?rev=20262&op=file
==============================================================================
--- scripts/qa/CPANTSdump (added)
+++ scripts/qa/CPANTSdump Wed May 21 23:13:26 2008
@@ -1,0 +1,79 @@
+#!/usr/bin/perl
+# vim:ts=4:sw=4:et:ai:sts=4
+# $Id: qareport 15918 2008-02-28 21:15:38Z gregoa-guest $
+#
+# Generates data for CPANTS
+#
+# Copyright Martín Ferrari <martin.ferrari at gmail.com>, 2008
+# Released under the terms of the GNU GPL 2
+use strict;
+use warnings;
+
+use DebianQA::Cache;
+use DebianQA::Config;
+use DebianQA::Svn;
+use Getopt::Long;
+
+my $p = new Getopt::Long::Parser;
+$p->configure(qw(no_ignore_case bundling pass_through));
+
+$p->getoptions('help|h|?' => \&help
+    ) or die "Error parsing command-line arguments!\n";
+
+my $opts = getopt_common(0, 1); # No passthru, load config
+
+my @pkglist = sort(get_pkglist());
+my $data = read_cache(consolidated => "");
+
+print "debian_pkg, CPAN_dist, CPAN_vers, N_bugs, N_patches\n";
+
+foreach my $pkg (@pkglist) {
+    my $ups_dir = $data->{watch}{$pkg}{upstream_dir};
+    my $ups_url = $data->{watch}{$pkg}{upstream_url};
+    my $dist;
+    if($ups_dir
+            and $ups_dir =~ m#http://search.cpan.org/dist/(.+?)(?:/|$|\s)#) {
+        $dist = $1;
+    } elsif($ups_url
+            and $ups_url =~ qr#^((?:http|ftp)://\S*(?:cpan|backpan)\S*)/(?:modules/by-module|(?:by-)?authors/id)\b.*/(.*?)-\d#i) {
+        $dist = $1;
+    } else {
+        $dist = $ups_url || "unknown";
+    }
+    my $version = $data->{archive}{$pkg}{most_recent};
+    if($version) {
+        # Try to remove Debian stuff -- Not reliable!
+        $version =~ s/-[^-]+$//;
+        $version =~ s/\+\w+$//;
+    } else {
+        $version = "not-uploaded";
+    }
+    my $patches = $data->{svn}{$pkg}{patches};
+    if($patches and ref $patches) {
+        $patches = scalar @$patches;
+    } else {
+        $patches = 0;
+    }
+    my $bugs = $data->{bts}{$pkg};
+    if($bugs and ref $bugs) {
+        $bugs = scalar keys %$bugs;
+    } else {
+        $bugs = 0;
+    }
+    # "debian_pkg, CPAN_dist, CPAN_vers, N_bugs, N_patches\n";
+    my @data = ($pkg, $dist, $version, $bugs, $patches);
+    print join(", ", map({ qq("$_") } @data)), "\n";
+}
+
+sub help {
+    print <<END;
+Usage:
+ $0 [options]
+
+Options:
+ --help, -h         This help.
+ --conf, -c FILE    Specifies a configuration file, uses defaults if not
+                    present.
+END
+    exit 0;
+}

Propchange: scripts/qa/CPANTSdump
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-perl-cvs-commits mailing list