summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2012-03-19 14:40:02 +0100
committerAbigail <abigail@abigail.be>2012-03-19 14:40:02 +0100
commitb5bf278af31bbe7f859e02da0ad3793feb6a55e8 (patch)
tree5632537b3369d0cc0eda461f8d96d7e5eafe65ed
parente81fec2c92c338f9d506a01f47364f85ef3b7b75 (diff)
downloadperl-b5bf278af31bbe7f859e02da0ad3793feb6a55e8.tar.gz
Bail out if it looks scary.
Porting/sync-with-cpan hasn't automated all situations yet. In particular, it assumes the FILE entry has just one element, and that element is a directory. It also does not know what to do with MAP. If we determine this situation, we terminate the program before making any changes. Although there's the --force option for the braves.
-rwxr-xr-xPorting/sync-with-cpan19
1 files changed, 16 insertions, 3 deletions
diff --git a/Porting/sync-with-cpan b/Porting/sync-with-cpan
index 139a5d949f..aee808b760 100755
--- a/Porting/sync-with-cpan
+++ b/Porting/sync-with-cpan
@@ -62,8 +62,6 @@ use autodie;
require "Porting/Maintainers.pl";
-chdir "cpan";
-
my %IGNORABLE = map {$_ => 1} @IGNORABLE;
my $package = "02packages.details.txt";
@@ -72,7 +70,8 @@ my $package_file = "/tmp/$package";
GetOptions ('tarball=s' => \my $tarball,
- 'version=s' => \my $version)
+ 'version=s' => \my $version,
+ force => \my $force,)
or die "Failed to parse arguments";
die "Usage: $0 module [args] [cpan package]" unless @ARGV == 1 || @ARGV == 2;
@@ -83,6 +82,20 @@ my $cpan_mod = @ARGV ? shift : $module;
my $info = $Modules {$module} or die "Cannot find module $module";
my $distribution = $$info {DISTRIBUTION};
+
+my @files = glob $$info {FILES};
+if (@files != 1 || !-d $files [0] || $$info {MAP}) {
+ say "This looks like a setup $0 cannot handle (yet)";
+ unless ($force) {
+ say "Will not continue without a --force option";
+ exit 1;
+ }
+ say "--force is in effect, so we'll soldier on. Wish me luck!";
+}
+
+
+chdir "cpan";
+
my $pkg_dir = $$info {FILES};
$pkg_dir =~ s!.*/!!;