[48750] contrib/cpan2port/cpan2port

ryandesign at macports.org ryandesign at macports.org
Sat Mar 28 02:22:20 PDT 2009


Revision: 48750
          http://trac.macports.org/changeset/48750
Author:   ryandesign at macports.org
Date:     2009-03-28 02:22:20 -0700 (Sat, 28 Mar 2009)
Log Message:
-----------
cpan2port: expand tabs to spaces

Modified Paths:
--------------
    contrib/cpan2port/cpan2port

Modified: contrib/cpan2port/cpan2port
===================================================================
--- contrib/cpan2port/cpan2port	2009-03-28 09:19:42 UTC (rev 48749)
+++ contrib/cpan2port/cpan2port	2009-03-28 09:22:20 UTC (rev 48750)
@@ -28,8 +28,8 @@
 # 
 # sub perl_version { 
 #     my %ver = qw(
-# 	lenny 5.10
-# 	hardy 5.008008
+#       lenny 5.10
+#       hardy 5.008008
 #     );
 # }
 
@@ -72,8 +72,8 @@
     my %r;
     my $method = $conf{during} ? $conf{during} :  'requires';
     while ( my ($k,$v) = each %{ $dep->$method or return ()} ) {
-	DEBUG::warn("candidate $k");
-	is_corelist($k) or $r{$k} = $v;
+        DEBUG::warn("candidate $k");
+        is_corelist($k) or $r{$k} = $v;
     }
     DEBUG::warn("end compute depedances");
     \%r;
@@ -94,29 +94,29 @@
 }
 
 sub find_dist {
-	for (@_) {
-		my $glob = "$_*";
-		print STDERR "trying to find dist in $glob\n";
-		if (my ( $dist ) = grep { -d } glob($glob) ) {
-			return $dist
-		}
-	}
-	undef;
+        for (@_) {
+                my $glob = "$_*";
+                print STDERR "trying to find dist in $glob\n";
+                if (my ( $dist ) = grep { -d } glob($glob) ) {
+                        return $dist
+                }
+        }
+        undef;
 }
 
 sub module_depends {
     my ($info) = @_ or return ();
     DEBUG::warn("$$info{name} will show deps");
     my $dist = find_dist( $info->{dist_dir}, $info->{module}->get )
-	or die "can't find dist";
+        or die "can't find dist";
     $$info{depends} = (
-	-e "$dist/META.yml"
-	    ? 'Module::Depends'
-	    : 'Module::Depends::Intrusive'
+        -e "$dist/META.yml"
+            ? 'Module::Depends'
+            : 'Module::Depends::Intrusive'
     ) ->new ->dist_dir($dist); 
     $$info{depends}->find_modules ;
     if ( my $errors = $$info{depends}->{errors} ) {
-	MSG::warn "can't parse $$info{name}: $errors";
+        MSG::warn "can't parse $$info{name}: $errors";
     }
     $info;
 }
@@ -132,14 +132,14 @@
     my %info = ( name => $module_name );
     my @info_fields = qw(file cpan_path prefix version suffix);
     my $get_info = qr<
-	( # file
-	    (.*)/          # cpan_path
-	    ([^/]+)-          # prefix
-	    ((?:\d+\.?)+)     # version
-	    \.
-	    (tar\.gz|tgz)   # suffix
-	)
-	\s*$              # eol
+        ( # file
+            (.*)/          # cpan_path
+            ([^/]+)-          # prefix
+            ((?:\d+\.?)+)     # version
+            \.
+            (tar\.gz|tgz)   # suffix
+        )
+        \s*$              # eol
     >x;
 
     $info{cpan_file} = $module->cpan_file; 
@@ -150,14 +150,14 @@
     $info{tarball} = "$$CPAN::Config{keep_source_where}/authors/id/$info{cpan_file}";
     @info{@info_fields} = $info{cpan_file} =~ /$get_info/;
     for (@info_fields) {
-	defined $info{$_} or MSG::warn "$info{name}::$info{cpan_file}: $_ not matched";
+        defined $info{$_} or MSG::warn "$info{name}::$info{cpan_file}: $_ not matched";
     }
     if ( my $desc = $module->description ) {
-	$info{description}  = $desc;
+        $info{description}  = $desc;
     } else {
-	$desc = "$module_name (no description available)";
-	$info{description}  = $desc;
-	MSG::warn $desc;
+        $desc = "$module_name (no description available)";
+        $info{description}  = $desc;
+        MSG::warn $desc;
     }
     $info{port} = package_name($info{prefix}); 
     $info{debian} = package_name($info{prefix}); 
