Il 12/08/2012 23:20, Stefano Lattarini ha scritto: > The API to specify the formats of distribution tarballs has been changed > completely, in a BACKWARD-INCOMPATIBLE way. > > Instead of using the various 'dist-*' automake options, the developer is > now expected to specify the default formats of its distribution tarballs > with the special variable AM_DIST_FORMATS; for example, where once would > have been: > > AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) > > now it must be: > > AM_DIST_FORMATS = gzip bzip2 zip > > and similarly, where once would have been: > > AUTOMAKE_OPTIONS = no-dist-gzip dist-bzip2 dist-xz > > now is it simply: > > AM_DIST_FORMATS = bzip2 xz
Nice, but I'm not sure why this couldn't have a backwards-compatible replacement. ifeq ($(origin AM_DIST_FORMATS),undefined) AM_DIST_FORMATS := \ $(patsubst dist-%, %, $(filter dist-%, $(AUTOMAKE_OPTIONS)) \ $(if $(filter no-dist-gzip, $(AUTOMAKE_OPTIONS)),,gzip) endif This requires Automake-NG to merge AM_INIT_AUTOMAKE's arguments into the Makefile.in's AUTOMAKE_OPTIONS, which is only goodness. Paolo > Similarly, The various 'dist-*' targets (dist-gzip, dist-xz, dist-lzip, > dist-bzip2 and dist-gz) has been removed. If the user wants to generate > tarballs for formats not specified by the default AM_DIST_FORMATS, he can > simply override that variable dynamically: > > # Will generate a '.zip' archive and a '.tar.xz' archive, and not > # further ones. > make dist AM_DIST_FORMATS='zip xz' > > This change is of course is totally backward incompatible, but the > enhanced flexibility and simplicity is worth it. Not to mention that > the transition from the mainline Automake API to the new Automake-NG > one is trivial. > > * NG-NEWS: Update. > * ng/automake-ng.texi: Likewise. > * configure.ac (AM_INIT_AUTOMAKE): Drop the 'dist-xz' option. While > at it, drop the 'color-tests' option (now on by default, even in > coming-soon Automake 1.13) and add the 'ng' option (mostly for some > showing-off :-). > * t/ax/am-test-lib.sh: Also unset 'AM_DIST_FORMATS'. > * Makefile.am (AM_DIST_FORMATS): New, containing 'gzip' ad 'xz' (so > that we distribute the same formats we did before). > * lib/am/distcheck.mk (AM_DIST_FORMATS): New, defaulting to 'gzip'. > (am.dist.bad-targets): New, list invalid entries of $(AM_DIST_FORMATS). > Error out with a suitable message if that variable is non-empty. > Rename all the 'dist-*' targets, once public, to '.am/dist-*' (which > are private). Adjust their rules. > (am.dist.all-targets): Adjust to said 'dist-*' => '.am/dist-*' > renaming. > (am.dist.default-targets): New, defined from $(AM_DIST_FORMATS). > (dist, dist-all): Rewritten to rely on dependencies rather than on > recursive make invocation (the new API allows us to do so easily). > Other minor related adjustments. > (distcheck): Use $(AM_DIST_FORMATS) instead of $(am.dist.formats) > in the recipe. > * automake.in (handle_dist): Drop analysis of the various 'dist-*' > options, and of the 'no-dist-gzip' one; don't define the internal > make variable 'am.dist.formats'. > * lib/Automake/Options.pm (_is_valid_easy_option): Recognize the > various 'dist-*' options and the 'no-dist-gzip' one no more. > (_process_option_list): Explicitly reject them (to give better > diagnostic). > * t/dist-obsolete-opts.sh: New, check such diagnostic. > * t/dist-obsolete.sh: Remove as obsolete. > * t/repeated-options.sh: Minor adjustments to avoid spurious > failures. > * t/dist-formats.tap: Adjust heavily (almost a complete rewrite). > > Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> > --- > Makefile.am | 3 + > NG-NEWS | 48 +++- > automake.in | 22 -- > configure.ac | 3 +- > doc/automake-ng.texi | 109 ++++--- > lib/Automake/Options.pm | 22 +- > lib/am/distcheck.mk | 34 +-- > t/ax/am-test-lib.sh | 2 + > t/dist-formats.tap | 392 > ++++++-------------------- > t/{dist-obsolete.sh => dist-obsolete-opts.sh} | 15 +- > t/repeated-options.sh | 25 +- > 11 files changed, 229 insertions(+), 446 deletions(-) > rename t/{dist-obsolete.sh => dist-obsolete-opts.sh} (64%) > > diff --git a/Makefile.am b/Makefile.am > index db3dea7..9455f0f 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -27,6 +27,9 @@ EXTRA_DIST = > ## Top level. ## > ## ------------ ## > > +# Distribution formats. > +AM_DIST_FORMATS = gzip xz > + > # We want a handful of substitutions to be fully-expanded by make; > # then use config.status to substitute the remainder where a single > # expansion is sufficient. We use a funny notation here to avoid > diff --git a/NG-NEWS b/NG-NEWS > index 8f3cf72..129da68 100644 > --- a/NG-NEWS > +++ b/NG-NEWS > @@ -212,24 +212,54 @@ Distribution > > EXTRA_DIST = $(wildcard doc/*.txt $(srcdir)/doc/*.txt) # Better. > > -* The make variables $(DISTFILES), $(DIST_COMMON), $(DIST_SOURCES), > - $(DIST_TARGETS), $(DIST_ARCHIVES) had never been documented > - in mainline Automake, and were always intended to be internal > - variables. But that was not clear from their names. So we have > - renamed rename like this: > +* The make variables $(DISTFILES), $(DIST_COMMON), $(DIST_SOURCES) and > + $(DIST_ARCHIVES) had never been documented in mainline Automake, and > + were always intended to be internal variables. But that was not clear > + from their names. So we have renamed rename like this: > > DISTFILES => am.dist.all-files > DIST_COMMON => am.dist.common-files > DIST_SOURCES => am.dist.sources > - DIST_TARGETS => am.dist.default-targets > DIST_ARCHIVES => am.dist.default-archives > > Do not use any of these variables in your Makefiles! > > * Support for distribution archived in the '.shar.gz' and '.tar.Z' formats > - have been removed. Accordingly, the targets 'dist-shar' and 'dist-tarZ' > - are no more present in the generated Makefiles, and the use of the > - Automake options 'dist-shar' and 'dist-tarZ' will elicit a fatal error. > + have been removed; and with them the targets 'dist-shar' and 'dist-tarZ'. > + > +* The API to specify the formats of distribution tarballs has been changed > + completely. > + > + Instead of using the various 'dist-*' automake options, the developer is > + now expected to specify the default formats of its distribution tarballs > + with the special variable AM_DIST_FORMATS; for example, where once would > + have been: > + > + AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) > + > + now it must be: > + > + AM_DIST_FORMATS = gzip bzip2 zip > + > + and similarly, where once would have been: > + > + AUTOMAKE_OPTIONS = no-dist-gzip dist-bzip2 dist-xz > + > + now is it simply: > + > + AM_DIST_FORMATS = bzip2 xz > + > +* The various 'dist-*' targets (dist-gzip, dist-xz, dist-lzip, dist-bzip2 > + and dist-gz) has been removed. If the user wants to generate tarballs > + for formats not specified by the default AM_DIST_FORMATS, he can simply > + override that variable dynamically: > + > + # Will generate a '.zip' archive and a '.tar.xz' archive, and not > + # further ones. > + make dist AM_DIST_FORMATS='zip xz' > + > +* The DIST_TARGETS variable has been removed (as a side-effect of the > + previous change). > > > Obsolete Features Removed > diff --git a/automake.in b/automake.in > index 3a11b53..7428757 100644 > --- a/automake.in > +++ b/automake.in > @@ -3196,27 +3196,6 @@ sub handle_dist () > # The remaining definitions are only required when a dist target is used. > return if option 'no-dist'; > > - # The list of tarball formats we must support. > - my @archive_formats; > - if ($relative_dir eq '.') > - { > - # We order @archive_formats by expected duration of the > - # compressors, slowest first, for better parallelism in > - # "make dist". > - unshift @archive_formats, 'gzip' unless option 'no-dist-gzip'; > - foreach my $fmt (qw/zip bzip2 lzip xz/) > - { > - unshift @archive_formats, $fmt if option "dist-$fmt"; > - } > - # At least one of the archive formats must be enabled. > - if (@archive_formats == 0) > - { > - error (option 'no-dist-gzip', > - "no-dist-gzip specified but no dist-* specified,\n" > - . "at least one archive format must be enabled"); > - } > - } > - > # Look for common files that should be included in distribution. > # If the aux dir is set, and it does not have a Makefile.am, then > # we check for these files there as well. > @@ -3276,7 +3255,6 @@ sub handle_dist () > rule ('distcheck-hook') ? 'yes' : ''); > define_variable ('am.dist.handle-gettext', INTERNAL, > $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, > diff --git a/configure.ac b/configure.ac > index 50176d8..ab64763 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -39,8 +39,7 @@ AC_SUBST([am_AUTOUPDATE], ["${AUTOUPDATE-autoupdate}"]) > dnl We call AC_PROG_CC in an unusual way, and only for use in our > dnl testsuite, so also use 'no-dependencies' and 'no-define' among > dnl the automake options to avoid bloating and potential problems. > -AM_INIT_AUTOMAKE([dist-xz filename-length-max=99 color-tests > - no-define no-dependencies]) > +AM_INIT_AUTOMAKE([filename-length-max=99 ng no-define no-dependencies]) > > ## Keep this on a line of its own, since it must be found and processed > ## by the 'update-copyright' rule in our Makefile. > diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi > index 1470f63..ace21c5 100644 > --- a/doc/automake-ng.texi > +++ b/doc/automake-ng.texi > @@ -3930,7 +3930,7 @@ By default this macro @code{AC_DEFINE}'s @code{PACKAGE} > and > @code{VERSION}. This can be avoided by passing the @option{no-define} > option: > @example > -AM_INIT_AUTOMAKE([gnits 1.5 no-define dist-bzip2]) > +AM_INIT_AUTOMAKE([gnits 1.11.6 no-define parallel-tests]) > @end example > > @item AM_PATH_LISPDIR > @@ -8271,9 +8271,6 @@ distribution. The file is named based on the > @code{PACKAGE} and > @code{VERSION} variables defined by @code{AM_INIT_AUTOMAKE} > (@pxref{Macros}); more precisely the gzipped @code{tar} file is named > @samp{@var{package}-@var{version}.tar.gz}. > -@vindex GZIP_ENV > -You can use the @command{make} variable @code{GZIP_ENV} to control how gzip > -is run. The default setting is @option{--best}. > > @cindex @code{m4_include}, distribution > @cindex @code{include}, distribution > @@ -8547,49 +8544,74 @@ distuninstallcheck: > @node The Types of Distributions > @section The Types of Distributions > > -Automake generates rules to provide archives of the project for > -distributions in various formats. Their targets are: > +Automake-generated @code{dist} rule can generated distributions in > +various formats, depending on the content of the @code{AM_DIST_FORMATS} > +variable; this is overridable at runtime, defaults to @code{gzip}, and > +can contain several formats at once, to produce several kind of archives > +in one go. The recognized formats are: > > @table @asis > +@vindex GZIP_ENV > +@item @code{gzip} > +Usual compression with GNU @command{gzip}. Not very size-efficient > +these days, but very portable and fast. You can use the @command{make} > +variable @code{GZIP_ENV} to control which options @code{make dist} > +passes to @code{gzip} (the default setting being @option{--best}). > +For example: > +@smallexample > +make dist GZIP_ENV=--fast > +@end smallexample > +@cindex gzip compression > +@cindex Compression, gzip format > + > @vindex BZIP2 > -@item @code{dist-bzip2} > -Generate a bzip2 tar archive of the distribution. bzip2 archives are > -frequently smaller than gzipped archives. > -By default, this rule makes @samp{bzip2} use a compression option of > @option{-9}. > -To make it use a different one, set the @env{BZIP2} environment variable. > -For example, @samp{make dist-bzip2 BZIP2=-7}. > -@trindex dist-bzip2 > - > -@item @code{dist-gzip} > -Generate a gzip tar archive of the distribution. > -@trindex dist-gzip > - > -@item @code{dist-lzip} > +@item @code{bzip2} > +Archives compressed with @command{bzip2} are frequently smaller than > +gzipped archives (albeit becoming more and more obsolescent today, > +superseded by more advanced formats like @code{xz}). You can use > +the environment variable @code{BZIP2} to control which options > +@code{make dist} passes to @code{gzip} (the default setting being > +@option{-9}). For example: > +@smallexample > +make dist AM_DIST_FORMATS=bzip2 BZIP2=-7 > +@end smallexample > +@cindex bzip2 compression > +@cindex Compression, bzip2 format > + > +@vindex LZIP_OPT > +@item @code{lzip} > Generate an @samp{lzip} tar archive of the distribution. @command{lzip} > archives are frequently smaller than @command{bzip2}-compressed archives. > -@trindex dist-lzip > +You can use the environment variable @code{LZIP_OPT} to control which > +options @code{make dist} passes to @code{gzip} (the default setting > +being @option{-9}). For example: > +@smallexample > +make dist AM_DIST_FORMATS=lzip LZIP_OPT=--fast > +@end smallexample > +@cindex lzip compression > +@cindex Compression, lzip format > > @vindex XZ_OPT > -@item @code{dist-xz} > +@item @code{xz} > Generate an @samp{xz} tar archive of the distribution. @command{xz} > archives are frequently smaller than @command{bzip2}-compressed archives. > By default, this rule makes @samp{xz} use a compression option of > @option{-e}. To make it use a different one, set the @env{XZ_OPT} > environment variable. For example, run this command to use the > default compression ratio, but with a progress indicator: > -@samp{make dist-xz XZ_OPT=-7e}. > -@trindex dist-xz > +@smallexample > +make dist AM_DIST_FORMATS=xz XZ_OPT=-7e > +@end smallexample > +@cindex xz compression > +@cindex Compression, xz format > > -@item @code{dist-zip} > +@item @code{zip} > Generate a zip archive of the distribution. > -@trindex dist-zip > +@cindex zip compression > +@cindex Compression, zip format > > @end table > > -The rule @code{dist} (and its historical synonym @code{dist-all}) will > -create archives in all the enabled formats, @ref{Options}. By > -default, only the @code{dist-gzip} target is hooked to @code{dist}. > - > > @node Tests > @chapter Support for test suites > @@ -9909,24 +9931,6 @@ in the first few lines of the @file{NEWS} file. > @opindex dejagnu > Cause @command{dejagnu}-specific rules to be generated. @xref{DejaGnu > Tests}. > > -@item @option{dist-bzip2} > -@cindex Option, @option{dist-bzip2} > -@opindex dist-bzip2 > -Hook @code{dist-bzip2} to @code{dist}. > -@trindex dist-bzip2 > - > -@item @option{dist-lzip} > -@cindex Option, @option{dist-lzip} > -@opindex dist-lzip > -Hook @code{dist-lzip} to @code{dist}. > -@trindex dist-lzip > - > -@item @option{dist-zip} > -@cindex Option, @option{dist-zip} > -@opindex dist-zip > -Hook @code{dist-zip} to @code{dist}. > -@trindex dist-zip > - > @item @option{filename-length-max=99} > @cindex Option, @option{filename-length-max=99} > @opindex filename-length-max=99 > @@ -9969,12 +9973,6 @@ disable automatic dependency tracking. > Don't emit any code related to @code{dist} target. This is useful > when a package has its own method for making distributions. > > -@item @option{no-dist-gzip} > -@cindex Option, @option{no-dist-gzip} > -@opindex no-dist-gzip > -Do not hook @code{dist-gzip} to @code{dist}. > -@trindex no-dist-gzip > - > @item @option{no-exeext} > @cindex Option, @option{no-exeext} > @opindex no-exeext > @@ -10089,10 +10087,7 @@ AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false$(EXEEXT) > true.sh > @opindex tar-pax > > These three mutually exclusive options select the tar format to use > -when generating tarballs with @samp{make dist}. (The tar file created > -is then compressed according to the set of @option{no-dist-gzip}, > -@option{dist-bzip2}, @option{dist-lzip}, @option{dist-xz} and > -@option{dist-zip} options in use.) > +when generating tarballs with @samp{make dist}. > > These options must be passed as arguments to @code{AM_INIT_AUTOMAKE} > (@pxref{Macros}) because they can require additional configure checks. > diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm > index bdb3db9..77e9cbd 100644 > --- a/lib/Automake/Options.pm > +++ b/lib/Automake/Options.pm > @@ -270,15 +270,10 @@ sub _is_valid_easy_option ($) > check-news > color-tests > dejagnu > - dist-bzip2 > - dist-lzip > - dist-xz > - dist-zip > ng > no-define > no-dependencies > no-dist > - no-dist-gzip > no-exeext > no-installinfo > no-installman > @@ -318,20 +313,11 @@ sub _process_option_list (\%@) > { > error $where, "support for Cygnus-style trees has been removed"; > } > - elsif ($_ eq 'dist-lzma') > + elsif (/^(?:no-)?dist-.*/) > { > - error ($where, "support for lzma-compressed distribution " . > - "archives has been removed"); > - } > - elsif ($_ eq 'dist-tarZ') > - { > - error ($where, "distribution archives compressed with legacy " . > - "'compress' program are no more supported"); > - } > - elsif ($_ eq 'dist-shar') > - { > - error ($where, "support for shar distribution archives has " . > - "been removed"); > + error ($where, > + "'$_' option and the like are no more supported;\n" . > + "use AM_DIST_FORMATS in top-level Makefile.am instead"); > } > elsif (/^filename-length-max=(\d+)$/) > { > diff --git a/lib/am/distcheck.mk b/lib/am/distcheck.mk > index 5da7118..a6009a9 100644 > --- a/lib/am/distcheck.mk > +++ b/lib/am/distcheck.mk > @@ -67,7 +67,21 @@ am.dist.create-cmd.zip = \ > am.dist.extract-cmd.zip = \ > unzip $(distdir).zip > > -am.dist.all-targets = $(patsubst %,dist-%,$(am.dist.all-formats)) > +# This is namespace-safe, so it's OK to accept values from > +# the environment. > +AM_DIST_FORMATS ?= gzip > + > +am.dist.bad-targets := \ > + $(filter-out $(am.dist.all-formats),$(AM_DIST_FORMATS)) > +ifdef am.dist.bad-targets > + $(call am.fatal,Invalid distribution formats: $(am.dist.bad-targets)) > +endif > + > +am.dist.all-targets = $(patsubst %,.am/dist-%,$(am.dist.all-formats)) > +am.dist.default-targets = $(patsubst %,.am/dist-%,$(AM_DIST_FORMATS)) > + > +am.dist.default-archives = \ > + $(foreach x,$(AM_DIST_FORMATS),$(distdir).$(am.dist.ext.$x)) > > define am.dist.create-archive-for-format.aux > $(or $(am.dist.create-cmd.$1), \ > @@ -90,28 +104,16 @@ am.dist.extract-archive-for-format = $(call > $0.aux,$(strip $1)) > # commit v0.0-7569-gec58403). So keep it. > GZIP_ENV = --best > > -am.dist.default-targets = \ > - $(foreach x,$(am.dist.formats),dist-$x) > -am.dist.default-archives = \ > - $(foreach x,$(am.dist.formats),$(distdir).$(am.dist.ext.$x)) > - > .PHONY: $(am.dist.all-targets) > -$(am.dist.all-targets): dist-%: distdir > +$(am.dist.all-targets): .am/dist-%: distdir > $(call am.dist.create-archive-for-format,$*) > - $(am.dist.post-remove-distdir) > - > - > -# -------------------------------------------------- # > -# Building all the requested distribution flavors. # > -# -------------------------------------------------- # > > ifdef SUBDIRS > AM_RECURSIVE_TARGETS += dist dist-all > endif > > .PHONY: dist dist-all > -dist dist-all: > - $(MAKE) $(am.dist.default-targets) am.dist.post-remove-distdir='@:' > +dist dist-all: $(am.dist.default-targets) > $(am.dist.post-remove-distdir) > > > @@ -129,7 +131,7 @@ endif > .PHONY: distcheck > distcheck: dist > $(call am.dist.extract-archive-for-format, \ > - $(firstword $(am.dist.formats))) > + $(firstword $(AM_DIST_FORMATS))) > ## Make the new source tree read-only. Distributions ought to work in > ## this case. However, make the top-level directory writable so we > ## can make our new subdirs. > diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh > index e41c840..e1b3c02 100644 > --- a/t/ax/am-test-lib.sh > +++ b/t/ax/am-test-lib.sh > @@ -46,6 +46,8 @@ set +e > unset MFLAGS MAKEFLAGS MAKELEVEL > # Unset verbosity flag. > unset V > +# Distribution formats. > +unset AM_DIST_FORMATS > # Also unset variables that might let "make install" divert files > # into unwanted directories. > unset DESTDIR > diff --git a/t/dist-formats.tap b/t/dist-formats.tap > index d03fc74..5737227 100755 > --- a/t/dist-formats.tap > +++ b/t/dist-formats.tap > @@ -17,43 +17,52 @@ > # Check support for different compression formats used by distribution > # archives. > > -am_create_testdir=empty > . ./defs || exit 1 > > -plan_ 59 > +plan_ 18 > > -# ---------------------------------------------------- # > -# Common and/or auxiliary subroutines and variables. # > -# ---------------------------------------------------- # > - > -ocwd=$(pwd) || fatal_ "getting current working directory" > +# -------------------------------------- # > +# Auxiliary subroutines and variables. # > +# -------------------------------------- # > > TAR='' && unset TAR > > -# Create common aclocal.m4 file, for later tests. > -mkdir setup \ > - && cd setup \ > - && echo 'AC_INIT([x], [0]) AM_INIT_AUTOMAKE' > configure.ac \ > - && $ACLOCAL \ > - && mv aclocal.m4 .. \ > - && cd .. \ > - && rm -rf setup \ > - || fatal_ "creating common aclocal.m4 file" > - > # Set variables '$compressor' and '$suffix'. > setup_vars_for_compression_format () > { > - suffix=NONE compressor=NONE > + suffix=NONE > case $1 in > - gzip) suffix=tar.gz compressor=gzip ;; > - lzip) suffix=tar.lz compressor=lzip ;; > - xz) suffix=tar.xz compressor=xz ;; > - bzip2) suffix=tar.bz2 compressor=bzip2 ;; > - zip) suffix=zip compressor=zip ;; > + gzip) suffix=tar.gz ;; > + lzip) suffix=tar.lz ;; > + xz) suffix=tar.xz ;; > + bzip2) suffix=tar.bz2 ;; > + zip) suffix=zip ;; > *) fatal_ "invalid compression format '$1'";; > esac > + compressor=$1 > } > > +check_tarball () > +{ > + format=$1 > + ( > + setup_vars_for_compression_format $format \ > + && tarball=$distdir.$suffix \ > + && test -f $tarball \ > + && mkdir check-$format \ > + && cp $tarball check-$format \ > + && cd check-$format \ > + && $compressor -d $tarball \ > + && tar xvf $distdir.tar \ > + && diff ../Makefile.in $distdir/Makefile.in \ > + && diff ../aclocal.m4 $distdir/aclocal.m4 \ > + && diff ../configure $distdir/configure \ > + && cd .. \ > + && rm -rf check-$format > + ) > +} > + > + > have_compressor () > { > test $# -eq 1 || fatal_ "have_compressor(): bad usage" > @@ -113,326 +122,91 @@ have_all_compressors () > test -z "$missing_compressors" > } > > -start_subtest () > +clean_dist () > { > - name=$1; shift > - test -n "$name" || fatal_ "start_subtest: no subtest name given" > - if test $# -gt 0; then > - eval "$@" || fatal_ "start_subtest: evaluating assignments" > - fi > - ac_opts=$(echo $ac_opts | tr ',' ' ') > - am_opts=$(echo $am_opts | tr ',' ' ') > - mkdir "$name" > - cd "$name" > - unindent > configure.ac <<END > - AC_INIT([$name], [1.0]) > - AM_INIT_AUTOMAKE([$ac_opts]) > - AC_CONFIG_FILES([Makefile]) > - AC_OUTPUT > -END > - echo "AUTOMAKE_OPTIONS = $am_opts" > Makefile.am > - # It is imperative that aclocal.m4 is copied after configure.ac has > - # been created, to avoid a spurious trigger of the automatic remake > - # rules for configure & co. > - cp "$ocwd"/aclocal.m4 \ > - "$am_scriptdir"/missing \ > - "$am_scriptdir"/install-sh \ > - . > + rm -rf *$distdir* > } > > -end_subtest () > -{ > - unset name; unset ac_opts; unset am_opts; > - cd "$ocwd" || fatal_ "couldn't chdir back to '$ocwd'" > -} > +# ------------------------- # > +# Setup and basic checks. # > +# ------------------------- # > > -command_ok_if_have_compressor () > -{ > - if have_compressor "$compressor"; then > - command_ok_ "$@" > - else > - skip_ -r "'$compressor' not available" "$1" > - fi > -} > - > -can_compress () > -{ > - test $# -eq 2 || fatal_ "can_compress: bad number of arguments" > - tarname=$1 format=$2 > - setup_vars_for_compression_format "$format" > - > - command_ok_ "'dist-$format' target always created" $MAKE -n dist-$format > - > - command_ok_if_have_compressor "'make dist-$format' work by default" \ > - eval ' > - rm -rf *$tarname* \ > - && $MAKE dist-$format \ > - && ls -l *$tarname* \ > - && test -f $tarname-1.0.$suffix \ > - && test "$(echo *$tarname*)" = $tarname-1.0.$suffix' > - > - unset suffix compressor format tarname > -} > - > -# ---------------------------------------- # > -# Defaults layout of the dist-* targets. # > -# ---------------------------------------- # > - > -start_subtest defaults > - > -command_ok_ "default [automake]" $AUTOMAKE > -command_ok_ "default [autoconf]" $AUTOCONF > -command_ok_ "default [configure]" ./configure > -command_ok_ "default [make distcheck]" $MAKE distcheck > - > -command_ok_ "'make dist' only builds *.tar.gz by default" \ > - test "$(ls *defaults*)" = defaults-1.0.tar.gz > +echo AC_OUTPUT >> configure.ac > +: > Makefile.am > > -rm -rf *defaults* > +$ACLOCAL && $AUTOCONF && $AUTOMAKE -a || fatal_ "autotools failed" > +./configure || fatal_ "./configure failed" > > -for fmt in $all_compression_formats; do > - can_compress defaults $fmt > -done > -unset fmt > - > -end_subtest > - > -# ----------------------------------------------------------- # > -# Check diagnostic for no-dist-gzip without another dist-*. # > -# ----------------------------------------------------------- # > - > -nogzip_stderr () > -{ > - grep "$1:.*no-dist-gzip" stderr \ > - && grep "$1:.* at least one archive format must be enabled" stderr > -} > +command_ok_ "make distcheck" $MAKE distcheck > > -nogzip_automake_failure () > -{ > - AUTOMAKE_fails -d "no-dist-gzip ($1) without other formats is an error" > - command_ok_ "no-dist-gzip ($1) without other formats gives diagnostic" \ > - nogzip_stderr "$2" > -} > - > -start_subtest am-nogz-only am_opts=no-dist-gzip ac_opts= > -nogzip_automake_failure 'am' 'Makefile\.am:1' > -end_subtest > +command_ok_ "only gzip archive is built by default" \ > + test "$(ls *$distdir*)" = $distdir.tar.gz > > -start_subtest ac-nogz-only am_opts= ac_opts=no-dist-gzip > -nogzip_automake_failure 'ac' 'configure\.ac:2' > -end_subtest > > -# ------------------------------------------------- # > -# Check use of no-dist-gzip with a dist-* option. # > -# ------------------------------------------------- # > - > -append_to_opt () > -{ > - var=$1_opts val=$2 > - eval "$var=\${$var:+\"\$$var,\"}\$val" || fatal_ "evaluating \${$var}" > - unset var val > -} > +# ------------------------------------- # > +# Test all known formats, separately. # > +# ------------------------------------- # > > -nogzip () > -{ > - test $#,$1,$3,$5 = 6,in,and,in \ > - && case $2,$6 in ac,ac|ac,am|am,ac|am,am) :;; *) false;; esac \ > - || fatal_ "nogzip: invalid usage" > - format=$4 where_dist_nogzip=$2 where_dist_format=$6 > - shift 6 > - > - am_opts= ac_opts= > - append_to_opt $where_dist_format dist-$format > - append_to_opt $where_dist_nogzip no-dist-gzip > +for format in $all_compression_formats; do > setup_vars_for_compression_format "$format" > - # Do these before the am_opts and ac_opts variable can be munged > - # by 'start_subtest'. > - desc= > - test -n "$am_opts" && desc=${desc:+"$desc "}"am=$am_opts" > - test -n "$ac_opts" && desc=${desc:+"$desc "}"ac=$ac_opts" > - > - start_subtest nogzip-$format am_opts=$am_opts ac_opts=$ac_opts > - > - unindent >> Makefile.am <<END > - check-ark-name: > - test \$(am.dist.default-archives) = \$(distdir).$suffix > - check-ark-exists: > - test -f \$(distdir).$suffix > - check-no-tar-gz: > - test ! -f \$(distdir).tar.gz > -END > - > - command_ok_ "$desc [automake]" $AUTOMAKE > - command_ok_ "$desc [autoconf]" $AUTOCONF > - command_ok_ "$desc [configure]" ./configure > - command_ok_ "$desc [ark-name]" $MAKE check-ark-name > - command_ok_if_have_compressor "$desc [distcheck]" $MAKE distcheck > - command_ok_if_have_compressor "$desc [ark-exists]" $MAKE check-ark-exists > - command_ok_ "$desc [no .tar.gz]" $MAKE check-no-tar-gz > - > - unset desc > - > - end_subtest > -} > - > -# $1 $2 $3 $4 $5 $6 > -nogzip in am and bzip2 in am > -nogzip in ac and xz in ac > -nogzip in am and lzip in am > - > - > -# ----------------------------------------------------------- # > -# The 'dist-gzip' target is created also with no-dist-gzip. # > -# ----------------------------------------------------------- # > - > -start_subtest dist-gzip-persistence am_opts=no-dist-gzip,dist-xz > -command_ok_ "dist-gzip persistence [automake]" $AUTOMAKE > -command_ok_ "dist-gzip persistence [autoconf]" $AUTOCONF > -command_ok_ "dist-gzip persistence [configure]" ./configure > -can_compress dist-gzip-persistence gzip > -end_subtest > - > + desc="$format distribution format" > + command_ok_ "$desc [seems accepted]" \ > + $MAKE -n dist AM_DIST_FORMATS="$format" > + if have_compressor "$compressor"; then > + command_ok_ "$desc $format distribution format [works]" \ > + eval '$MAKE dist AM_DIST_FORMATS="$format" \ > + && ls -l *$distdir* \ > + && test -f $distdir.$suffix \ > + && test "$(echo *$distdir*)" = $distdir.$suffix' > + else > + skip_ -r "'$compressor' not available" "$1" > + fi > + clean_dist > + unset desc suffix compressor format > +done > > # ----------------------- # > # Parallel compression. # > # ----------------------- # > > -# We only use formats requiring 'gzip', 'bzip2' and 'compress' programs, > -# since there are the most likely to be all found on the great majority > -# of systems. > - > -start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-xz > +# We only use formats requiring 'gzip', 'bzip2' and 'xz' programs, > +# since there are the most likely to be all found on the great > +# majority of systems. > > -desc=gzip+bzip2+xz > -tarname=parallel-compression-1.0 > - > -check_tarball () > -{ > - format=$1 > - setup_vars_for_compression_format $format > - ( > - tarball=$tarname.$suffix \ > - && test -f $tarball \ > - && mkdir check-$format \ > - && cp $tarball check-$format \ > - && cd check-$format \ > - && $compressor -d $tarball \ > - && tar xvf $tarname.tar \ > - && diff ../Makefile.in $tarname/Makefile.in \ > - && cd .. \ > - && rm -rf check-$format > - ) > -} > - > -command_ok_ "$desc [automake]" $AUTOMAKE > +desc='parallel compression' > > skip_reason= > -have_compressor compress || skip_reason="'compress' not available" > +have_compressor xz || skip_reason="'xz' not available" > have_compressor bzip2 || skip_reason="'bzip2' not available" > > if test -n "$skip_reason"; then > skip_row_ 6 -r "$skip_reason" "$desc" > else > - command_ok_ "$desc [autoconf]" $AUTOCONF > - command_ok_ "$desc [configure]" ./configure > - command_ok_ "$desc [make -j4 dist-all]" $MAKE -j4 dist > + command_ok_ "$desc [make -j8 distcheck]" \ > + $MAKE -j8 distcheck AM_DIST_FORMATS='gzip bzip2 xz' > ls -l # For debugging. > command_ok_ "$desc [check .tar.gz tarball]" check_tarball gzip > command_ok_ "$desc [check .tar.bz2 tarball]" check_tarball bzip2 > command_ok_ "$desc [check .tar.xz tarball]" check_tarball xz > fi > > -unset tarname desc skip_reason > - > -end_subtest > - > - > -# --------------------------------------------------------- # > -# The various 'dist-*' targets can happily work together. # > -# --------------------------------------------------------- # > - > -start_subtest all-together > - > -desc='all compressors together' > -tarname=all-together-1.0 > - > -echo 'AM_INIT_AUTOMAKE([' > am-init.m4 > -echo 'AUTOMAKE_OPTIONS =' > Makefile.am > - > -# Add half 'dist-*' options to AM_INIT_AUTOMAKE, half to AUTOMAKE_OPTIONS. > -flip=: > -for fmt in $all_compression_formats; do > - test $fmt = gzip && continue > - if $flip; then > - echo " dist-$fmt" >> am-init.m4 > - flip=false > - else > - echo "AUTOMAKE_OPTIONS += dist-$fmt" >> Makefile.am > - flip=: > - fi > -done > -unset flip fmt > - > -echo '])' >> am-init.m4 > - > -sed 's/AM_INIT_AUTOMAKE.*/m4_include([am-init.m4])/' configure.ac > t > -mv -f t configure.ac > - > -# For debugging. > -cat Makefile.am > -cat configure.ac > -cat am-init.m4 > - > -command_ok_ "$desc [aclocal]" $ACLOCAL --force > -command_ok_ "$desc [automake]" $AUTOMAKE > -command_ok_ "$desc [autoconf]" $AUTOCONF > -command_ok_ "$desc [configure]" ./configure > - > -if have_all_compressors; then > - command_ok_ "$desc [make distcheck, real]" $MAKE distcheck > -else > - skip_ -r "not all compressors available" "$desc [make distcheck, real]" > -fi > - > -# We fake existence of all the compressors here, so that we don't have > -# to require any of them to run the further tests. This is especially > -# important since it's very unlikely that a non-developer has all the > -# compression tools installed on his machine at the same time. > - > -mkdir bin > -cd bin > -cat > check-distdir <<END > -#!/bin/sh > -{ ls -l '$tarname' && diff Makefile.am '$tarname'/Makefile.am; } >&2 \ > - || { echo "== distdir fail =="; exit 1; } > -END > -cat > grep-distdir-error <<'END' > -#!/bin/sh > -grep 'distdir fail' && exit 1 > -: > -END > -chmod a+x check-distdir grep-distdir-error > -for prog in tar $all_compressors; do > - case $prog in > - tar|zip) cp check-distdir $prog;; > - *) cp grep-distdir-error $prog;; > - esac > -done > -unset prog > -ls -l # For debugging. > -cd .. > +clean_dist > +unset desc skip_reason > > -oPATH=$PATH > -PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH > > -command_ok_ \ > - "$desc ['make dist-all', stubbed]" \ > - $MAKE dist-all > +# ------------------------------- # > +# Invalid distribution formats. # > +# ------------------------------- # > > -command_ok_ "$desc ['make dist -j4', stubbed]" $MAKE -j4 dist > +command_ok_ "invalid distribution formats [exit status]" eval ' > + ! $MAKE dist AM_DIST_FORMATS="foobar tarZ shar" 2>stderr' > > -PATH=$oPATH; export PATH > +cat stderr >&2 # For debugging. > > -end_subtest > +command_ok_ "invalid distribution formats [error report]" eval ' > + sed -e "s/^/ /" -e "s/$/ /" stderr >stderr2 \ > + && grep "[iI]nvalid distribution format.* foobar " stderr2 \ > + && grep "[iI]nvalid distribution format.* tarZ " stderr2 \ > + && grep "[iI]nvalid distribution format.* shar " stderr2' > > : > diff --git a/t/dist-obsolete.sh b/t/dist-obsolete-opts.sh > similarity index 64% > rename from t/dist-obsolete.sh > rename to t/dist-obsolete-opts.sh > index a7b68d0..06bea8d 100644 > --- a/t/dist-obsolete.sh > +++ b/t/dist-obsolete-opts.sh > @@ -14,28 +14,31 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > -# Obsolete archive formats. > +# Obsolete 'dist-*' and 'no-dist-gzip' options. > > . ./defs || exit 1 > > $ACLOCAL > > -for fmt in lzma shar; do > +for fmt in gzip bzip2 xz lzip zip tarZ lzma shar; do > echo AUTOMAKE_OPTIONS = dist-$fmt > Makefile.am > AUTOMAKE_fails -Wnone -Wno-error > - grep "^Makefile\\.am:1:.*support for $fmt.*removed" stderr > + grep "^Makefile\\.am:1:.* 'dist-$fmt' option.* no more supported" stderr > + grep "^Makefile\\.am:1:.* use AM_DIST_FORMATS .*instead" stderr > done > > rm -rf autom4te*.cache > > cat > configure.ac << 'END' > -AC_INIT([lzma], [1.0]) > -AM_INIT_AUTOMAKE([dist-tarZ]) > +AC_INIT([foo], [1.0]) > +AM_INIT_AUTOMAKE([no-dist-gzip dist-xz]) > AC_CONFIG_FILES([Makefile]) > END > : > Makefile.am > $ACLOCAL > AUTOMAKE_fails -Wnone -Wno-error > -grep "^configure\\.ac:2:.*legacy 'compress' program.* no more supported" > stderr > +grep "^configure\\.ac:2:.* 'no-dist-gzip' option.* no more supported" stderr > +grep "^configure\\.ac:2:.* 'dist-xz' option.* no more supported" stderr > +grep "^configure\\.ac:2:.*use AM_DIST_FORMATS .*instead" stderr > > : > diff --git a/t/repeated-options.sh b/t/repeated-options.sh > index 69a9cb4..489c313 100755 > --- a/t/repeated-options.sh > +++ b/t/repeated-options.sh > @@ -17,21 +17,31 @@ > # Check that automake does not complain on repeated options, nor > # generate broken or incorrect makefiles. > > -required=bzip2 > . ./defs || exit 1 > > cat >configure.ac <<END > AC_INIT([$me], [1.0]) > -AM_INIT_AUTOMAKE([foreign foreign dist-bzip2 no-dist-gzip dist-bzip2]) > +AM_INIT_AUTOMAKE([foreign foreign no-installman serial-tests \ > + no-installman]) > AC_CONFIG_FILES([Makefile]) > AC_OUTPUT > END > > cat > Makefile.am <<'END' > -AUTOMAKE_OPTIONS = no-dist-gzip no-dist-gzip dist-bzip2 > -AUTOMAKE_OPTIONS += dist-bzip2 foreign > +AUTOMAKE_OPTIONS = no-installman no-installman serial-tests > +AUTOMAKE_OPTIONS += serial-tests foreign > +TESTS = foo > +EXTRA_DIST = foo > +CLEANFILES = bar.out > END > > +cat > foo <<'END' > +#!/bin/sh > +echo RUN RUN > +: > bar.out > +END > +chmod a+x foo > + > $ACLOCAL > $AUTOCONF > $AUTOMAKE --foreign --foreign -Wall 2>stderr && test ! -s stderr \ > @@ -39,9 +49,10 @@ $AUTOMAKE --foreign --foreign -Wall 2>stderr && test ! -s > stderr \ > > ./configure > > -$MAKE > +$MAKE check > +test -f bar.out > +test ! -e foo.log > +test ! -e test-suite.log > $MAKE distcheck > -test -f $me-1.0.tar.bz2 > -test ! -e $me-1.0.tar.gz > > : >