automake-patches
[Top][All Lists]
Advanced

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

[FYI] {maint} dist: deprecated shar and tar+compress formats


From: Stefano Lattarini
Subject: [FYI] {maint} dist: deprecated shar and tar+compress formats
Date: Fri, 10 May 2013 19:35:14 +0200

See also discussion about automake wishlist bug#13324.

* lib/Automake/Options.pm: Give proper warnings in the 'obsolete'
category if the 'dist-shar' or 'dist-tarZ' options are used.
* lib/distdir.am: When the 'dist-tarZ' or 'dist-shar' targets are
invoked, make them give a non-fatal warning.
* doc/automake.texi: Report the new deprecations.
* t/dist-shar.sh: New test.
* t/dist-tarZ.sh: Likewise.
* t/lzma.sh: While at it, rename ...
* t/dist-lzma.sh: ... like this, and tweak it to keep more in
sync with the new tests.
* t/dist-formats.tap: Remove references to deprecated formats.
* t/list-of-tests.mk: Adjust.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 doc/automake.texi           | 19 +++++++++------
 lib/Automake/Options.pm     | 17 +++++++++++--
 lib/am/distdir.am           |  6 +++++
 t/dist-formats.tap          | 50 +++++++++++++++-----------------------
 t/{lzma.sh => dist-lzma.sh} |  4 +--
 t/dist-shar.sh              | 47 ++++++++++++++++++++++++++++++++++++
 t/dist-tarZ.sh              | 59 +++++++++++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk          |  4 ++-
 8 files changed, 164 insertions(+), 42 deletions(-)
 rename t/{lzma.sh => dist-lzma.sh} (95%)
 create mode 100755 t/dist-shar.sh
 create mode 100755 t/dist-tarZ.sh

diff --git a/doc/automake.texi b/doc/automake.texi
index 8b5125e..b7ae709 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8706,13 +8706,16 @@ Generate a @samp{zip} archive of the distribution.
 
 @item @code{dist-tarZ}
 Generate a tar archive of the distribution, compressed with the
-historical (obsolescent) program @command{compress}.  Use of this
-option is discouraged.
+historical (and obsolescent) program @command{compress}.  This
+option is deprecated, and it and the corresponding functionality
+will be removed altogether in Automake 2.0.
 @trindex dist-tarZ
 
 @item @code{dist-shar}
-Generate a @samp{shar} archive of the distribution.  This format archive
-is obsolescent, and use of this option is discouraged.
+Generate a @samp{shar} archive of the distribution.  This format
+archive is obsolescent, and use of this option is deprecated.
+It and the corresponding functionality will be removed altogether
+in Automake 2.0.
 @trindex dist-shar
 
 @end table
@@ -10108,15 +10111,17 @@ Hook @code{dist-zip} to @code{dist}.
 @cindex Option, @option{dist-shar}
 @opindex dist-shar
 Hook @code{dist-shar} to @code{dist}.  Use of this option
-is discouraged, as the @samp{shar} format is obsolescent and
-problematic.
+is deprecated, as the @samp{shar} format is obsolescent and
+problematic.  Support for it will be removed altogether in
+Automake 2.0.
 @trindex dist-shar
 
 @item @option{dist-tarZ}
 @cindex Option, @option{dist-tarZ}
 @opindex dist-tarZ
 Hook @code{dist-tarZ} to @code{dist}.  Use of this option
-is discouraged, as the @samp{compress} program is obsolete.
+is deprecated, as the @samp{compress} program is obsolete.
+Support for it will be removed altogether in Automake 2.0.
 @trindex dist-tarZ
 
 @item @option{filename-length-max=99}
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index e3f551a..737d2a1 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -272,8 +272,6 @@ sub _is_valid_easy_option ($)
     dejagnu
     dist-bzip2
     dist-lzip
-    dist-shar
-    dist-tarZ
     dist-xz
     dist-zip
     info-in-builddir
@@ -334,6 +332,21 @@ sub _process_option_list (\%@)
           error ($where, "support for lzma-compressed distribution " .
                          "archives has been removed");
         }
