r54542 - /trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Fri Mar 19 07:03:11 UTC 2010


Author: dmn
Date: Fri Mar 19 07:02:55 2010
New Revision: 54542

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54542
Log:
Control::FromCPAN: drop old and unused *from_cpan_metta* methods

discover_dependencies() is the new shiny thing everyone uses

Modified:
    trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm

Modified: trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm?rev=54542&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm Fri Mar 19 07:02:55 2010
@@ -4,8 +4,9 @@
 
 =head1 SYNOPSIS
 
-    my $c = Debian::Control::FromCPAN->new_from_cpan_meta( $meta, {opts} );
-                      # construct from unpacked CPAN dist META.yml
+    my $c = Debian::Control::FromCPAN->new();
+    $c->discover_dependencies( { ... } );
+    $c->prune_perl_deps;
 
     Debian::Control::FromCPAN inherits from L<Debian::Control>.
 =cut
@@ -17,87 +18,14 @@
 
 use base 'Debian::Control';
 
-use YAML ();
 use Debian::Version qw(deb_ver_cmp);
 use File::Spec qw( catfile );
 
 use constant oldstable_perl_version => '5.8.8';
 
-=head1 CONSTRUCTOR
+=head1 METHODS
 
 =over
-
-=item new_from_cpan_meta( I<$meta>[, I<$opts>] )
-
-Accepts two arguments, a parsed F<META.yml> file (i.e. a hash reference of
-file's content as returned by L<YAML>) and a hash of options. These are given
-to the L</fill_from_cpan_meta> method of the newly constructed instance.
-
-=back
-
-=cut
-
-sub new_from_cpan_meta {
-    my ( $class, $meta, $opts ) = @_;
-
-    my $self = $class->new;
-
-    $self->fill_from_cpan_meta( $meta, $opts );
-
-    return $self;
-}
-
-=head1 METHODS
-
-=over
-
-=item fill_from_cpan_meta( I<meta>, I<options> )
-
-C<meta> is the hash representation of CPAN's F<META.yml> file. Its contents are
-converted to the relevant F<debian/control> fields.
-
-Options
-
-=over
-
-=item apt_contents
-
-An instance of Debian::AptContents class, used for finding packages
-corresponding to depended on modules.
-
-=back
-
-=cut
-
-sub fill_from_cpan_meta {
-    my ( $self, $meta, $opts ) = @_;
-
-    my $name = $meta->{name};
-    defined($name)
-        or die "META.yml contains no distribution name or version";
-
-    $name = lc($name);
-    $name =~ s/::/-/g;
-    $name = "lib$name" unless $name =~ /^lib/;
-
-    $self->source->Source($name);
-    my $src = $self->source;
-
-    my $bin = $self->binary->{$name} = Debian::Control::Stanza::Binary({
-        Package => $name,
-    });
-
-    $self->dependencies_from_cpan_meta( $meta, $opts->{apt_contents} )
-        if $opts->{apt_contents};
-
-    do {
-        $src->Section('perl');
-    } unless defined( $src->Section ) or defined( $bin->Section );
-    do {
-        $src->Priority('optional');
-        $bin->Priority('optional');
-    } unless defined( $src->Priority ) or defined( $bin->Priority );
-}
 
 =item discover_dependencies( [ { options hash } ] )
 
@@ -373,100 +301,6 @@
     return $debs, \@missing;
 }
 
-=item parse_meta_dep_list( src, apt_depends, missing )
-
-Convert the given CPAN META dependency list (I<src>, hashref with module names
-for keys and versions for values) into an instance of the
-L<Debian::Dependencies> class. Supplied I<apt_depends> is used for finding
-Debian packages corresponfing to CPAN modules. Modules with no corresponding
-Debian packages are added to the I<missing> parameter (which must be an
-instance of the L<Debian::Dependencies> class).
-
-=cut
-
-sub parse_meta_dep_list {
-    my( $self, $src, $apt_contents, $missing ) = @_;
-
-    my $deps = Debian::Dependencies->new;
-
-    while( my($k,$v) = each %$src ) {
-        my $pkg_dep = $apt_contents->find_perl_module_package( $k, $v );
-
-        $deps->add($pkg_dep) if $pkg_dep;
-    }
-
-    return $deps;
-}
-
-=item dependencies_from_cpan_meta( I<meta>, I<apt_contents> )
-
-Fills dependencies (build-time, run-time, recommends and conflicts) from given
-CPAN META.
-
-=cut
-
-sub dependencies_from_cpan_meta {
-    my ( $self, $meta, $apt_contents, $opt_verbose ) = @_;
-
-    my $missing = Debian::Dependencies->new();
-
-    my $depends = $self->parse_meta_dep_list( $meta->{requires}, $apt_contents, $missing );
-    my $build_depends = $self->parse_meta_dep_list( $meta->{build_requires}, $apt_contents, $missing );
-    my $recommends = $self->parse_meta_dep_list( $meta->{recommends}, $apt_contents, $missing );
-    my $conflicts = $self->parse_meta_dep_list( $meta->{conflicts}, $apt_contents, $missing );
-
-    my $all = $depends + $build_depends + $recommends;
-
-    $build_depends += $depends;
-    $depends->add('${perl:Depends}');
-    $depends->add('${misc:Depends}');
-
-    my $bin = $self->binary->Values(0);
-
-    $bin->Depends->add($depends);
-    $bin->Recommends->add($recommends);
-    $bin->Conflicts->add($conflicts);
-
-    my $arch_dep = 0;
-    for( $self->binary->Values ) {
-        if( $_->Architecture ne 'all' ) {
-            $arch_dep = 1;
-            last;
-        }
-    }
-
-    if( $arch_dep ) {
-        $self->source->Build_Depends->add($build_depends);
-    }
-    else {
-        $self->source->Build_Depends_Indep->add($build_depends);
-    }
-
-    if ($opt_verbose) {
-        print "\n";
-        print "Needs the following debian packages: $all\n" if @$all;
-    }
-    if (@$missing) {
-        my ($missing_debs_str);
-        if ($apt_contents) {
-            $missing_debs_str = join( "\n",
-                "Needs the following modules for which there are no debian packages available",
-                map( {" - $_"} @$missing ),
-                '' );
-        }
-        else {
-            $missing_debs_str = join( "\n",
-                "The following Perl modules are required and not installed in your system:",
-                map( {" - $_"} @$missing ),
-                "You do not have 'apt-file' currently installed - If you install it, I will",
-                "be able to tell you which Debian packages are those modules in (if they are",
-                "packaged)." );
-        }
-
-        print $missing_debs_str;
-    }
-}
-
 =item prune_simple_perl_dep
 
 Input:




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