Add lzip support.
authorVille Skyttä <ville.skytta@iki.fi>
Sun, 24 Apr 2011 12:56:11 +0000 (15:56 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 29 Apr 2011 05:48:56 +0000 (08:48 +0300)
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
build/parsePrep.c
configure.ac
macros.in
rpmio/macro.c
rpmio/rpmfileutil.c
rpmio/rpmfileutil.h

index de2b2a0..35d54b4 100644 (file)
@@ -188,6 +188,9 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
        case COMPRESSED_XZ:
            t = "%{__xz} -dc";
            break;
+       case COMPRESSED_LZIP:
+           t = "%{__lzip} -dc";
+           break;
        }
        zipper = rpmGetPath(t, NULL);
        if (needtar) {
index 13c972d..2f3e5fe 100644 (file)
@@ -106,6 +106,7 @@ AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
+AC_PATH_PROG(__LZIP, lzip, /usr/bin/lzip, $MYPATH)
 AC_PATH_PROG(__XZ, xz, /usr/bin/xz, $MYPATH)
 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
index ca38db1..e4d3997 100644 (file)
--- a/macros.in
+++ b/macros.in
@@ -47,6 +47,7 @@
 %__id_u                        %{__id} -u
 %__install             @__INSTALL@
 %__ln_s                        @LN_S@
+%__lzip                        @__LZIP@
 # Deprecated, use %__xz instead.
 %__lzma                        %__xz --format=lzma
 %__xz                  @__XZ@
index 98830d2..9444283 100644 (file)
@@ -959,6 +959,9 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
         case COMPRESSED_XZ:
             sprintf(be, "%%__xz -dc %s", b);
             break;
+       case COMPRESSED_LZIP:
+           sprintf(be, "%%__lzip -dc %s", b);
+           break;
        }
        b = be;
     } else if (STREQ("getenv", f, fn)) {
index f44eb35..60fe292 100644 (file)
@@ -369,6 +369,9 @@ int rpmFileIsCompressed(const char * file, rpmCompressedMagic * compressed)
               (magic[4] == 0x5a) && (magic[5] == 0x00)) {
        /* new style xz (lzma) with magic */
        *compressed = COMPRESSED_XZ;
+    } else if ((magic[0] == 'L') && (magic[1] == 'Z') &&
+              (magic[2] == 'I') && (magic[3] == 'P')) {
+       *compressed = COMPRESSED_LZIP;
     } else if (((magic[0] == 0037) && (magic[1] == 0213)) || /* gzip */
        ((magic[0] == 0037) && (magic[1] == 0236)) ||   /* old gzip */
        ((magic[0] == 0037) && (magic[1] == 0036)) ||   /* pack */
index 496d7fd..c671415 100644 (file)
@@ -23,7 +23,8 @@ typedef enum rpmCompressedMagic_e {
     COMPRESSED_BZIP2           = 2,    /*!< bzip2 can handle */
     COMPRESSED_ZIP             = 3,    /*!< unzip can handle */
     COMPRESSED_LZMA            = 4,    /*!< lzma can handle */
-    COMPRESSED_XZ              = 5     /*!< xz can handle */
+    COMPRESSED_XZ              = 5,    /*!< xz can handle */
+    COMPRESSED_LZIP            = 6     /*!< lzip can handle */
 } rpmCompressedMagic;
 
 /** \ingroup rpmfileutil