+      # TODO: Make this a fatal error in Automake 2.0.
+      elsif ($_ eq 'dist-shar')
+        {
+          msg ('obsolete', $where,
+               "support for shar distribution archives is deprecated.\n" .
+               "  It will be removed in Automake 2.0");
+        }
+      # TODO: Make this a fatal error in Automake 2.0.
+      elsif ($_ eq 'dist-tarZ')
+        {
+          msg ('obsolete', $where,
+               "support for distribution archives compressed with " .
+               "legacy program 'compress' is deprecated.\n" .
+               "  It will be removed in Automake 2.0");
+        }
       elsif (/^filename-length-max=(\d+)$/)
         {
           delete $options->{$_};
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index e5d8d5e..0e5f6bd 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -339,12 +339,18 @@ dist-xz: distdir
 ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
 .PHONY: dist-tarZ
 dist-tarZ: distdir
+       @echo WARNING: "Support for shar distribution archives is" \
+                      "deprecated." >&2
+       @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
        tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
        $(am__post_remove_distdir)
 
 ?SHAR?DIST_ARCHIVES += $(distdir).shar.gz
 .PHONY: dist-shar
 dist-shar: distdir
+       @echo WARNING: "Support for distribution archives compressed with" \
+                      "legacy program 'compress' is deprecated." >&2
+       @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
        shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
diff --git a/t/dist-formats.tap b/t/dist-formats.tap
index 730fa5d..bebac37 100755
--- a/t/dist-formats.tap
+++ b/t/dist-formats.tap
@@ -20,7 +20,7 @@
 am_create_testdir=empty
 . test-init.sh
 
-plan_ 70
+plan_ 66
 
 # ---------------------------------------------------- #
 #  Common and/or auxiliary subroutines and variables.  #
@@ -56,12 +56,10 @@ setup_vars_for_compression_format ()
   suffix=NONE compressor=NONE
   case $1 in
     gzip) suffix=tar.gz  compressor=gzip     ;;
-    tarZ) suffix=tar.Z   compressor=compress ;;
     lzip) suffix=tar.lz  compressor=lzip     ;;
       xz) suffix=tar.xz  compressor=xz       ;;
    bzip2) suffix=tar.bz2 compressor=bzip2    ;;
      zip) suffix=zip     compressor=zip      ;;
-    shar) suffix=shar.gz compressor=shar     ;;
        *) fatal_ "invalid compression format '$1'";;
   esac
 }
@@ -73,20 +71,6 @@ have_compressor ()
     # Assume gzip(1) is available on every reasonable portability target.
     gzip)
       return 0;;
-    # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
-    # and is just a dummy script that is not able to actually compress
-    # (it can only decompress).  So, check that the 'compress' program
-    # is actually able to compress input.
-    # Note that, at least on GNU/Linux, 'compress' does (and is
-    # documented to) exit with status 2 if the output is larger than
-    # the input after (attempted) compression; so we need to pass it
-    # an input that it can actually reduce in size when compressing.
-    compress)
-      for x in 1 2 3 4 5 6 7 8; do
-        echo aaaaaaaaaaaaaaaaaaaaa
-      done | compress -c >/dev/null && return 0
-      return 1
-      ;;
     *)
       case $1 in
         # Do not use --version, or older versions bzip2 would try to
@@ -113,7 +97,7 @@ have_compressor ()
   fatal_ "have_compressor(): dead code reached"
 }
 
-all_compression_formats='gzip tarZ lzip xz bzip2 zip shar'
+all_compression_formats='gzip lzip xz bzip2 zip'
 
 all_compressors=$(
   for x in $all_compression_formats; do
@@ -305,7 +289,7 @@ END
 nogzip in am  and  bzip2  in  am
 nogzip in ac  and  xz     in  am
 nogzip in am  and  lzip   in  ac
-nogzip in ac  and  tarZ   in  ac
+nogzip in ac  and  zip    in  ac
 
 
 # ----------------------------------------------------------- #
@@ -324,13 +308,13 @@ end_subtest
 #  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
+# We only use formats requiring 'gzip', 'bzip2' and 'xz' programs,
+# since there are the most likely to be all found on the majority
 # of systems.
 
-start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-tarZ
+start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-xz
 
-desc=gzip+bzip2+tarZ
+desc=gzip+bzip2+xz
 tarname=parallel-compression-1.0
 
 check_tarball ()
@@ -353,11 +337,17 @@ check_tarball ()
 
 command_ok_ "$desc [automake]" $AUTOMAKE
 
-skip_reason=
-have_compressor compress || skip_reason="'compress' not available"
-have_compressor bzip2 || skip_reason="'bzip2' not available"
+if ! have_compressor xz && ! have_compressor bzip2; then
+  skip_reason="both 'bzip2' and 'xz' are unavailable"
+elif ! have_compressor xz; then
+  skip_reason="'xz' not available"
+elif ! have_compressor bzip2; then
+  skip_reason="'bzip2' not available"
+else
+  skip_reason=
+fi
 if test "$MAKE_j4" = false; then
-  test -z "$skip_reason" || skip_reason="$skip_reason and "
+  test -z "$skip_reason" || skip_reason="$skip_reason, and "
   skip_reason="${skip_reason}make concurrency unavailable"
 fi
 
@@ -370,7 +360,7 @@ else
   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.Z tarball]"   check_tarball tarZ
