summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorRalf Corsépius <corsepiu@fedoraproject.org>2007-10-10 08:39:01 +0200
committerRalf Corsépius <corsepiu@fedoraproject.org>2007-10-10 08:39:01 +0200
commit272d591973ce001d50c745f1796873e8ad1e8d77 (patch)
tree0ace1ac1896d255fbc6c477b556865c515b06541 /rpmio
parent9f7a8dab5928a60ab641e480f921251a93ffa0be (diff)
downloadlibrpm-tizen-272d591973ce001d50c745f1796873e8ad1e8d77.tar.gz
librpm-tizen-272d591973ce001d50c745f1796873e8ad1e8d77.tar.bz2
librpm-tizen-272d591973ce001d50c745f1796873e8ad1e8d77.zip
Add support for lzma compressed "Sources".
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/macro.c11
-rw-r--r--rpmio/rpmmacro.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 972869304..84b48cedc 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -1044,6 +1044,9 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
case COMPRESSED_ZIP:
sprintf(be, "%%_unzip %s", b);
break;
+ case COMPRESSED_LZMA:
+ sprintf(be, "%%_lzma -dc %s", b);
+ break;
}
b = be;
} else if (STREQ("S", f, fn)) {
@@ -1891,7 +1894,7 @@ int isCompressed(const char * file, rpmCompressedMagic * compressed)
FD_t fd;
ssize_t nb;
int rc = -1;
- unsigned char magic[4];
+ unsigned char magic[13];
*compressed = COMPRESSED_NOT;
@@ -1922,6 +1925,12 @@ int isCompressed(const char * file, rpmCompressedMagic * compressed)
} else if ((magic[0] == 0120) && (magic[1] == 0113) &&
(magic[2] == 0003) && (magic[3] == 0004)) { /* pkzip */
*compressed = COMPRESSED_ZIP;
+ } else if ((magic[ 9] == 0x00) && (magic[10] == 0x00) &&
+ (magic[11] == 0x00) && (magic[12] == 0x00)) {
+ /* lzma */
+ /* FIXME: lzma doesn't have a magic,
+ * consider to additionally check the filename */
+ *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 */
diff --git a/rpmio/rpmmacro.h b/rpmio/rpmmacro.h
index 2b58ecd87..171cdd7e7 100644
--- a/rpmio/rpmmacro.h
+++ b/rpmio/rpmmacro.h
@@ -143,7 +143,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;
/**