From: Sergey Poznyakoff Date: Mon, 29 Dec 2008 09:27:00 +0000 (+0000) Subject: Fix testsuite and bootstrap. Implement -I. X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=tar.git;a=commitdiff_plain;h=7b68ef3d918603f3afb03e939ba72f5cad10edf4;hp=970f999818a52a107a89697666c54397403c09be Fix testsuite. Implement -I. * src/tar.c: Implement -I as a shorthand for --use-compress-program. * doc/tar.texi: Document -I. * tests/pipe.at, tests/shortrec.at: Account for eventual 'Record size' output. * tests/testsuite.at (AT_TAR_CHECK_HOOK): New define (AT_TAR_WITH_HOOK, TAR_IGNREC_HOOK): New macros. --- diff --git a/ChangeLog b/ChangeLog index 7dd05f8..68fe50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-12-29 Sergey Poznyakoff + + * src/tar.c: Implement -I as a shorthand for --use-compress-program. + * doc/tar.texi: Document -I. + * tests/pipe.at, tests/shortrec.at: Account for eventual 'Record + size' output. + * tests/testsuite.at (AT_TAR_CHECK_HOOK): New define + (AT_TAR_WITH_HOOK, TAR_IGNREC_HOOK): New macros. + 2008-11-30 Sergey Poznyakoff * src/xheader.c: Remove duplicate inclusion of fnmatch.h. Reported diff --git a/doc/tar.texi b/doc/tar.texi index cb8bd19..210639e 100644 --- a/doc/tar.texi +++ b/doc/tar.texi @@ -3309,6 +3309,7 @@ name quoting}. @opsummary{use-compress-program} @item --use-compress-program=@var{prog} +@itemx -I=@var{prog} Instructs @command{tar} to access the archive through @var{prog}, which is presumed to be a compression program of some sort. @xref{gzip}. @@ -8570,6 +8571,7 @@ Filter the archive through @command{compress}. Otherwise like @option{--gzip}. @opindex use-compress-program @item --use-compress-program=@var{prog} +@itemx -I=@var{prog} Use external compression program @var{prog}. Use this option if you have a compression program that @GNUTAR{} does not support. There are two requirements to which @var{prog} should comply: @@ -8608,14 +8610,14 @@ Suppose you name it @file{gpgz} and save it somewhere in your archive signed with your private key: @smallexample -$ @kbd{tar -cf foo.tar.gpgz --use-compress=gpgz .} +$ @kbd{tar -cf foo.tar.gpgz -Igpgz .} @end smallexample @noindent -Likewise, the following command will list its contents: +Likewise, the command below will list its contents: @smallexample -$ @kbd{tar -tf foo.tar.gpgz --use-compress=gpgz .} +$ @kbd{tar -tf foo.tar.gpgz -Igpgz .} @end smallexample @ignore diff --git a/src/tar.c b/src/tar.c index ae0c739..8396ad5 100644 --- a/src/tar.c +++ b/src/tar.c @@ -323,7 +323,6 @@ enum TRANSFORM_OPTION, UNQUOTE_OPTION, USAGE_OPTION, - USE_COMPRESS_PROGRAM_OPTION, UTC_OPTION, VERSION_OPTION, VOLNO_FILE_OPTION, @@ -352,7 +351,7 @@ The version control may be set with --backup or VERSION_CONTROL, values are:\n\n /* NOTE: - Available option letters are DEIQY and eqy. Consider the following + Available option letters are DEQY and eqy. Consider the following assignments: [For Solaris tar compatibility =/= Is it important at all?] @@ -360,7 +359,6 @@ The version control may be set with --backup or VERSION_CONTROL, values are:\n\n E use extended headers (--format=posix) [q alias for --occurrence=1 =/= this would better be used for quiet?] - [I same as T =/= will harm star compatibility] y per-file gzip compression Y per-block gzip compression */ @@ -610,7 +608,7 @@ static struct argp_option options[] = { N_("filter the archive through lzma"), GRID+1 }, {"lzop", LZOP_OPTION, 0, 0, N_("filter the archive through lzop"), GRID+8 }, - {"use-compress-program", USE_COMPRESS_PROGRAM_OPTION, N_("PROG"), 0, + {"use-compress-program", 'I', N_("PROG"), 0, N_("filter through PROG (must accept -d)"), GRID+1 }, #undef GRID @@ -1364,12 +1362,6 @@ parse_opt (int key, char *arg, struct argp_state *state) ignore_zeros_option = true; break; - case 'I': - USAGE_ERROR ((0, 0, - _("Warning: the -I option is not supported;" - " perhaps you meant -j or -T?"))); - break; - case 'j': set_use_compress_program_option ("bzip2"); break; @@ -1905,7 +1897,7 @@ parse_opt (int key, char *arg, struct argp_state *state) set_transform_expr (arg); break; - case USE_COMPRESS_PROGRAM_OPTION: + case 'I': set_use_compress_program_option (arg); break; diff --git a/tests/pipe.at b/tests/pipe.at index efca65b..be99212 100644 --- a/tests/pipe.at +++ b/tests/pipe.at @@ -1,7 +1,7 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -30,7 +30,8 @@ AT_SETUP([decompressing from stdin]) AT_KEYWORDS([pipe]) -AT_TAR_CHECK([ +AT_TAR_WITH_HOOK([TAR_IGNREC_HOOK], +[AT_TAR_CHECK([ AT_SORT_PREREQ mkdir directory @@ -49,6 +50,7 @@ directory/file1 directory/file2 separator separator -]) +], +[stderr])]) AT_CLEANUP diff --git a/tests/shortrec.at b/tests/shortrec.at index 3e009fd..179f365 100644 --- a/tests/shortrec.at +++ b/tests/shortrec.at @@ -1,7 +1,7 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2005, 2007, 2008 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 @@ -23,17 +23,22 @@ # used to create the archive. AT_SETUP([short records]) -AT_KEYWORDS([shortrec.at]) +AT_KEYWORDS([shortrec]) -AT_TAR_CHECK([ +AT_TAR_WITH_HOOK([TAR_IGNREC_HOOK], +[AT_TAR_CHECK([ mkdir directory (cd directory && touch a b c d e f g h i j k l m n o p q r) -tar -c -b 1 -f - directory | tar -t -f - >/dev/null +tar -c -b 1 -f - directory | tar -t -f - tar -c -b 1 -f archive directory -tar -t -f archive >/dev/null -tar -t -f - < archive >/dev/null +tar -t -f archive +tar -t -f - < archive rm -r directory +], +[0], +[ignore], +[stderr]) ]) AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index 2fa5392..a12477d 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -1,7 +1,7 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -21,6 +21,7 @@ # We need a recent Autotest. m4_version_prereq([2.52g]) +m4_define([AT_TAR_CHECK_HOOK]) m4_define([AT_TAR_CHECK],[ AT_XFAIL_IF(test -f $[]XFAILFILE) m4_foreach([FMT], @@ -33,9 +34,20 @@ export TEST_TAR_FORMAT TAR_OPTIONS="-H FMT" export TAR_OPTIONS rm -rf * -$1)],$2,$3,$4,$5,$6)]) +$1)],$2,$3,$4,$5,$6) + AT_TAR_CHECK_HOOK]) ]) +m4_define([AT_TAR_WITH_HOOK],[ + m4_pushdef([AT_TAR_CHECK_HOOK],[$1]) + $2 + + m4_popdef([AT_TAR_CHECK_HOOK])]) + +m4_define([TAR_IGNREC_HOOK],[ + AT_CHECK([grep -v '^.*tar: Record size = ' stderr; exit 0]) +]) + m4_define([RE_CHECK],[ AT_DATA([$1.re],[$2]) awk '{print NR " " $[]0}' $1 > $[]$.1