automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 3/3] dist: add back support for obsolete dist-* opt


From: Paolo Bonzini
Subject: [Automake-NG] [PATCH 3/3] dist: add back support for obsolete dist-* options
Date: Wed, 22 Aug 2012 11:41:43 +0200

The old API for dist formats can be supported easily, by parsing the
AUTOMAKE_OPTIONS and generating AM_DIST_FORMATS from it, if not defined
otherwise.

* NG-NEWS: Document that the old distribution format API is obsolete
but available.
* lib/Automake/Options.pm: Degrade error to warning.
* lib/am/distcheck.mk: Generate AM_DIST_FORMATS from AUTOMAKE_OPTIONS
* t/dist-obsolete-opts.sh: Add backwards-compatibility tests.
---
 NG-NEWS                 |  2 +-
 lib/Automake/Options.pm |  8 ++++----
 lib/am/distcheck.mk     |  4 +++-
 t/dist-obsolete-opts.sh | 24 +++++++++++++++---------
 4 file modificati, 23 inserzioni(+), 15 rimozioni(-)

diff --git a/NG-NEWS b/NG-NEWS
index 129da68..8ee1aae 100644
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -228,7 +228,7 @@ Distribution
   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.
+  completely; the old API is still available, but gives warnings.
 
   Instead of using the various 'dist-*' automake options, the developer is
   now expected to specify the default formats of its distribution tarballs
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 5bd95dc..66b756a 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -321,11 +321,11 @@ sub _process_option_list (\%@)
         {
           error $where, "support for Cygnus-style trees has been removed";
         }
-      elsif (/^(?:no-)?dist-.*/)
+      elsif ($_ eq 'no-dist-gzip' || /^dist-.*/)
         {
-          error ($where,
-                 "'$_' option and the like are no more supported;\n" .
-                 "use AM_DIST_FORMATS in top-level Makefile.am instead");
+          msg ('obsolete', $where,
+                 "'$_' option and the like are obsolete; use\n" .
+                 "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 421b15b..9404d7a 100644
--- a/lib/am/distcheck.mk
+++ b/lib/am/distcheck.mk
@@ -69,7 +69,9 @@ am.dist.extract-cmd.zip = \
 
 # This is namespace-safe, so it's OK to accept values from
 # the environment.
-AM_DIST_FORMATS ?= gzip
+AM_DIST_FORMATS ?= \
+   $(patsubst dist-%, %, $(filter dist-%, $(AUTOMAKE_OPTIONS))) \
+   $(if $(filter no-dist-gzip, $(AUTOMAKE_OPTIONS)),,gzip)
 
 am.dist.bad-targets := \
   $(filter-out $(am.dist.all-formats),$(AM_DIST_FORMATS))
diff --git a/t/dist-obsolete-opts.sh b/t/dist-obsolete-opts.sh
index 06bea8d..018fc1c 100644
--- a/t/dist-obsolete-opts.sh
+++ b/t/dist-obsolete-opts.sh
@@ -22,9 +22,9 @@ $ACLOCAL
 
 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:.* 'dist-$fmt' option.* no more supported" stderr
-  grep "^Makefile\\.am:1:.* use AM_DIST_FORMATS .*instead" stderr
+  $AUTOMAKE -Wobsolete -Wno-error 2>stderr
+  grep "^Makefile\\.am:1:.* 'dist-$fmt' option.* obsolete" stderr
+  grep "^Makefile\\.am:1:.* AM_DIST_FORMATS .*instead" stderr
 done
 
 rm -rf autom4te*.cache
@@ -33,12 +33,18 @@ cat > configure.ac << 'END'
 AC_INIT([foo], [1.0])
 AM_INIT_AUTOMAKE([no-dist-gzip dist-xz])
 AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
 END
-: > Makefile.am
+: > foo
+echo EXTRA_DIST = foo > Makefile.am
 $ACLOCAL
-AUTOMAKE_fails -Wnone -Wno-error
-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
+$AUTOMAKE -Wobsolete -Wno-error 2>stderr
+grep "^configure\\.ac:2:.* 'no-dist-gzip' option.* obsolete" stderr
+grep "^configure\\.ac:2:.* 'dist-xz' option.* obsolete" stderr
+grep "^configure\\.ac:2:.* AM_DIST_FORMATS .*instead" stderr
 
-:
+$AUTOCONF
+./configure
+$MAKE dist
+test -f foo-1.0.tar.xz || exit 1
+test -f foo-1.0.tar.gz && exit 1 || :
-- 
1.7.11.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]