rpm/lzma-payload.diff

109 lines
3.9 KiB
Diff

diff -purN build/pack.c build/pack.c
--- build/pack.c 2007-12-03 18:24:44.000000000 +0100
+++ build/pack.c 2007-12-03 18:49:50.000000000 +0100
@@ -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);
diff -purN lib/psm.c lib/psm.c
--- lib/psm.c 2007-12-03 18:24:45.000000000 +0100
+++ lib/psm.c 2007-12-03 19:07:03.000000000 +0100
@@ -2068,6 +2068,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;
diff -purN lib/rpmlibprov.c lib/rpmlibprov.c
--- lib/rpmlibprov.c 2007-12-03 18:24:45.000000000 +0100
+++ lib/rpmlibprov.c 2007-12-03 19:14:35.000000000 +0100
@@ -56,7 +56,10 @@ static struct rpmlibProvides_s rpmlibPro
( RPMSENSE_EQUAL),
N_("internal support for lua scripts.") },
#endif
- { NULL, NULL, 0, NULL }
+ { "rpmlib(PayloadIsLzma)", "4.4.2-1",
+ (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
+ N_("package payload can be compressed using lzma.") },
+ { NULL, NULL, 0, NULL }
};
void rpmShowRpmlibProvides(FILE * fp)
diff -purN macros.in macros.in
--- macros.in 2007-12-03 18:24:43.000000000 +0100
+++ macros.in 2007-12-03 18:49:50.000000000 +0100
@@ -321,6 +321,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 w9.gzdio
diff -purN rpm2cpio.c rpm2cpio.c
--- rpm2cpio.c 2007-12-03 18:24:43.000000000 +0100
+++ rpm2cpio.c 2007-12-03 18:49:50.000000000 +0100
@@ -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 */
diff -purN rpmio/rpmio.h rpmio/rpmio.h
--- rpmio/rpmio.h 2007-12-03 18:24:43.000000000 +0100
+++ rpmio/rpmio.h 2007-12-03 19:19:56.000000000 +0100
@@ -662,6 +662,10 @@ int ufdGetFile( /*@killref@*/ FD_t sfd,
/**
*/
+/*@observer@*/ /*@unchecked@*/ extern FDIO_t lzdio;
+
+/**
+ */
/*@observer@*/ /*@unchecked@*/ extern FDIO_t fadio;
/*@=exportlocal@*/
/*@}*/
--- scripts/rpm2cpio.sh 2002-02-04 17:53:52.000000000 +0100
+++ scripts/rpm2cpio.sh 2007-11-30 17:28:51.000000000 +0100
@@ -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
--- rpmio/Makefile.am.lzma 2008-03-12 15:19:38.000000000 +0100
+++ rpmio/Makefile.am 2008-03-12 15:19:54.000000000 +0100
@@ -41,7 +41,7 @@
@WITH_MAGIC_LIB@ \
@WITH_ZLIB_LIB@ \
-lpthread
-librpmio_la_LIBADD = $(BEECRYPTLOBJS)
+librpmio_la_LIBADD = $(BEECRYPTLOBJS) -llzma
librpmio_la_DEPENDENCIES = .created
.created: