summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2004-11-17 22:32:02 +0000
committerJason Woodward2004-11-17 22:32:02 +0000
commitf86ded69eab70a00d197ca69a4d38dbe77d19d8a (patch)
tree431686c184d8f2956bfd4d90acea63dba6936e89
parentba7571c1497010fe492e923dda6d3571ab2c0b1e (diff)
downloadcpan2tgz-f86ded69eab70a00d197ca69a4d38dbe77d19d8a.tar.gz
fixed slack-required generated list to show the actual package names as created, like perl-timedate instead of perl-date-parse and perl-time-zone. fixed bug where -ignoreinstalled was being ignored. enforced that the same package cannot be handled twice in one session, which causes CPAN.pm to complain and abort.
-rw-r--r--Changelog5
-rwxr-xr-xcpan2tgz41
2 files changed, 29 insertions, 17 deletions
diff --git a/Changelog b/Changelog
index 84d83a0..fd3778f 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,10 @@
0.2 Nov 17, 2004
+ * fixed slack-required generated list to show the actual package names as
+ created, like perl-timedate instead of perl-date-parse and perl-time-zone
+ * fixed bug where -ignoreinstalled was being ignored
+ * enforced that the same package cannot be handled twice in one session,
+ which causes CPAN.pm to complain and abort.
* -recursive now only installs the module when --install is specified
* inverted meaning of ignoreinstalled, so now ignoreinstalled will build
up to date packages for modules already present on the system
diff --git a/cpan2tgz b/cpan2tgz
index a774216..16e1716 100755
--- a/cpan2tgz
+++ b/cpan2tgz
@@ -54,9 +54,6 @@ sub do_package {
exit(1);
}
- print "\n\nProcessing $module_name...\n\n";
- $PACKAGE_CACHE_LIST{$module->id()} = 1;
-
# try to extract some info about the module
my $pkg_name = "perl-" . lc((split('/',$module->cpan_file))[-1]);
my $final_pkg_version = (split('-',$pkg_name))[-1];
@@ -68,10 +65,23 @@ sub do_package {
$pkg_name .= "-noarch";
}
$pkg_name .= "-1.tgz";
- $pkg_name = lc($pkg_name);
my $dest_dir = "/tmp/" . $module->id();
+ if( exists $PACKAGE_CACHE_LIST{$module->id()} || exists $PACKAGE_CACHE_LIST{$final_pkg_name} ){
+ print STDERR "\n\n",$module->id(),"/",$final_pkg_name,
+ " deferred, already in queue or installed\n\n";
+ return;
+ }
+ # store this so we don't process the same module twice
+ # CPAN.pm complains about the module already processed in it's session
+ $PACKAGE_CACHE_LIST{$module->id()} = 1;
+ # this is for those packages that have names like TimeDate that may provide
+ # multiple packages or a single package that differs from module->id()
+ $PACKAGE_CACHE_LIST{$final_pkg_name} = 1;
+
+ 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;
@@ -99,6 +109,7 @@ sub do_package {
keys %{$pack->prereq_pm()};
}
# look at module prerequisites
+ my @dep_pkg_names;
if( @deps > 0 ){
if($recursive){
print "\n\nhandling " . scalar(@deps)
@@ -106,11 +117,14 @@ sub do_package {
sleep(1);
foreach my $dep ( @deps ){
local $@;
- next if defined $PACKAGE_CACHE_LIST{$dep};
print "FIXME: I don't deal with xsloader b/c make ?n/a?\n",next if $dep =~ m/xsloader/i;
eval "no warnings 'all';use $dep;";
- next if ( $ignore_installed_deps && !$@ );
- do_package($dep);
+ # continue if installed, unless $ignore_installed_deps is set
+ unless( $@ ){
+ next unless $ignore_installed_deps;
+ }
+ my $dep_pkg_name = do_package($dep);
+ push(@dep_pkg_names,$dep_pkg_name) if $dep_pkg_name;
}
}else{
print "\n\nStopping.\n[", $module->id(), "] requires ", join(", ",@deps),"\n";
@@ -172,16 +186,8 @@ SCRIPT
# generate the slack-required file
open(my $required_fh,">$dest_dir/install/slack-required") or die "Failed to open slack-required for writing: $!";
print $required_fh "perl\n";
- # use the hashref here so we can get the version
- my $deps = $pack->prereq_pm();
- foreach my $perl_mod_dep ( keys %{$deps} ){
- my $version = $deps->{$perl_mod_dep};
- (my $pmd = $perl_mod_dep) =~ s/\:\:/\-/g;
- if( int($version) > 0 ){
- print $required_fh "perl-$pmd >= $version\n";
- }else{
- print $required_fh "perl-$pmd\n";
- }
+ foreach my $dep (@dep_pkg_names){
+ print $required_fh $dep,"\n";
}
close($required_fh);
@@ -220,6 +226,7 @@ SCRIPT
clear_build_dir($dest_dir);
+ return $final_pkg_name;
}
sub usage {