[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix autoscan to not search config-subdirs
From: |
Noah Misch |
Subject: |
Re: Fix autoscan to not search config-subdirs |
Date: |
Fri, 31 Mar 2006 05:34:55 -0800 |
User-agent: |
Mutt/1.5.6i |
On Tue, Mar 28, 2006 at 09:47:39PM +0200, Ralf Wildenhues wrote:
> * bin/autoscan.in (scan_configure_ac): New function to scan
> `configure.ac' before other files to compute a list of config
> subdirs to produce..
> (subdir_regex): ..this new global.
> (scan_file): Skip configure subdirectory trees.
> * tests/autoscan.at (autoscan): Unmark xfail.
> + # Skip config subdirs.
> + if (defined $subdir_regex
> + && $File::Find::name =~ /^\.\/($subdir_regex)$/o)
> + $subdir_regex = join ('|', map { quotemeta } @subdir);
As a matter of "Perl Fu", I would build a hash with subdir-name keys rather than
a regexp, for this purpose.
Would it be better to exclude subtrees bearing evidence of a configuration
mechanism [configure(\.(ac|in|gnu))]? Proposed alternate patch below; what do
you think? It probably mistreats packages that use Cygnus `configure'. Do any
packages in active development or use continue to use that?
2006-03-31 Noah Misch <address@hidden>
* bin/autoscan.in (subdirs): New global.
(scan_file): Prune directories with configure{,.{ac,in,gnu}}.
(output): Emit AC_CONFIG_SUBDIRS as needed.
* tests/autoscan.at (autoscan): Remove XFAIL.
Only in ac-an_subdirs: ac100-an_subdirs_2.patch
diff -urp -X dontdiff ac-clean/bin/autoscan.in ac-an_subdirs/bin/autoscan.in
--- ac-clean/bin/autoscan.in 2006-03-26 16:27:56.000000000 -0500
+++ ac-an_subdirs/bin/autoscan.in 2006-03-31 08:20:26.000000000 -0500
@@ -47,7 +47,7 @@ use File::Basename;
use File::Find;
use strict;
-use vars qw(@cfiles @makefiles @shfiles %printed);
+use vars qw(@cfiles @makefiles @shfiles @subdirs %printed);
# The kind of the words we are looking for.
my @kinds = qw (function header identifier program
@@ -385,6 +385,15 @@ sub scan_file ()
# Strip a useless leading `./'.
$File::Find::name =~ s,^\./,,;
+ if (-d $_ and
+ -f "$_/configure.in" ||
+ -f "$_/configure.ac" ||
+ -f "$_/configure.gnu" ||
+ -f "$_/configure")
+ {
+ $File::Find::prune = 1;
+ push @subdirs, $File::Find::name;
+ }
if (/\.[chlym](\.in)?$/)
{
used 'program', 'cc', $File::Find::name;
@@ -530,6 +539,7 @@ sub output ($)
output_kind ($file, 'identifier');
output_kind ($file, 'function');
+ print $file "\n";
if (@makefiles)
{
# Change DIR/Makefile.in to DIR/Makefile.
@@ -538,10 +548,16 @@ sub output ($)
$m =~ s/\.(?:in|am)$//;
$unique_makefiles{$m}++;
}
- print $file ("\nAC_CONFIG_FILES([",
+ print $file ("AC_CONFIG_FILES([",
join ("\n ",
sort keys %unique_makefiles), "])\n");
}
+ if (@subdirs)
+ {
+ print $file ("AC_CONFIG_SUBDIRS([",
+ join ("\n ",
+ sort @subdirs), "])\n");
+ }
print $file "AC_OUTPUT\n";
$file->close;
diff -urp -X dontdiff ac-clean/tests/autoscan.at ac-an_subdirs/tests/autoscan.at
--- ac-clean/tests/autoscan.at 2005-08-16 04:17:46.000000000 -0400
+++ ac-an_subdirs/tests/autoscan.at 2006-03-31 07:09:07.000000000 -0500
@@ -20,7 +20,6 @@ AT_BANNER([Autoscan.])
# 02110-1301, USA.
AT_SETUP([autoscan])
-AT_XFAIL_IF(:)
AT_DATA([Makefile.am],
[[SUBDIRS = subpkg