Index: build/pack.c =================================================================== --- build/pack.c.orig +++ build/pack.c @@ -479,6 +479,11 @@ int writeRPM(Header *hdrp, unsigned char /* Add prereq on rpm version that understands bzip2 payloads */ (void) rpmlibNeedsFeature(h, "PayloadIsBzip2", "3.0.5-1"); } + if (s[1] == 'l' && s[2] == 'z') { + (void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE, + "lzma", 1); + (void) rpmlibNeedsFeature(h, "PayloadIsLzma", "4.4.2-1"); + } strcpy(buf, rpmio_flags); buf[s - rpmio_flags] = '\0'; (void) headerAddEntry(h, RPMTAG_PAYLOADFLAGS, RPM_STRING_TYPE, buf+1, 1); Index: lib/psm.c =================================================================== --- lib/psm.c.orig +++ lib/psm.c @@ -2097,6 +2097,8 @@ psm->te->h = headerFree(psm->te->h); t = stpcpy(t, ".gzdio"); if (!strcmp(payload_compressor, "bzip2")) t = stpcpy(t, ".bzdio"); + if (!strcmp(payload_compressor, "lzma")) + t = stpcpy(t, ".lzdio"); rc = RPMRC_OK; } break; Index: lib/rpmlibprov.c =================================================================== --- lib/rpmlibprov.c.orig +++ lib/rpmlibprov.c @@ -59,6 +59,9 @@ static struct rpmlibProvides_s rpmlibPro ( RPMSENSE_EQUAL), N_("internal support for lua scripts.") }, #endif + { "rpmlib(PayloadIsLzma)", "4.4.2-1", + (RPMSENSE_RPMLIB|RPMSENSE_EQUAL), + N_("package payload can be compressed using lzma.") }, { NULL, NULL, 0, NULL } }; Index: macros.in =================================================================== --- macros.in.orig +++ macros.in @@ -326,6 +326,7 @@ package or when debugging this package.\ # Compression type and level for source/binary package payloads. # "w9.gzdio" gzip level 9 (default). # "w9.bzdio" bzip2 level 9. +# "w5.lzdio" lzma level 5. (best compromise) # #%_source_payload w9.gzdio %_binary_payload w2.lzdio Index: rpm2cpio.c =================================================================== --- rpm2cpio.c.orig +++ rpm2cpio.c @@ -76,6 +76,8 @@ int main(int argc, char **argv) t = stpcpy(t, ".gzdio"); if (!strcmp(payload_compressor, "bzip2")) t = stpcpy(t, ".bzdio"); + if (!strcmp(payload_compressor, "lzma")) + t = stpcpy(t, ".lzdio"); } gzdi = Fdopen(fdi, rpmio_flags); /* XXX gzdi == fdi */ Index: rpmio/rpmio.h =================================================================== --- rpmio/rpmio.h.orig +++ rpmio/rpmio.h @@ -669,6 +669,10 @@ int ufdGetFile( /*@killref@*/ FD_t sfd, /** */ +/*@observer@*/ /*@unchecked@*/ extern FDIO_t lzdio; + +/** + */ /*@observer@*/ /*@unchecked@*/ extern FDIO_t fadio; /*@=exportlocal@*/ /*@}*/ Index: scripts/rpm2cpio.sh =================================================================== --- scripts/rpm2cpio.sh.orig +++ scripts/rpm2cpio.sh @@ -23,4 +23,14 @@ dl=`expr 256 \* \( 256 \* \( 256 \* $6 + hdrsize=`expr 8 + 16 \* $il + $dl` o=`expr $o + $hdrsize` -dd if=$pkg ibs=$o skip=1 2>/dev/null | gunzip +comp=`dd if="$pkg" ibs=$o skip=1 count=1 2>/dev/null \ + | dd bs=3 count=1 2>/dev/null` + +gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`" +case "$comp" in + BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;; + "$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;; + # no magic in old lzma format, if unknown we assume that's lzma for now + *) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;; + #*) echo "Unrecognized rpm file: $pkg"; return 1 ;; +esac Index: rpmio/Makefile.am =================================================================== --- rpmio/Makefile.am.orig +++ rpmio/Makefile.am @@ -41,7 +41,7 @@ librpmio_la_LDFLAGS = -release 4.4 $(LDF @WITH_MAGIC_LIB@ \ @WITH_ZLIB_LIB@ \ -lpthread -librpmio_la_LIBADD = $(BEECRYPTLOBJS) +librpmio_la_LIBADD = $(BEECRYPTLOBJS) -llzma librpmio_la_DEPENDENCIES = .created .created: