From e254f9b9d4869ea9ee783d3c68a3d2e293e63345 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Skytt=C3=A4?= Date: Sun, 24 Apr 2011 15:57:23 +0300 Subject: [PATCH] Add lrzip support. Signed-off-by: Panu Matilainen --- build/parsePrep.c | 3 +++ configure.ac | 1 + macros.in | 1 + rpmio/macro.c | 3 +++ rpmio/rpmfileutil.c | 3 +++ rpmio/rpmfileutil.h | 3 ++- 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build/parsePrep.c b/build/parsePrep.c index 35d54b4..c0508ec 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -191,6 +191,9 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly) case COMPRESSED_LZIP: t = "%{__lzip} -dc"; break; + case COMPRESSED_LRZIP: + t = "%{__lrzip} -dqo-"; + break; } zipper = rpmGetPath(t, NULL); if (needtar) { diff --git a/configure.ac b/configure.ac index 2f3e5fe..64c5509 100644 --- a/configure.ac +++ b/configure.ac @@ -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(__LRZIP, lrzip, /usr/bin/lrzip, $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) diff --git a/macros.in b/macros.in index e4d3997..dd5207a 100644 --- a/macros.in +++ b/macros.in @@ -47,6 +47,7 @@ %__id_u %{__id} -u %__install @__INSTALL@ %__ln_s @LN_S@ +%__lrzip @__LRZIP@ %__lzip @__LZIP@ # Deprecated, use %__xz instead. %__lzma %__xz --format=lzma diff --git a/rpmio/macro.c b/rpmio/macro.c index 9444283..8ea4819 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -962,6 +962,9 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn, case COMPRESSED_LZIP: sprintf(be, "%%__lzip -dc %s", b); break; + case COMPRESSED_LRZIP: + sprintf(be, "%%__lrzip -dqo- %s", b); + break; } b = be; } else if (STREQ("getenv", f, fn)) { diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index 60fe292..6085a46 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -372,6 +372,9 @@ int rpmFileIsCompressed(const char * file, rpmCompressedMagic * compressed) } else if ((magic[0] == 'L') && (magic[1] == 'Z') && (magic[2] == 'I') && (magic[3] == 'P')) { *compressed = COMPRESSED_LZIP; + } else if ((magic[0] == 'L') && (magic[1] == 'R') && + (magic[2] == 'Z') && (magic[3] == 'I')) { + *compressed = COMPRESSED_LRZIP; } else if (((magic[0] == 0037) && (magic[1] == 0213)) || /* gzip */ ((magic[0] == 0037) && (magic[1] == 0236)) || /* old gzip */ ((magic[0] == 0037) && (magic[1] == 0036)) || /* pack */ diff --git a/rpmio/rpmfileutil.h b/rpmio/rpmfileutil.h index c671415..28c6d8a 100644 --- a/rpmio/rpmfileutil.h +++ b/rpmio/rpmfileutil.h @@ -24,7 +24,8 @@ typedef enum rpmCompressedMagic_e { COMPRESSED_ZIP = 3, /*!< unzip can handle */ COMPRESSED_LZMA = 4, /*!< lzma can handle */ COMPRESSED_XZ = 5, /*!< xz can handle */ - COMPRESSED_LZIP = 6 /*!< lzip can handle */ + COMPRESSED_LZIP = 6, /*!< lzip can handle */ + COMPRESSED_LRZIP = 7 /*!< lrzip can handle */ } rpmCompressedMagic; /** \ingroup rpmfileutil -- 2.7.4