r52908 - in /trunk/dh-make-perl: TODO lib/Debian/WNPPBug.pm lib/DhMakePerl.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Tue Feb 16 22:20:49 UTC 2010


Author: dmn
Date: Tue Feb 16 22:20:41 2010
New Revision: 52908

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52908
Log:
pave the road for non-ITP WNPP bugs

The idea is that when showing missing dependencies, one wants to see all WNPP
bugs - ITP, RFP, ITA, RFA and O bugs. The current implementation still
suopports only ITPs, but the rest of the code is ready for it.

Added:
    trunk/dh-make-perl/lib/Debian/WNPPBug.pm
Modified:
    trunk/dh-make-perl/TODO
    trunk/dh-make-perl/lib/DhMakePerl.pm

Modified: trunk/dh-make-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/TODO?rev=52908&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Tue Feb 16 22:20:41 2010
@@ -4,7 +4,7 @@
   May be similar to #525847
 * when ITP for the package is found, try to deduce short/long description from
   the bug report
-* get_itp() should look at http://www.debian.org/devel/wnpp/prospective (or
+* get_wnpp() should look at http://www.debian.org/devel/wnpp/prospective (or
   requested and being_packaged), cache the resulting hash and update the cache
   daily
 * add new command, --trace-depends. To be used like

Added: trunk/dh-make-perl/lib/Debian/WNPPBug.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/WNPPBug.pm?rev=52908&op=file
==============================================================================
--- trunk/dh-make-perl/lib/Debian/WNPPBug.pm (added)
+++ trunk/dh-make-perl/lib/Debian/WNPPBug.pm Tue Feb 16 22:20:41 2010
@@ -1,0 +1,178 @@
+package Debian::WNPPBug;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Debian::WNPPBug - handy representation of Debian WNPP bug reports
+
+=head1 SYNOPSIS
+
+    my $b = Debian::WNPBug->new(
+        {   number            => 1234,
+            title             => 'RFP: nice-package -- do nice things easier',
+            type              => 'rfp',
+            package           => 'nice-package',
+            short_description => 'do nice things together',
+            submitter         => "Joe Developer <joe at developer.local>"
+        }
+    );
+
+    print "$b";     # 1234
+
+=cut
+
+use base qw(Class::Accessor);
+__PACKAGE__->mk_accessors(
+    qw(
+        number title type package short_description submitter
+        )
+);
+
+=head1 CONSTRUCTOR
+
+=over
+
+=item new
+
+Constructs new instance of the class. Initial values are to be given as a hash
+reference.
+
+=back
+
+=head1 FIELDS
+
+=over
+
+=item number
+
+The unique ID of the big in the BTS.
+
+=item title
+
+The title of the bug. Usualy something like
+
+    RFP: nice-package -- do nice things easier
+
+=item type
+
+The type of the WNPP bug. Either of:
+
+=over
+
+=item RFP
+
+request for package
+
+=item ITP
+
+intent to package
+
+=item O
+
+orphaned package
+
+=item RFH
+
+request for help
+
+=item RFA
+
+request for adoption
+
+=item ITA
+
+intent to adopt
+
+=back
+
+=item package
+
+Package name
+
+=item short_description
+
+The short description of the package
+
+=item submitter
+
+The bug sumbitter in the form C<< Full Name <email at address> >>
+
+=back
+
+=head1 OVERLOADS
+
+=over
+
+=item ""
+
+C<Debian::WNPPBug> object instances stringify via the method L<|as_string>. The
+default C<as_string> method returns the bug number.
+
+=cut
+
+use overload '""' => \&as_string;
+
+=back
+
+=head1 METHODS
+
+=over
+
+=item type_and_number
+
+Returns a string representing the bug type and number in the form I<TYPE>
+#I<number>, e.g. C<ITP #1234>.
+
+=cut
+
+sub type_and_number {
+    my $self = shift;
+    return $self->type . ' #' . $self->number;
+}
+
+=item as_string
+
+Uset for the "" overload. Returns the bug number.
+
+=cut
+
+sub as_string {
+    my $self = shift;
+    return $self->number;
+}
+
+=back
+
+=head1 AUTHOR
+
+=over 4
+
+=item Damyan Ivanov <dmn at debian.org>
+
+=back
+
+=head1 COPYRIGHT & LICENSE
+
+=over 4
+
+=item Copyright (C) 2010 Damyan Ivanov <dmn at debian.org>
+
+=back
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License version 2 as published by the Free
+Software Foundation.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+=cut
+
+1;

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=52908&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Tue Feb 16 22:20:41 2010
@@ -47,6 +47,7 @@
 use Debian::Dependencies      ();
 use Debian::Dependency        ();
 use Debian::Version qw(deb_ver_cmp);
+use Debian::WNPPBug;
 use Parse::DebianChangelog;
 use DhMakePerl::Config;
 use DhMakePerl::PodParser ();
@@ -379,7 +380,7 @@
         $closes = $self->cfg->closes;
     }
     else {
-        $closes = $self->get_itp($pkgname);
+        $closes = $self->get_wnpp($pkgname);
     }
     $self->create_changelog( "$debiandir/changelog", $closes );
     $self->create_rules("$debiandir/rules");
@@ -1202,18 +1203,20 @@
             $missing_debs_str
                 = "Needs the following modules for which there are no debian packages available:\n";
             for (@$missing) {
-                my $itp = $self->get_itp($_);
+                my $bug = $self->get_wnpp($_);
                 $missing_debs_str .= " - $_";
-                $missing_debs_str .= " (ITP #$itp)" if $itp;
+                $missing_debs_str .= " (" . $bug->type_and_number . ')'
+                    if $bug;
                 $missing_debs_str .= "\n";
             }
         }
         else {
             $missing_debs_str = "The following Perl modules are required and not installed in your system:\n";
             for (@$missing) {
-                my $itp = $self->get_itp($_);
+                my $bug = $self->get_wnpp($_);
                 $missing_debs_str .= " - $_";
-                $missing_debs_str .= " (ITP #$itp)" if $itp;
+                $missing_debs_str .= " (" . $bug->type_and_number . ')'
+                    if $bug;
                 $missing_debs_str .= "\n";
             }
             $missing_debs_str .= <<EOF
@@ -1236,7 +1239,7 @@
     return $debs;
 }
 
-sub get_itp {
+sub get_wnpp {
     my ( $self, $package ) = @_;
 
     return undef unless $self->cfg->network;
@@ -1257,8 +1260,12 @@
     foreach my $link (@links) {
         my $desc = $link->text();
 
-        if ($desc && $desc =~ /^ITP: $package /) {
-            return $1 if $link->url =~ m/bug=(\d+)$/;
+        if ( $desc && $desc =~ /^ITP: $package / ) {
+            return Debian::WNPPBug->new(
+                type   => 'ITP',
+                number => $1,
+                title  => $desc
+            ) if $link->url =~ m/bug=(\d+)$/;
         }
 
     }




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