summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2006-05-27 19:22:16 +0000
committerJason Woodward2006-05-27 19:22:16 +0000
commit98bd7664a15f83dc6b21e0bb0bbd330bb43c7c62 (patch)
tree22f180a23ad28f92eef4867c1a18ae43b21af6bb
parentd99ce4678a22f1bb554823e283025204e772791e (diff)
downloadcpan2tgz-98bd7664a15f83dc6b21e0bb0bbd330bb43c7c62.tar.gz
fixed architecture detection by examining unpacked module source directory.
-rw-r--r--Changelog6
-rwxr-xr-xcpan2tgz21
2 files changed, 12 insertions, 15 deletions
diff --git a/Changelog b/Changelog
index f47824e..2fab904 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,7 @@
-0.5.2 May 17, 2006
- * put the modules unpacked directory (along with ./lib)
- into Perl's include path
+0.5.2 May 27, 2006
+ * fixed architecture detection by examining unpacked module source
+ directory.
* added --build-tag option (see docs)
0.5.1 Apr 30, 2006
diff --git a/cpan2tgz b/cpan2tgz
index 8defe87..f215106 100755
--- a/cpan2tgz
+++ b/cpan2tgz
@@ -25,6 +25,7 @@ use warnings;
use Config;
use CPAN;
use Getopt::Long;
+use File::Find ();
our $VERSION = "0.5.2";
@@ -93,6 +94,9 @@ sub do_package
print STDERR "\nFailed to find module: $module_name","\n";
exit(1);
}
+ my $pack = $module->distribution;
+ die "Failed to initialize CPAN::Distribution object for $module_name: $!" unless $pack;
+ $pack->get(); # go ahead and fetch so we can inspect the source dir for arch info
# try to extract some info about the module
my $pkg_name = "perl-" . lc((split('/',$module->cpan_file))[-1]);
@@ -101,7 +105,9 @@ sub do_package
$pkg_name =~ s/\.tar.*?$//;
# figure out the arch of the package, default to noarch
- if ( $module->xs_file() ) {
+ my @xs_files = ();
+ File::Find::find( sub { /^.*\.(?:xs|c|h|so)\z/s && push @xs_files, $_; }, $pack->dir);
+ if ( $module->xs_file() || @xs_files ) {
$pkg_name .= "-" . [split('-',$Config{archname})]->[0];
} else {
$pkg_name .= "-noarch";
@@ -125,22 +131,13 @@ sub do_package
print "\n\nProcessing $module_name...\n\n";
- # do an initial make so that we can get the dep info
- my $pack = $CPAN::META->instance('CPAN::Distribution',$module->cpan_file());
- die "Failed to initialize CPAN::Distribution object for $module_name: $!" unless $pack;
-
- # add the modules unpacked directory to the library search path
- push @INC, $pack->dir();
- if ( -d $pack->dir() . '/lib' ) {
- push @INC, $pack->dir() . '/lib';
- }
-
if ( $pack->isa_perl() ) {
print STDERR "\nWill not install ",$module->id(),
" because it is contained within Perl proper.\n";
return;
}
+ # do an initial make so that we can get the dep info
eval { $pack->make() or die $!; };
if ( $@ ) {
print "make ERROR [$module_name]: $!\n";
@@ -175,7 +172,7 @@ sub do_package
}
print "\n\nhandling " . scalar(@deps)
- . " deps for $module_name: ",join(", ",@deps),"\n\n";
+ . " dependencies for $module_name: ",join(", ",@deps),"\n\n";
sleep(1); # blah