From 51d6292fac313fb570022d6b2f277acabc92abdb Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 11 Aug 2012 13:52:54 +0200 Subject: [PATCH] [ng] dist: less use of transforms, prefer make variables (1) * automake.in (handle_dist): Turn the '%FILENAME_FILTER%' transform into the 'am.dist.filename-filter' internal variable. * lib/am/distdir.am (distdir): Adjust and simplify accordingly (and improve an error message while at it). In particular, this removed the need for ... (am.dist.skip-length-check): ... this variable. Signed-off-by: Stefano Lattarini --- automake.in | 8 ++++---- lib/am/distdir.am | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/automake.in b/automake.in index bc2ece953..177b43f27 100644 --- a/automake.in +++ b/automake.in @@ -3292,6 +3292,10 @@ sub handle_dist () $seen_gettext && !$seen_gettext_external ? 'yes' : ''); define_variable ('am.dist.formats', INTERNAL, @archive_formats); + my $flm = option 'filename-length-max'; + define_variable ('am.dist.filename-filter', INTERNAL, + $flm ? ('.' x $flm->[1]) : ''); + # If the target 'dist-hook' exists, make sure it is run. This # allows users to do random weird things to the distribution # before it is packaged up. @@ -3299,13 +3303,9 @@ sub handle_dist () if user_phony_rule 'dist-hook'; $transform{'DIST-TARGETS'} = join (' ', @dist_targets); - my $flm = option ('filename-length-max'); - my $filename_filter = $flm ? '.' x $flm->[1] : ''; - $output_rules .= &file_contents ('distdir', new Automake::Location, %transform, - FILENAME_FILTER => $filename_filter, 'DIST-COMMON' => "@dist_common"); verbatim ('distcheck') if $relative_dir eq '.'; } diff --git a/lib/am/distdir.am b/lib/am/distdir.am index b8cc67d96..cf1333b02 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -247,10 +247,10 @@ if %?SUBDIRS% ## directory we have already cleared and might even have populated ## (e.g. shared AUX dir in the sub-package). am.dist.remove-distdir=: \ -## Disable filename length check: - am.dist.skip-length-check=: \ ## No need to fix modes more than once: am.dist.skip-mode-fix=: \ +## Disable filename length check: + am.dist.filename-filter='' \ || exit 1; \ fi; \ done @@ -291,11 +291,10 @@ if %?TOPDIR_P% ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" -if %?FILENAME_FILTER% - @if test -z "$(am.dist.skip-length-check)" && find "$(distdir)" -type f -print | \ - grep '^%FILENAME_FILTER%' 1>&2; then \ - echo 'error: the above filenames are too long' 1>&2; \ + @$(if $(am.dist.filename-filter), \ + if find "$(distdir)" -type f -print \ + | grep '^$(am.dist.filename-filter)' 1>&2; then \ + echo '$@: error: the above filenames are too long' 1>&2; \ exit 1; \ - else :; fi -endif %?FILENAME_FILTER% + else :; fi) endif %?TOPDIR_P% -- 2.47.2