]> Dogcows Code - chaz/tar/commitdiff
Add xz support.
authorSergey Poznyakoff <gray@gnu.org.ua>
Wed, 4 Mar 2009 16:50:31 +0000 (16:50 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Wed, 4 Mar 2009 16:50:31 +0000 (16:50 +0000)
* src/buffer.c, src/suffix.c: Add support for xz compression.
* src/tar.c: New option --xz, for compression/decompression using xz.
Re-assign -J as a short equivalent of --xz.
* doc/tar.texi, NEWS: Document --xz

ChangeLog
NEWS
doc/tar.texi
src/buffer.c
src/suffix.c
src/tar.c

index f205339655de1d0b70737300170de53533e1064a..15840782211071de5ad675bae452a0af28a1ed1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-04  Sergey Poznyakoff  <gray@gnu.org.ua>
+
+       Add xz support.
+       
+       * src/buffer.c, src/suffix.c: Add support for xz compression.
+       * src/tar.c: New option --xz, for compression/decompression using xz.
+       Re-assign -J as a short equivalent of --xz.
+
 2009-01-19  Sergey Poznyakoff  <gray@gnu.org.ua>
 
        * doc/tar.texi: Fix typo.
diff --git a/NEWS b/NEWS
index 41b30ea9214dc16cc49feb9933d43ea8fb950e7e..5324a4d98adf2d24f20c63fb3b3d1a4041c8b2fd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,37 @@
-GNU tar NEWS - User visible changes. 2008-12-27
+GNU tar NEWS - User visible changes. 2009-03-04
 Please send GNU tar bug reports to <bug-tar@gnu.org>
 
+\f
+version 1.21.90 (CVS)
+
+* Support for xz compression
+
+Tar uses xz for compression if at least one of the following
+conditions is met: 
+
+ 1. The option --xz or -J (see below) is used.
+ 2. The xz binary is set as compressor using --use-compress-program option.
+ 3. The file name of the archive being created ends in `.xz' and
+ auto-compress option (-a) is used.
+
+Xz is used for decompression if at least one of the following
+conditions is met: 
+
+ 1. The option --xz or -J is used.
+ 2. The xz binary is set as compressor using --use-compress-program option.
+ 3. The file is recognized as xz compressed stream data.
+
+* Short option -J
+
+The decision to assign -J option was taken just before the XZ format
+has been officially declared stable.  Now, that stable xz tools are
+available, the -J option is re-assigned as a short equivalent of --xz.
+
+* New option -I
+
+The -I option is assigned as a short equivalent for
+--use-compress-program.
+
 \f
 version 1.21 - Sergey Poznyakoff, 2008-12-27
 
index ac867659f28c3b69a62deb24e5f65153a3972761..20f1807576a09bf356ddf22628d818d33727b832 100644 (file)
@@ -2786,7 +2786,6 @@ incremental format.  @xref{Incremental Dumps}.
 
 @opsummary{lzma}
 @item --lzma
-@itemx -J
 
 This option tells @command{tar} to read or write archives through
 @command{lzma}.  @xref{gzip}.
@@ -3359,6 +3358,12 @@ Use wildcards when matching member names with patterns.
 @item --wildcards-match-slash
 Wildcards match @samp{/}.
 @xref{controlling pattern-matching}.
+
+@opsummary{xz}
+@item --xz
+@itemx -J
+Use @command{xz} for compressing or decompressing the archives.  @xref{gzip}.
+
 @end table
 
 @node Short Option Summary
@@ -3380,7 +3385,7 @@ them with the equivalent long option.
 
 @item -G @tab @ref{--incremental}.
 
-@item -J @tab @ref{--lzma}.
+@item -J @tab @ref{--xz}.
 
 @item -K @tab @ref{--starting-file}.
 
@@ -8406,7 +8411,8 @@ Creating a compressed archive is simple: you just specify a
 commands.  The compression option is @option{-z} (@option{--gzip}) to
 create a @command{gzip} compressed archive, @option{-j}
 (@option{--bzip2}) to create a @command{bzip2} compressed archive,
-@option{-J} (@option{--lzma}) to create an @asis{LZMA} compressed
+@option{-J} (@option{--xz}) to create an @asis{XZ} archive, 
+@option{--lzma} to create an @asis{LZMA} compressed
 archive, @option{--lzop} to create an @asis{LSOP} archive, and
 @option{-Z} (@option{--compress}) to use @command{compress} program.
 For example:
@@ -8504,6 +8510,7 @@ suffix.  The following suffixes are recognized:
 @item @samp{.lzma} @tab @command{lzma}
 @item @samp{.tlz} @tab @command{lzma}
 @item @samp{.lzo} @tab @command{lzop}
+@item @samp{.xz} @tab @command{xz}
 @end multitable
 
 @opindex gzip
@@ -8548,13 +8555,17 @@ lose some compressibility.  But this would have make recovering easier.
 So, there are pros and cons.  We'll see!
 
 @opindex bzip2
+@item -J
+@itemx --xz
+Filter the archive through @code{xz}.  Otherwise like
+@option{--gzip}.
+
 @item -j
 @itemx --bzip2
 Filter the archive through @code{bzip2}.  Otherwise like @option{--gzip}.
 
 @opindex lzma
 @item --lzma
-@itemx -J
 Filter the archive through @command{lzma}.  Otherwise like @option{--gzip}.
 
 @opindex lzop
index 5f5457a95571e531a027179b511fdb0c41763d69..a646202a8421323c88cb0ae5865230f89f8a6e05 100644 (file)
@@ -204,7 +204,8 @@ enum compress_type {
   ct_gzip,
   ct_bzip2,
   ct_lzma,
-  ct_lzop
+  ct_lzop,
+  ct_xz
 };
 
 struct zip_magic
@@ -222,8 +223,9 @@ static struct zip_magic const magic[] = {
   { ct_compress, 2, "\037\235", "compress", "-Z" },
   { ct_gzip,     2, "\037\213", "gzip", "-z"  },
   { ct_bzip2,    3, "BZh",      "bzip2", "-j" },
-  { ct_lzma,     6, "\xFFLZMA", "lzma", "-J" }, /* FIXME: ???? */
+  { ct_lzma,     6, "\xFFLZMA", "lzma", "--lzma" }, /* FIXME: ???? */
   { ct_lzop,     4, "\211LZO",  "lzop", "--lzop" },
+  { ct_xz,       6, "\0xFD7zXZ", "-J" },
 };
 
 #define NMAGIC (sizeof(magic)/sizeof(magic[0]))
index 986f34761e65946155312972d09fefbdd9c76994..9080fd6f0cf3f6933700ccabd988b8b86321db7c 100644 (file)
@@ -40,6 +40,7 @@ struct compression_suffix compression_suffixes[] = {
   { S(lzma, lzma) },
   { S(tlz, lzma) },
   { S(lzo, lzop) },
+  { S(xz, xz) },
 #undef S
 };
 
index 8396ad5e4e4e753f2c6284643b1939b7a52e3887..8c83959655b3a0301f02051e9111010b240d2c1c 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -271,6 +271,7 @@ enum
   IGNORE_FAILED_READ_OPTION,
   INDEX_FILE_OPTION,
   KEEP_NEWER_FILES_OPTION,
+  LZMA_OPTION,
   LZOP_OPTION,
   MODE_OPTION,
   MTIME_OPTION,
@@ -593,7 +594,7 @@ static struct argp_option options[] = {
   {"auto-compress", 'a', 0, 0,
    N_("use archive suffix to determine the compression program"), GRID+1 },
   {"no-auto-compress", NO_AUTO_COMPRESS_OPTION, 0, 0,
-   N_("do not use use archive suffix to determine the compression program"),
+   N_("do not use archive suffix to determine the compression program"),
    GRID+1 },
   {"bzip2", 'j', 0, 0,
    N_("filter the archive through bzip2"), GRID+1 },
@@ -604,10 +605,12 @@ static struct argp_option options[] = {
   {"compress", 'Z', 0, 0,
    N_("filter the archive through compress"), GRID+1 },
   {"uncompress", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
-  {"lzma", 'J', 0, 0,
+  {"lzma", LZMA_OPTION, 0, 0,
    N_("filter the archive through lzma"), GRID+1 },
   {"lzop", LZOP_OPTION, 0, 0,
    N_("filter the archive through lzop"), GRID+8 },
+  {"xz", 'J', 0, 0,
+   N_("filter the archive through xz"), GRID+8 },
   {"use-compress-program", 'I', N_("PROG"), 0,
    N_("filter through PROG (must accept -d)"), GRID+1 },
 #undef GRID
@@ -1367,7 +1370,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
 
     case 'J':
-      set_use_compress_program_option ("lzma");
+      set_use_compress_program_option ("xz");
       break;
       
     case 'k':
@@ -1401,6 +1404,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       }
       break;
 
+    case LZMA_OPTION:
+      set_use_compress_program_option ("lzma");
+      break;
+      
     case LZOP_OPTION:
       set_use_compress_program_option ("lzop");
       break;
This page took 0.037896 seconds and 4 git commands to generate.