[csw-devel] SF.net SVN: gar:[17769] csw/mgar/pkg/cpan/makemake

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Thu Apr 19 13:12:16 CEST 2012


Revision: 17769
          http://gar.svn.sourceforge.net/gar/?rev=17769&view=rev
Author:   dmichelsen
Date:     2012-04-19 11:12:16 +0000 (Thu, 19 Apr 2012)
Log Message:
-----------
cpan/makemake: Autodetect Build.PL, better package name heuristic, added diag output

Modified Paths:
--------------
    csw/mgar/pkg/cpan/makemake

Modified: csw/mgar/pkg/cpan/makemake
===================================================================
--- csw/mgar/pkg/cpan/makemake	2012-04-19 10:10:22 UTC (rev 17768)
+++ csw/mgar/pkg/cpan/makemake	2012-04-19 11:12:16 UTC (rev 17769)
@@ -10,6 +10,7 @@
 use warnings;
 use feature ':5.10';
 use Cwd; # was use File::chdir;
+use Carp;
 use CPAN;
 use YAML qw(LoadFile);
 use File::Path;
@@ -41,6 +42,7 @@
 
 ### Main ###
 
+say STDERR "Expanding CPAN module name";
 logoutput(); # Start logging
 my $mod = ( CPAN::Shell->expand( "Module", $modname ) )[0]
 	or die "can not locate CPAN module $modname";
@@ -53,6 +55,7 @@
 #endlog();
 # print "Make done\n";
 
+say STDERR "Analyzing filename";
 my $filename = $mod->cpan_file;
 my $author   = ( split( /\//, $filename ) )[2];
 my $author1  = substr( $author, 0, 1 );
@@ -64,8 +67,10 @@
 
 # That is the version of the module which may be different than the one from the file
 # my $version = $mod->cpan_version;
-my ( $name, $fileversion ) = ( $fileonly =~ /^(\D+)-(\d+(?:\.\d+)*)/ );
+my ( $name, $fileversion ) = ( $fileonly =~ /^(.*)-(\d+(?:\.\d+)*)/ );
 
+croak( "The package name is not defined on file $fileonly" ) if( !$name );
+
 #print "filename: $filename\n";
 #print "notstandard: $notstandard\n";
 #print "fileonly: $fileonly\n";
@@ -83,6 +88,7 @@
 
 
 # print "DSLIP: ", Dumper( $mod->dslip_status() );
+say STDERR "Getting DSLIP";
 my $dslip   = $mod->dslip_status;
 my $archall = (
 	  !defined $dslip->{L} ? 2
@@ -90,6 +96,7 @@
 	: 0
 );
 
+say STDERR "Getting distribution file";
 logoutput();
 $mod->distribution->get;
 endlog();
@@ -102,6 +109,7 @@
 my $license;
 my $license_resource;
 my $description;
+say STDERR "Processing META.yml";
 if ( -f "$distdir/META.yml" ) {
 	my $meta = LoadFile("$distdir/META.yml");
 
@@ -113,8 +121,10 @@
 	# my $recommends     = $meta->{recommends};
 	my $build_requires = $meta->{build_requires};
 
+	say STDERR "- build dependencies";
 	@build_dep_pkgs   = dep_pkgs($build_requires);
 	# @recommended_pkgs = dep_pkgs($recommends);
+	say STDERR "- runtime dependencies";
 	@runtime_dep_pkgs = dep_pkgs($req);
 
 }
@@ -134,6 +144,8 @@
 	system("pwd; gmake newpkg-$name");
 }
 
+say STDERR "Writing GAR Makefile";
+
 open( my $mf_fh, '>', "$name/trunk/Makefile" ) or die "Couldn't write to $name/trunk/Makefile";
 
 say {$mf_fh} "NAME = $name";
@@ -208,6 +220,12 @@
 		say STDERR "A previous version of this package $cswpkg has been released";
 		next;
 	}
+
+	if( $oldpkg eq 'CSWperl' ) {
+		say STDERR "This functionality is also in CSWperl, this is probably an update";
+		next;
+	}
+
 	say STDERR "A previous version of this package $cswpkg was released, but was named $oldpkg then";
 
 	say {$mf_fh} "OBSOLETED_BY_$cswpkg += $oldpkg";
@@ -220,6 +238,14 @@
 
 }
 
+if ( -f "$distdir/Build.PL" ) {
+  say {$mf_fh} '';
+  say {$mf_fh} 'CONFIGURE_SCRIPTS = $(WORKSRC)/Build.PL';
+  say {$mf_fh} 'BUILD_SCRIPTS = $(WORKSRC)/Build';
+  say {$mf_fh} 'TEST_SCRIPTS = $(WORKSRC)/Build';
+  say {$mf_fh} 'INSTALL_SCRIPTS = $(WORKSRC)/Build';
+}
+
 say {$mf_fh} "";
 say {$mf_fh} "include gar/category.mk";
 
@@ -344,7 +370,7 @@
 		return;
 	}
 	my $filename = $mod->distribution->base_id;
-	my ( $name, $fileversion ) = ( $filename =~ /^(\D+)-(\d+(?:\.\d+)*)/ );
+	my ( $name, $fileversion ) = ( $filename =~ /^(\D+\d*)-(\d+(?:\.\d+)*)/ );
 	my $dirname = $name;
 	my $pkgname = lc($name);
 	$pkgname = "CSWpm-" . $pkgname;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list