+  command_ok_ "$desc [check .tar.xz tarball]"  check_tarball xz
 fi
 
 unset tarname desc skip_reason
@@ -445,8 +435,8 @@ END
 chmod a+x check-distdir grep-distdir-error
 for prog in tar $all_compressors; do
   case $prog in
-    tar|shar|zip) cp check-distdir $prog;;
-               *) cp grep-distdir-error $prog;;
+    tar|zip) cp check-distdir $prog;;
+          *) cp grep-distdir-error $prog;;
   esac
 done
 unset prog
diff --git a/t/lzma.sh b/t/dist-lzma.sh
similarity index 95%
rename from t/lzma.sh
rename to t/dist-lzma.sh
index 30fc689..d1d3e4b 100755
--- a/t/lzma.sh
+++ b/t/dist-lzma.sh
@@ -25,8 +25,8 @@ $ACLOCAL --force
 AUTOMAKE_fails -Wnone -Wno-error
 grep "^Makefile\\.am:1:.*$errmsg" stderr
 
-cat > configure.ac << 'END'
-AC_INIT([lzma], [1.0])
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE([no-dist-gzip dist-lzma])
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/t/dist-shar.sh b/t/dist-shar.sh
new file mode 100755
index 0000000..cd04425
--- /dev/null
+++ b/t/dist-shar.sh
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check support for no-dist-gzip with dist-shar.
+
+required=shar
+. test-init.sh
+
+errmsg='support for shar .*deprecated'
+
+echo AUTOMAKE_OPTIONS = dist-shar > Makefile.am
+$ACLOCAL
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\\.am:1:.*$errmsg" stderr
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([no-dist-gzip dist-shar])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+: > Makefile.am
+
+rm -rf autom4te*.cache
+$ACLOCAL
+AUTOMAKE_run -Wno-error
+grep "^configure\\.ac:2:.*$errmsg" stderr
+
+$AUTOCONF
+./configure
+$MAKE distcheck
+test -f $distdir.shar.gz
+
+:
diff --git a/t/dist-tarZ.sh b/t/dist-tarZ.sh
new file mode 100755
index 0000000..f276481
--- /dev/null
+++ b/t/dist-tarZ.sh
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check support for no-dist-gzip with dist-tarZ.
+
+. test-init.sh
+
+# On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
+# and is just a dummy script that is not able to actually compress
+# (it can only decompress).  So, check that the 'compress' program
+# is actually able to compress input.
+# Note that, at least on GNU/Linux, 'compress' does (and is
+# documented to) exit with status 2 if the output is larger than
+# the input after (attempted) compression; so we need to pass it
+# an input that it can actually reduce in size when compressing.
+for x in 1 2 3 4 5 6 7 8; do
+  echo aaaaaaaaaaaaaaaaaaaaa
+done | compress -c >/dev/null \
+  || skip_ "cannot find a working 'compress' program"
+
+errmsg=".*legacy .*'compress' .*deprecated"
+
+echo AUTOMAKE_OPTIONS = dist-tarZ > Makefile.am
+$ACLOCAL
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\\.am:1:.*$errmsg" stderr
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([no-dist-gzip dist-tarZ])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+: > Makefile.am
+
+rm -rf autom4te*.cache
+$ACLOCAL
+AUTOMAKE_run -Wno-error
+grep "^configure\\.ac:2:.*$errmsg" stderr
+
+$AUTOCONF
+./configure
+$MAKE distcheck
+test -f dist-tarz-1.0.tar.Z
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index b8cc592..ce3639c 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -384,6 +384,9 @@ t/destdir.sh \
 t/dir-named-obj-is-bad.sh \
 t/discover.sh \
 t/dist-formats.tap \
+t/dist-lzma.sh \
+t/dist-tarZ.sh \
+t/dist-shar.sh \
 t/dist-auxdir-many-subdirs.sh \
 t/dist-auxfile-2.sh \
 t/dist-auxfile.sh \
@@ -655,7 +658,6 @@ t/ltinstloc.sh \
 t/ltlibobjs.sh \
 t/ltlibsrc.sh \
 t/ltorder.sh \
-t/lzma.sh \
 t/m4-inclusion.sh \
 t/maintclean.sh \
 t/maintclean-vpath.sh \
-- 
1.8.3.rc0.19.g7e6a0cc




reply via email to

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