Teach %prep and %uncompress how to handle 7zip tarballs, with the mingw toolchain landing in fedora, this may be useful when crossbuilding Windows sources compressed using 7zip (CxImage is one such project). --- build/parsePrep.c | 4 ++++ configure.ac | 1 + macros.in | 1 + rpmio/macro.c | 3 +++ rpmio/rpmfileutil.c | 4 ++++ rpmio/rpmfileutil.h | 3 ++- 6 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/build/parsePrep.c b/build/parsePrep.c index 1efbcf2..fd4d30c 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -193,6 +193,10 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly) case COMPRESSED_LRZIP: t = "%{__lrzip} -dqo-"; break; + case COMPRESSED_7ZIP: + t = "%{__7zip} x"; + needtar = 0; + break; } zipper = rpmGetPath(t, NULL); if (needtar) { diff --git a/configure.ac b/configure.ac index 4501b5c..622affe 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ fi dnl dnl Find some common programs dnl +AC_PATH_PROG(__7ZIP, 7zip, /usr/bin/7za, $MYPATH) AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH) AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH) AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH) diff --git a/macros.in b/macros.in index b0b78aa..0bf0fa4 100644 --- a/macros.in +++ b/macros.in @@ -31,6 +31,7 @@ #============================================================================== # ---- Generally useful path macros. # +%__7zip @__7ZIP@ %__awk @AWK@ %__bzip2 @__BZIP2@ %__cat @__CAT@ diff --git a/rpmio/macro.c b/rpmio/macro.c index 238ebcd..e5a3463 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -971,6 +971,9 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn, case COMPRESSED_LRZIP: sprintf(be, "%%__lrzip -dqo- %s", b); break; + case COMPRESSED_7ZIP: + sprintf(be, "%%__7zip x %s", b); + break; } b = be; } else if (STREQ("getenv", f, fn)) { diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index 7c229e6..bae9ab9 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -388,6 +388,10 @@ int rpmFileIsCompressed(const char * file, rpmCompressedMagic * compressed) ((magic[0] == 0037) && (magic[1] == 0235)) /* compress */ ) { *compressed = COMPRESSED_OTHER; + } else if ((magic[0] == '7') && (magic[1] == 'z') && + (magic[2] == 0xbc) && (magic[3] == 0xaf) && + (magic[4] == 0x27) && (magic[5] == 0x1c)) { + *compressed = COMPRESSED_7ZIP; } else if (rpmFileHasSuffix(file, ".lzma")) { *compressed = COMPRESSED_LZMA; } diff --git a/rpmio/rpmfileutil.h b/rpmio/rpmfileutil.h index 28c6d8a..52f8fba 100644 --- a/rpmio/rpmfileutil.h +++ b/rpmio/rpmfileutil.h @@ -25,7 +25,8 @@ typedef enum rpmCompressedMagic_e { COMPRESSED_LZMA = 4, /*!< lzma can handle */ COMPRESSED_XZ = 5, /*!< xz can handle */ COMPRESSED_LZIP = 6, /*!< lzip can handle */ - COMPRESSED_LRZIP = 7 /*!< lrzip can handle */ + COMPRESSED_LRZIP = 7, /*!< lrzip can handle */ + COMPRESSED_7ZIP = 8 /*!< 7zip can handle */ } rpmCompressedMagic; /** \ingroup rpmfileutil -- 1.7.10.1 _______________________________________________ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint