develooper Front page | perl.perl5.porters | Postings from January 2012

Detecting duplicate extension directories

Thread Next
From:
Nicholas Clark
Date:
January 27, 2012 07:36
Subject:
Detecting duplicate extension directories
Message ID:
20120127153649.GD37285@plum.flirble.org
We've now got extensions in 3 directories

cpan/   - dual life, CPAN upstream, don't edit in blead
dist/   - dual life, blead upstream, edit as needed
ext/    - not dual life

A side effect of this is that when the status changes, the extension needs
to move. This isn't a problem when building from a distribution tarball or
other clean checkout, but it is causing "fun" (ie strange noisy catastrophic
build failures) when anyone runs git pull on a build checkout, and then
runs disclean before starting again. git will correctly delete all the
repository files in the old location, but correctly doesn't delete any files
created by the build process (eg Makefile), and hence as the directory is
not empty git does not delete it. This is enough to confuse Configure.

What needs to happen to recover is that the "wrong" directory needs to be
deleted. It's pretty obvious to a human which that is, but I don't think
it's possible to fix distclean to do it reliably (and have no risk of
deleting wanted files).

However, I think it *is* possible to detect the problem in Configure, and
abort, to let the human fix things. Proposed patch attached.

Output on detecting a duplicate is:

Duplicate directories detected for extension Hash-Util-FieldHash
Configure cannot correctly recover from this - shall I abort?
    Keep the recommended value? [y]
Ok. Stopping Configure.
Please remove the duplicate directory (eg using git clean) and then re-run Configure


If you use the -K flag to Configure (the "yes I do want to open fire, even
if those are my feet" flag) then it will continue:

Duplicate directories detected for extension Hash-Util-FieldHash
Configure cannot correctly recover from this - shall I abort?
    Keep the recommended value? [n]
Ok. You will need to correct config.sh before running make.


I'm not sure if we should be reporting that as

    Hash-Util-FieldHash    name of the directories on disk
    Hash/Util/FieldHash    how Configure refers to extensions (historical name
                           on disk)
    Hash::Util::FieldHash  package name.

Nicholas Clark

diff --git a/Configure b/Configure
index 9abfe64..c6c20ec 100755
--- a/Configure
+++ b/Configure
@@ -22179,6 +22179,23 @@ find_extensions='
 		    fi;
 		fi;
 	    else
+		echo " $known_extensions $nonxs_extensions" > $$.tmp;
+		if $contains " $this_ext " $$.tmp; then
+		    echo "Duplicate directories detected for extension $xxx" >&4;
+		    echo "Configure cannot correctly recover from this - shall I abort?" >&4;
+		    case "$knowitall" in
+		    "") dflt=y;;
+		    *) dflt=n;;
+		    esac;
+		    . ../UU/myread;
+		    case "$ans" in
+		    n*|N*) ;;
+		    *) echo "Ok.  Stopping Configure." >&4;
+		       echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
+			exit 1;;
+		    esac;
+		    echo "Ok.  You will need to correct config.sh before running make." >&4;
+		fi;
 		$ls -1 $xxx > $$.tmp;
 		if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
 		    known_extensions="$known_extensions $this_ext";

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About