rpm/lzma.diff

101 lines
3.8 KiB
Diff
Raw Normal View History

Add support for lzma compressed archives.
---
build/parsePrep.c | 3 +++
configure.ac | 1 +
file/src/compress.c | 3 +++
macros.in | 1 +
rpmio/macro.c | 5 +++++
rpmio/rpmmacro.h | 3 ++-
6 files changed, 15 insertions(+), 1 deletion(-)
Index: build/parsePrep.c
===================================================================
--- build/parsePrep.c.orig 2004-11-28 21:54:53.000000000 +0100
+++ build/parsePrep.c 2007-10-11 13:12:55.000000000 +0200
@@ -251,6 +251,9 @@ static int checkOwners(const char * urlf
t = "%{_unzipbin} -qq";
needtar = 0;
break;
+ case COMPRESSED_LZMA:
+ t = "%{__lzma} -dc";
+ break;
}
zipper = rpmGetPath(t, NULL);
buf[0] = '\0';
Index: configure.ac
===================================================================
--- configure.ac.orig 2007-10-11 12:46:47.000000000 +0200
+++ configure.ac 2007-10-11 12:46:48.000000000 +0200
@@ -221,6 +221,7 @@ AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $
AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH)
+AC_PATH_PROG(LZMABIN, lzma, /usr/bin/lzma, $MYPATH)
AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
AC_MSG_CHECKING(checking whether id supports -u)
Index: file/src/compress.c
===================================================================
--- file/src/compress.c.orig 2007-10-11 12:46:40.000000000 +0200
+++ file/src/compress.c 2007-10-11 12:46:48.000000000 +0200
@@ -76,6 +76,9 @@ private struct {
{ "PK\3\4", 4, { "gzip", "-cdq", NULL }, 1 }, /* pkzipped, */
/* ...only first file examined */
{ "BZh", 3, { "bzip2", "-cd", NULL }, 1 }, /* bzip2-ed */
+ /* The first bytes of a LZMA compressed file describe some compression
+ settings and thus vary. This handles the most common case: */
+ { "]\000\000",3, { "lzma", "-cdq", NULL }, 1 }, /* lzma-ed */
};
/*@=nullassign@*/
Index: macros.in
===================================================================
--- macros.in.orig 2007-10-11 12:46:46.000000000 +0200
+++ macros.in 2007-10-11 12:46:48.000000000 +0200
@@ -48,6 +48,7 @@
%__id @__ID@
%__install @__INSTALL@
%__ln_s @LN_S@
+%__lzma @LZMABIN@
%__make @__MAKE@
%__mkdir @__MKDIR@
%__mkdir_p @MKDIR_P@
Index: rpmio/macro.c
===================================================================
--- rpmio/macro.c.orig 2005-07-13 11:49:40.000000000 +0200
+++ rpmio/macro.c 2007-10-11 13:11:46.000000000 +0200
@@ -1165,6 +1165,9 @@ doFoo(MacroBuf mb, int negate, const cha
case 3: /* COMPRESSED_ZIP */
sprintf(be, "%%_unzip %s", b);
break;
+ case 4: /* COMPRESSED_LZMA */
+ sprintf(be, "%%_lzma -dc %s", b);
+ break;
}
b = be;
} else if (STREQ("S", f, fn)) {
@@ -2075,6 +2078,8 @@ int isCompressed(const char * file, rpmC
} else if ((magic[0] == 0120) && (magic[1] == 0113) &&
(magic[2] == 0003) && (magic[3] == 0004)) { /* pkzip */
*compressed = COMPRESSED_ZIP;
+ } else if (magic[0] == 0135 && magic[1] == 0 && magic[2] == 0) { /* lzma */
+ *compressed = COMPRESSED_LZMA;
} 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: rpmio/rpmmacro.h
===================================================================
--- rpmio/rpmmacro.h.orig 2004-10-20 12:19:34.000000000 +0200
+++ rpmio/rpmmacro.h 2007-10-11 13:08:47.000000000 +0200
@@ -172,7 +172,8 @@ typedef enum rpmCompressedMagic_e {
COMPRESSED_NOT = 0, /*!< not compressed */
COMPRESSED_OTHER = 1, /*!< gzip can handle */
COMPRESSED_BZIP2 = 2, /*!< bzip2 can handle */
- COMPRESSED_ZIP = 3 /*!< unzip can handle */
+ COMPRESSED_ZIP = 3, /*!< unzip can handle */
+ COMPRESSED_LZMA = 4 /*!< lzma can handle */
} rpmCompressedMagic;
/**