@@ -171,21 +171,21 @@
     my $tarball = $$info{tarball} or die;
     my %check;
     for my $k (qw( md5 sha1 rmd160)) {
-	my ($sum) = qx( openssl $k $tarball);
-	my ($v)   = $sum =~ / (.*)/;
-	$check{$k} = $v;
+        my ($sum) = qx( openssl $k $tarball);
+        my ($v)   = $sum =~ / (.*)/;
+        $check{$k} = $v;
     }
     $$info{checksums} = \%check;
     if ( DEBUG::DEBUG ) {
-	use YAML;
-	print STDERR Dump $$info{checksums};
+        use YAML;
+        print STDERR Dump $$info{checksums};
     }
     $info;
 }
 
 sub all_on {
-	my $depends = module_depends( about(@_ ));
-	checksums( $depends );
+        my $depends = module_depends( about(@_ ));
+        checksums( $depends );
 }
 
 package main;
@@ -214,16 +214,16 @@
              $checksums = join (' ', 'checksums', %{ $check });
          }
 
-	 if ( my $dep_ref = Huggy::depends_on($info) ) {
-	     my @depends = map {
-		 MSG::warn "$$info{name} requires $_";
-		 'port:'.Huggy::from_port $_
-	     } keys %{ $dep_ref };
-	     if (@depends) {
-		 $depends = join ' ','depends_lib-append', at depends;
-	     }
+         if ( my $dep_ref = Huggy::depends_on($info) ) {
+             my @depends = map {
+                 MSG::warn "$$info{name} requires $_";
+                 'port:'.Huggy::from_port $_
+             } keys %{ $dep_ref };
+             if (@depends) {
+                 $depends = join ' ','depends_lib-append', at depends;
+             }
 
-	 }
+         }
     }
 
 '# $Id$
@@ -249,8 +249,8 @@
 sub fmt {
     my ( $format,$info ) = @_;
     if ($format eq 'YAML' ) {
-	use YAML; print Dump $info;
-	return;
+        use YAML; print Dump $info;
+        return;
     }
     $format =~ s/#{(\w+)}/$$info{$1}/g;
     $format;
@@ -289,20 +289,20 @@
 
 if ( exists $opt{f} ) {
     foreach_pkg {
-	my $info = Huggy::about $_;
-	print(fmt($opt{f},$info)); 
+        my $info = Huggy::about $_;
+        print(fmt($opt{f},$info)); 
     }
 } elsif ( exists $opt{t} ) {
     foreach_pkg {
-	if (my $info = Huggy::all_on $_) {
-	    chdir $wd;
-	    my $dir = "perl/$$info{port}";
-	    -d $dir or mkpath $dir;
-	    my $portfile = "$dir/Portfile";
-	    print STDERR "creating $portfile";
-	    open PORTFILE,'>',$portfile or die "$! while creating $portfile";
-	    print PORTFILE portfile($info);
-	} else { die 'Huggy did not have clue' }
+        if (my $info = Huggy::all_on $_) {
+            chdir $wd;
+            my $dir = "perl/$$info{port}";
+            -d $dir or mkpath $dir;
+            my $portfile = "$dir/Portfile";
+            print STDERR "creating $portfile";
+            open PORTFILE,'>',$portfile or die "$! while creating $portfile";
+            print PORTFILE portfile($info);
+        } else { die 'Huggy did not have clue' }
     }
 }
 
@@ -317,11 +317,11 @@
 cpan2port uses at least one flag and a list of module names. module names can
 also be read from stdin.
 
-	cpan2port -r Net::LDAP Test::Harness
+        cpan2port -r Net::LDAP Test::Harness
 
 works.
 
-	cpan2port -r < packages_list 
+        cpan2port -r < packages_list 
 
 works too.
 
@@ -339,37 +339,37 @@
 
 goto your local macports repository and type
 
-	cpan2port -r Net::LDAP Test::Harness
-	find .
+        cpan2port -r Net::LDAP Test::Harness
+        find .
 
 and you'll see
 
-	./perl
-	./perl/p5-perl-ldap
-	./perl/p5-perl-ldap/Portfile
-	./perl/p5-test-harness
-	./perl/p5-test-harness/Portfile
+        ./perl
+        ./perl/p5-perl-ldap
+        ./perl/p5-perl-ldap/Portfile
+        ./perl/p5-test-harness
+        ./perl/p5-test-harness/Portfile
 
 cpan
 
-	cpan2port -r Net::LDAP Test::Harness
-	find .
+        cpan2port -r Net::LDAP Test::Harness
+        find .
 and the perl/p5-
 
 =item -f
 
 format output for all package names. for exemple
 
-	cpan2port -f '#{port}' Net::LDAP
+        cpan2port -f '#{port}' Net::LDAP
 
 will print
 
-	p5-perl-ldap
+        p5-perl-ldap
 
 
 special format string YAML shows a yaml dump about packages 
 
-	cpan2port -f YAML Net::LDAP
+        cpan2port -f YAML Net::LDAP
 
 so it's easy to see what are the available informations
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090328/75695ade/attachment.html>


More information about the macports-changes mailing list