diff --git a/build.diff b/build.diff index 1b61524..9b01455 100644 --- a/build.diff +++ b/build.diff @@ -2,10 +2,10 @@ Many changes to Makefiles/autogen and the like to make it build on SUSE systems. Index: Makefile.am -=================================================================== ---- Makefile.am.orig +================================================================================ +--- Makefile.am +++ Makefile.am -@@ -15,7 +15,7 @@ EXTRA_DIST = CHANGES CREDITS Doxyheader +@@ -15,7 +15,7 @@ EXTRA_DIST = CHANGES CREDITS Doxyheader po/*.in po/*.po po/rpm.pot \ rpm.magic rpmpopt-$(VERSION) rpmqv.c rpm.c @@ -14,9 +14,7 @@ Index: Makefile.am INCLUDES = \ -I$(top_srcdir)/build \ -Index: autogen.sh -=================================================================== ---- autogen.sh.orig +--- autogen.sh +++ autogen.sh @@ -26,12 +26,12 @@ case $libtoolize in esac @@ -49,11 +47,11 @@ Index: autogen.sh if [ -d neon ]; then (echo "--- neon"; cd neon; ./autogen.sh "$@") fi -+(echo "--- db"; cd db/dist; libtoolize --copy --force ; cp /usr/share/aclocal/libtool.m4 aclocal/libtool.ac ; ./s_config ) ++(echo "--- db"; cd db/dist; libtoolize --copy --force ; rm aclocal/libtool.ac ; ./s_config ) echo "--- rpm" $libtoolize --copy --force -@@ -66,7 +68,7 @@ if [ "$1" = "--noconfigure" ]; then +@@ -66,7 +68,7 @@ if [ "$1" = "--noconfigure" ]; then exit 0; fi @@ -62,9 +60,7 @@ Index: autogen.sh if [ -d /usr/share/man ]; then mandir=/usr/share/man infodir=/usr/share/info -Index: build/Makefile.am -=================================================================== ---- build/Makefile.am.orig +--- build/Makefile.am +++ build/Makefile.am @@ -22,7 +22,7 @@ pkgincdir = $(pkgincludedir) pkginc_HEADERS = rpmbuild.h rpmfc.h rpmfile.h rpmspec.h @@ -75,9 +71,7 @@ Index: build/Makefile.am usrlibdir = $(libdir)@MARK64@ usrlib_LTLIBRARIES = librpmbuild.la -Index: configure.ac -=================================================================== ---- configure.ac.orig +--- configure.ac +++ configure.ac @@ -1,30 +1,3 @@ - @@ -316,9 +310,7 @@ Index: configure.ac AC_CONFIG_FILES([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile -Index: db3/configure -=================================================================== ---- db3/configure.orig +--- db3/configure +++ db3/configure @@ -10,9 +10,9 @@ rm -f config.cache # XXX edit CFLAGS= ... out of invocation args ??? @@ -333,9 +325,7 @@ Index: db3/configure mv Makefile Makefile.orig cat Makefile.orig | sed -e '/^install[:-]/c\ -Index: file/src/Makefile.am -=================================================================== ---- file/src/Makefile.am.orig +--- file/src/Makefile.am +++ file/src/Makefile.am @@ -26,7 +26,7 @@ libmagic_la_LDFLAGS = -version-info 1:0: @@ -346,9 +336,7 @@ Index: file/src/Makefile.am file_LDADD = libmagic.la listobjs: -Index: installplatform -=================================================================== ---- installplatform.orig +--- installplatform +++ installplatform @@ -62,11 +62,11 @@ for SUBST in $SUBSTS ; do sparcv9-linux) MULTILIBNO=1 ;; @@ -375,9 +363,7 @@ Index: installplatform esac cat $PLATFORM \ -Index: lib/Makefile.am -=================================================================== ---- lib/Makefile.am.orig +--- lib/Makefile.am +++ lib/Makefile.am @@ -29,7 +29,7 @@ noinst_HEADERS = \ mylibs = librpm.la @@ -388,9 +374,7 @@ Index: lib/Makefile.am usrlibdir = $(libdir)@MARK64@ usrlib_LTLIBRARIES = librpm.la -Index: po/Makefile.in -=================================================================== ---- po/Makefile.in.orig +--- po/Makefile.in +++ po/Makefile.in @@ -29,7 +29,7 @@ gettextsrcdir = $(datadir)/gettext/po INSTALL = /usr/bin/install -c @@ -401,9 +385,7 @@ Index: po/Makefile.in CC = gcc GMSGFMT = /usr/bin/msgfmt -Index: po/Makefile.in.in -=================================================================== ---- po/Makefile.in.in.orig +--- po/Makefile.in.in +++ po/Makefile.in.in @@ -29,7 +29,7 @@ gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ @@ -414,9 +396,7 @@ Index: po/Makefile.in.in CC = @CC@ GMSGFMT = @GMSGFMT@ -Index: popt/autogen.sh -=================================================================== ---- popt/autogen.sh.orig +--- popt/autogen.sh +++ popt/autogen.sh @@ -28,7 +28,7 @@ fi @@ -427,9 +407,7 @@ Index: popt/autogen.sh $srcdir/configure --prefix=/usr "$@" else $srcdir/configure "$@" -Index: popt/configure.ac -=================================================================== ---- popt/configure.ac.orig +--- popt/configure.ac +++ popt/configure.ac @@ -1,11 +1,12 @@ AC_INIT(popt.h) @@ -446,9 +424,7 @@ Index: popt/configure.ac AC_ISC_POSIX -Index: popt/po/Makefile.in -=================================================================== ---- popt/po/Makefile.in.orig +--- popt/po/Makefile.in +++ popt/po/Makefile.in @@ -29,7 +29,7 @@ gettextsrcdir = $(datadir)/gettext/po INSTALL = /usr/bin/install -c @@ -459,9 +435,7 @@ Index: popt/po/Makefile.in CC = gcc GMSGFMT = /usr/bin/msgfmt -Index: popt/po/Makefile.in.in -=================================================================== ---- popt/po/Makefile.in.in.orig +--- popt/po/Makefile.in.in +++ popt/po/Makefile.in.in @@ -29,7 +29,7 @@ gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ @@ -472,9 +446,7 @@ Index: popt/po/Makefile.in.in CC = @CC@ GMSGFMT = @GMSGFMT@ -Index: rpmdb/Makefile.am -=================================================================== ---- rpmdb/Makefile.am.orig +--- rpmdb/Makefile.am +++ rpmdb/Makefile.am @@ -31,7 +31,7 @@ noinst_HEADERS = fprint.h header_interna pkgbindir = @RPMCONFIGDIR@ @@ -494,9 +466,7 @@ Index: rpmdb/Makefile.am usrlibdir = $(libdir)@MARK64@ usrlib_LTLIBRARIES = librpmdb.la -Index: rpmio/Makefile.am -=================================================================== ---- rpmio/Makefile.am.orig +--- rpmio/Makefile.am +++ rpmio/Makefile.am @@ -24,9 +24,9 @@ pkginc_HEADERS = \ rpmsq.h rpmsw.h ugid.h @@ -528,9 +498,7 @@ Index: rpmio/Makefile.am done \ fi touch $@ -Index: scripts/Makefile.am -=================================================================== ---- scripts/Makefile.am.orig +--- scripts/Makefile.am +++ scripts/Makefile.am @@ -6,6 +6,7 @@ EXTRA_DIST = \ brp-compress brp-python-bytecompile brp-java-gcjcompile brp-redhat \ diff --git a/db.diff b/db.diff index 121ae44..e608601 100644 --- a/db.diff +++ b/db.diff @@ -1,5 +1,5 @@ ---- db/db/db.c.orig 2004-11-11 15:58:46.000000000 +0000 -+++ db/db/db.c 2005-12-15 16:17:45.000000000 +0000 +--- db/db/db.c ++++ db/db/db.c @@ -591,6 +591,8 @@ __db_dbenv_mpool(dbp, fname, flags) (F_ISSET(dbp, DB_AM_NOT_DURABLE) ? DB_TXN_NOT_DURABLE : 0), 0, dbp->pgsize)) != 0) @@ -9,8 +9,8 @@ return (0); } ---- db/db/db_iface.c.orig 2004-10-16 01:31:54.000000000 +0000 -+++ db/db/db_iface.c 2005-12-15 16:17:45.000000000 +0000 +--- db/db/db_iface.c ++++ db/db/db_iface.c @@ -1068,7 +1068,7 @@ __db_open_arg(dbp, txn, fname, dname, ty #define OKFLAGS \ (DB_AUTO_COMMIT | DB_CREATE | DB_DIRTY_READ | DB_EXCL | \ @@ -20,8 +20,8 @@ if ((ret = __db_fchk(dbenv, "DB->open", flags, OKFLAGS)) != 0) return (ret); if (LF_ISSET(DB_EXCL) && !LF_ISSET(DB_CREATE)) ---- db/dbinc/db.in.orig 2004-10-16 01:31:54.000000000 +0000 -+++ db/dbinc/db.in 2005-12-15 16:17:45.000000000 +0000 +--- db/dbinc/db.in ++++ db/dbinc/db.in @@ -260,6 +260,7 @@ struct __db_dbt { #define DB_FCNTL_LOCKING 0x0002000 /* UNDOC: fcntl(2) locking. */ #define DB_RDWRMASTER 0x0004000 /* UNDOC: allow subdb master open R/W */ @@ -30,8 +30,8 @@ /* * Flags private to DB_ENV->txn_begin. ---- db/dbinc/mp.h.orig 2004-10-16 01:31:54.000000000 +0000 -+++ db/dbinc/mp.h 2005-12-15 16:25:56.000000000 +0000 +--- db/dbinc/mp.h ++++ db/dbinc/mp.h @@ -309,6 +309,7 @@ struct __mpoolfile { #define MP_FAKE_UOC 0x080 /* Unlink_on_close field: fake flag. */ #define MP_NOT_DURABLE 0x100 /* File is not durable. */ @@ -40,8 +40,55 @@ u_int32_t flags; }; ---- db/mp/mp_sync.c.orig 2004-11-11 15:58:48.000000000 +0000 -+++ db/mp/mp_sync.c 2005-12-15 16:23:57.000000000 +0000 +--- db/dist/aclocal/options.ac ++++ db/dist/aclocal/options.ac +@@ -277,10 +277,6 @@ fi + + # Uniquename excludes C++, Java, RPC. + if test "$db_cv_uniquename" = "yes"; then +- if test "$db_cv_rpc" = "yes"; then +- AC_MSG_ERROR( +- [--with-uniquename is not compatible with --enable-rpc]) +- fi + if test "$db_cv_cxx" = "yes"; then + AC_MSG_ERROR( + [--with-uniquename is not compatible with --enable-cxx]) +--- db/dist/s_config ++++ db/dist/s_config +@@ -8,7 +8,8 @@ trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 + . ./RELEASE + + echo "autoconf: building aclocal.m4..." +-cat aclocal/*.ac aclocal_java/*.ac > aclocal.m4 ++cat aclocal/*.ac aclocal_java/*.ac > acinclude.m4 ++aclocal + + echo "autoconf: running autoheader to build config.hin..." + rm -f config.hin +@@ -20,14 +21,13 @@ rm -f configure + autoconf + + # Edit version information we couldn't pre-compute. +-(echo "1,\$s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" && +- echo "1,\$s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" && +- echo "1,\$s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" && +- echo "1,\$s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" && +- echo "1,\$s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" && +- echo "1,\$s/__EDIT_DB_VERSION__/$DB_VERSION/g" && +- echo "w" && +- echo "q") | ed configure ++sed -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \ ++ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \ ++ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \ ++ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \ ++ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \ ++ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" \ ++ -i configure + + rm -rf autom4te.cache + chmod 555 configure +--- db/mp/mp_sync.c ++++ db/mp/mp_sync.c @@ -553,7 +553,7 @@ done: /* if (ret == 0 && (op == DB_SYNC_CACHE || op == DB_SYNC_FILE)) { if (dbmfp == NULL) @@ -70,42 +117,3 @@ /* * Expects caller to be holding the region lock: we're using the path * name and __memp_nameop might try and rename the file. ---- db/dist/s_config.orig 2003-12-15 21:42:41.000000000 +0000 -+++ db/dist/s_config 2005-02-11 14:44:09.018907747 +0000 -@@ -20,14 +20,15 @@ - autoconf - - # Edit version information we couldn't pre-compute. --(echo "1,\$s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" && -- echo "1,\$s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" && -- echo "1,\$s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" && -- echo "1,\$s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" && -- echo "1,\$s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" && -- echo "1,\$s/__EDIT_DB_VERSION__/$DB_VERSION/g" && -- echo "w" && -- echo "q") | ed configure -+mv configure configure.old -+sed -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \ -+ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \ -+ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \ -+ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \ -+ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \ -+ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" \ -+< configure.old > configure -+rm -f configure.old - - rm -rf autom4te.cache - chmod 555 configure ---- db/dist/aclocal/options.ac.orig 2005-12-15 16:43:14.000000000 +0000 -+++ db/dist/aclocal/options.ac 2005-12-15 16:43:40.000000000 +0000 -@@ -277,10 +277,6 @@ fi - - # Uniquename excludes C++, Java, RPC. - if test "$db_cv_uniquename" = "yes"; then -- if test "$db_cv_rpc" = "yes"; then -- AC_MSG_ERROR( -- [--with-uniquename is not compatible with --enable-rpc]) -- fi - if test "$db_cv_cxx" = "yes"; then - AC_MSG_ERROR( - [--with-uniquename is not compatible with --enable-cxx]) diff --git a/lzma-payload-2.diff b/lzma-payload-2.diff new file mode 100644 index 0000000..386b6d3 --- /dev/null +++ b/lzma-payload-2.diff @@ -0,0 +1,399 @@ +--- rpmio/rpmio.c.orig 2008-03-18 13:29:28.000000000 +0000 ++++ rpmio/rpmio.c 2008-03-18 15:41:14.000000000 +0000 +@@ -80,6 +80,7 @@ static int inet_aton(const char *cp, str + #define FDONLY(fd) assert(fdGetIo(fd) == fdio) + #define GZDONLY(fd) assert(fdGetIo(fd) == gzdio) + #define BZDONLY(fd) assert(fdGetIo(fd) == bzdio) ++#define LZDONLY(fd) assert(fdGetIo(fd) == lzdio) + + #define UFDONLY(fd) /* assert(fdGetIo(fd) == ufdio) */ + +@@ -185,6 +186,8 @@ static /*@observer@*/ const char * fdbg( + } else if (fps->io == bzdio) { + sprintf(be, "BZD %p fdno %d", fps->fp, fps->fdno); + #endif ++ } else if (fps->io == lzdio) { ++ sprintf(be, "LZD %p fdno %d", fps->fp, fps->fdno); + } else if (fps->io == fpio) { + /*@+voidabstract@*/ + sprintf(be, "%s %p(%d) fdno %d", +@@ -2629,6 +2632,348 @@ FDIO_t bzdio = /*@-compmempass@*/ &bzdio + /*@=moduncon@*/ + #endif /* HAVE_BZLIB_H */ + ++#include ++#include ++#include ++ ++#define kBufferSize (1 << 15) ++ ++typedef struct lzfile { ++ /* IO buffer */ ++ uint8_t buf[kBufferSize]; ++ ++ lzma_stream strm; ++ ++ FILE *file; ++ ++ int encoding; ++ int eof; ++ ++} LZFILE; ++ ++static LZFILE *lzopen_internal(const char *path, const char *mode, int fd) ++{ ++ int level = 5; ++ int encoding = 0; ++ FILE *fp; ++ LZFILE *lzfile; ++ lzma_ret ret; ++ ++ for (; *mode; mode++) { ++ if (*mode == 'w') ++ encoding = 1; ++ else if (*mode == 'r') ++ encoding = 0; ++ else if (*mode >= '1' && *mode <= '9') ++ level = *mode - '0'; ++ } ++ if (fd != -1) ++ fp = fdopen(fd, encoding ? "w" : "r"); ++ else ++ fp = fopen(path, encoding ? "w" : "r"); ++ if (!fp) ++ return 0; ++ lzfile = calloc(1, sizeof(*lzfile)); ++ if (!lzfile) { ++ fclose(fp); ++ return 0; ++ } ++ lzfile->file = fp; ++ lzfile->encoding = encoding; ++ lzfile->eof = 0; ++ lzfile->strm = LZMA_STREAM_INIT_VAR; ++ if (encoding) { ++ lzma_options_alone alone; ++ alone.uncompressed_size = LZMA_VLI_VALUE_UNKNOWN; ++ memcpy(&alone.lzma, &lzma_preset_lzma[level - 1], sizeof(alone.lzma)); ++ ret = lzma_alone_encoder(&lzfile->strm, &alone); ++ } else { ++ ret = lzma_auto_decoder(&lzfile->strm, 0, 0); ++ } ++ if (ret != LZMA_OK) { ++ fclose(fp); ++ free(lzfile); ++ return 0; ++ } ++ return lzfile; ++} ++ ++static LZFILE *lzopen(const char *path, const char *mode) ++{ ++ return lzopen_internal(path, mode, -1); ++} ++ ++static LZFILE *lzdopen(int fd, const char *mode) ++{ ++ if (fd < 0) ++ return 0; ++ return lzopen_internal(0, mode, fd); ++} ++ ++static int lzflush(LZFILE *lzfile) ++{ ++ return fflush(lzfile->file); ++} ++ ++static int lzclose(LZFILE *lzfile) ++{ ++ lzma_ret ret; ++ int n; ++ ++ if (!lzfile) ++ return -1; ++ if (lzfile->encoding) { ++ for (;;) { ++ lzfile->strm.avail_out = kBufferSize; ++ lzfile->strm.next_out = lzfile->buf; ++ ret = lzma_code(&lzfile->strm, LZMA_FINISH); ++ if (ret != LZMA_OK && ret != LZMA_STREAM_END) ++ return -1; ++ n = kBufferSize - lzfile->strm.avail_out; ++ if (n && fwrite(lzfile->buf, 1, n, lzfile->file) != n) ++ return -1; ++ if (ret == LZMA_STREAM_END) ++ break; ++ } ++ } ++ lzma_end(&lzfile->strm); ++ return fclose(lzfile->file); ++ free(lzfile); ++} ++ ++static ssize_t lzread(LZFILE *lzfile, void *buf, size_t len) ++{ ++ lzma_ret ret; ++ int eof = 0; ++ ++ if (!lzfile || lzfile->encoding) ++ return -1; ++ if (lzfile->eof) ++ return 0; ++ lzfile->strm.next_out = buf; ++ lzfile->strm.avail_out = len; ++ for (;;) { ++ if (!lzfile->strm.avail_in) { ++ lzfile->strm.next_in = lzfile->buf; ++ lzfile->strm.avail_in = fread(lzfile->buf, 1, kBufferSize, lzfile->file); ++ if (!lzfile->strm.avail_in) ++ eof = 1; ++ } ++ ret = lzma_code(&lzfile->strm, LZMA_RUN); ++ if (ret == LZMA_STREAM_END) { ++ lzfile->eof = 1; ++ return len - lzfile->strm.avail_out; ++ } ++ if (ret != LZMA_OK) ++ return -1; ++ if (!lzfile->strm.avail_out) ++ return len; ++ if (eof) ++ return -1; ++ } ++} ++ ++static ssize_t lzwrite(LZFILE *lzfile, void *buf, size_t len) ++{ ++ lzma_ret ret; ++ int n; ++ if (!lzfile || !lzfile->encoding) ++ return -1; ++ if (!len) ++ return 0; ++ lzfile->strm.next_in = buf; ++ lzfile->strm.avail_in = len; ++ for (;;) { ++ lzfile->strm.next_out = lzfile->buf; ++ lzfile->strm.avail_out = kBufferSize; ++ ret = lzma_code(&lzfile->strm, LZMA_RUN); ++ if (ret != LZMA_OK) ++ return -1; ++ n = kBufferSize - lzfile->strm.avail_out; ++ if (n && fwrite(lzfile->buf, 1, n, lzfile->file) != n) ++ return -1; ++ if (!lzfile->strm.avail_in) ++ return len; ++ } ++} ++ ++/* =============================================================== */ ++ ++static inline /*@dependent@*/ void * lzdFileno(FD_t fd) ++ /*@*/ ++{ ++ void * rc = NULL; ++ int i; ++ ++ FDSANE(fd); ++ for (i = fd->nfps; i >= 0; i--) { ++/*@-boundsread@*/ ++ FDSTACK_t * fps = &fd->fps[i]; ++/*@=boundsread@*/ ++ if (fps->io != lzdio) ++ continue; ++ rc = fps->fp; ++ break; ++ } ++ ++ return rc; ++} ++ ++/*@-globuse@*/ ++static /*@null@*/ FD_t lzdOpen(const char * path, const char * mode) ++ /*@globals fileSystem @*/ ++ /*@modifies fileSystem @*/ ++{ ++ FD_t fd; ++ LZFILE *lzfile; ++ if ((lzfile = lzopen(path, mode)) == NULL) ++ return NULL; ++ fd = fdNew("open (lzdOpen)"); ++ fdPop(fd); fdPush(fd, lzdio, lzfile, -1); ++ return fdLink(fd, "lzdOpen"); ++} ++/*@=globuse@*/ ++ ++ ++/*@-globuse@*/ ++static /*@null@*/ FD_t lzdFdopen(void * cookie, const char * fmode) ++ /*@globals fileSystem, internalState @*/ ++ /*@modifies fileSystem, internalState @*/ ++{ ++ FD_t fd = c2f(cookie); ++ int fdno; ++ LZFILE *lzfile; ++ ++ if (fmode == NULL) return NULL; ++ fdno = fdFileno(fd); ++ fdSetFdno(fd, -1); /* XXX skip the fdio close */ ++ if (fdno < 0) return NULL; ++ lzfile = lzdopen(fdno, fmode); ++ if (lzfile == NULL) return NULL; ++ fdPush(fd, lzdio, lzfile, fdno); ++ return fdLink(fd, "lzdFdopen"); ++} ++/*@=globuse@*/ ++ ++/*@-globuse@*/ ++static int lzdFlush(FD_t fd) ++ /*@globals fileSystem @*/ ++ /*@modifies fileSystem @*/ ++{ ++ return lzflush(lzdFileno(fd)); ++} ++/*@=globuse@*/ ++ ++/* =============================================================== */ ++/*@-globuse@*/ ++/*@-mustmod@*/ /* LCL: *buf is modified */ ++static ssize_t lzdRead(void * cookie, /*@out@*/ char * buf, size_t count) ++ /*@globals fileSystem, internalState @*/ ++ /*@modifies *buf, fileSystem, internalState @*/ ++{ ++ FD_t fd = c2f(cookie); ++ LZFILE *lzfile; ++ ssize_t rc = 0; ++ ++ if (fd->bytesRemain == 0) return 0; /* XXX simulate EOF */ ++ lzfile = lzdFileno(fd); ++ fdstat_enter(fd, FDSTAT_READ); ++ if (lzfile) ++ /*@-compdef@*/ ++ rc = lzread(lzfile, buf, count); ++ /*@=compdef@*/ ++ if (rc == -1) { ++ fd->errcookie = "Lzma: decoding error"; ++ } else if (rc >= 0) { ++ fdstat_exit(fd, FDSTAT_READ, rc); ++ /*@-compdef@*/ ++ if (fd->ndigests && rc > 0) fdUpdateDigests(fd, (void *)buf, rc); ++ /*@=compdef@*/ ++ } ++ return rc; ++} ++/*@=mustmod@*/ ++/*@=globuse@*/ ++ ++/*@-globuse@*/ ++static ssize_t lzdWrite(void * cookie, const char * buf, size_t count) ++/*@globals fileSystem, internalState @*/ ++/*@modifies fileSystem, internalState @*/ ++{ ++ FD_t fd = c2f(cookie); ++ LZFILE *lzfile; ++ ssize_t rc = 0; ++ ++ if (fd == NULL || fd->bytesRemain == 0) return 0; /* XXX simulate EOF */ ++ ++ if (fd->ndigests && count > 0) fdUpdateDigests(fd, (void *)buf, count); ++ ++ lzfile = lzdFileno(fd); ++ ++ fdstat_enter(fd, FDSTAT_WRITE); ++ rc = lzwrite(lzfile, (void *)buf, count); ++ if (rc < 0) { ++ fd->errcookie = "Lzma: encoding error"; ++ } else if (rc > 0) { ++ fdstat_exit(fd, FDSTAT_WRITE, rc); ++ } ++ return rc; ++} ++ ++static inline int lzdSeek(void * cookie, /*@unused@*/ _libio_pos_t pos, ++ /*@unused@*/ int whence) ++ /*@*/ ++{ ++ FD_t fd = c2f(cookie); ++ ++ LZDONLY(fd); ++ return -2; ++} ++ ++static int lzdClose( /*@only@*/ void * cookie) ++ /*@globals fileSystem, internalState @*/ ++ /*@modifies fileSystem, internalState @*/ ++{ ++ FD_t fd = c2f(cookie); ++ LZFILE *lzfile; ++ int rc; ++ ++ lzfile = lzdFileno(fd); ++ ++ if (lzfile == NULL) return -2; ++ fdstat_enter(fd, FDSTAT_CLOSE); ++ /*@-dependenttrans@*/ ++ rc = lzclose(lzfile); ++ /*@=dependenttrans@*/ ++ ++ /* XXX TODO: preserve fd if errors */ ++ ++ if (fd) { ++ if (rc == -1) { ++ fd->errcookie = strerror(ferror(lzfile->file)); ++ } else if (rc >= 0) { ++ fdstat_exit(fd, FDSTAT_CLOSE, rc); ++ } ++ } ++ ++DBGIO(fd, (stderr, "==>\tlzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, fdbg(fd))); ++ ++ if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "LZDIO", stderr); ++ /*@-branchstate@*/ ++ if (rc == 0) ++ fd = fdFree(fd, "open (lzdClose)"); ++ /*@=branchstate@*/ ++ return rc; ++} ++ ++/*@-type@*/ /* LCL: function typedefs */ ++static struct FDIO_s lzdio_s = { ++ lzdRead, lzdWrite, lzdSeek, lzdClose, XfdLink, XfdFree, XfdNew, fdFileno, ++ NULL, lzdOpen, lzdFileno, lzdFlush, NULL, NULL, NULL, NULL, NULL ++}; ++/*@=type@*/ ++FDIO_t lzdio = /*@-compmempass@*/ &lzdio_s /*@=compmempass@*/ ; ++ + /* =============================================================== */ + /*@observer@*/ + static const char * getFdErrstr (FD_t fd) +@@ -2647,7 +2992,9 @@ static const char * getFdErrstr (FD_t fd + errstr = fd->errcookie; + } else + #endif /* HAVE_BZLIB_H */ +- ++ if (fdGetIo(fd) == lzdio) { ++ errstr = fd->errcookie; ++ } else + { + errstr = (fd->syserrno ? strerror(fd->syserrno) : ""); + } +@@ -2961,6 +3308,9 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n" + fd = bzdFdopen(fd, zstdio); + /*@=internalglobs@*/ + #endif ++ } else if (!strcmp(end, "lzdio")) { ++ iof = lzdio; ++ fd = lzdFdopen(fd, zstdio); + } else if (!strcmp(end, "ufdio")) { + iof = ufdio; + } else if (!strcmp(end, "fpio")) { +@@ -3148,6 +3498,9 @@ int Ferror(FD_t fd) + ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0; + i--; /* XXX fdio under bzdio always has fdno == -1 */ + #endif ++ } else if (fps->io == lzdio) { ++ ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0; ++ i--; /* XXX fdio under lzdio always has fdno == -1 */ + } else { + /* XXX need to check ufdio/gzdio/bzdio/fdio errors correctly. */ + ec = (fdFileno(fd) < 0 ? -1 : 0); diff --git a/lzma-payload.diff b/lzma-payload.diff new file mode 100644 index 0000000..2f232f0 --- /dev/null +++ b/lzma-payload.diff @@ -0,0 +1,108 @@ +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: diff --git a/rpm-python.spec b/rpm-python.spec index 4317ddd..97fae89 100644 --- a/rpm-python.spec +++ b/rpm-python.spec @@ -17,7 +17,7 @@ License: GPL v2 or later Group: System/Packages Summary: Python Bindings for Manipulating RPM Packages Version: 4.4.2 -Release: 212 +Release: 220 Requires: rpm = %{version} %py_requires Source99: rpm.spec diff --git a/rpm.changes b/rpm.changes index 1cc1780..28601e5 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,31 @@ +------------------------------------------------------------------- +Tue Mar 18 17:12:00 CET 2008 - mls@suse.de + +- make ia32 compatible to ia64, like it was in SLES9 [bnc#367705] +- fix memory leak and endless loops in lzma code +- make rpm provide the right lzma rpmlib name + +------------------------------------------------------------------- +Tue Mar 18 13:33:25 CET 2008 - schwab@suse.de + +- Fix broken db configuration. + +------------------------------------------------------------------- +Fri Mar 14 21:54:57 CET 2008 - coolo@suse.de + +- change it to the "alone" file format used by stable + distributions of 7zip and lzma + +------------------------------------------------------------------- +Fri Mar 14 18:05:18 CET 2008 - coolo@suse.de + +- daring some more compression time to get an overall picture + +------------------------------------------------------------------- +Thu Mar 13 08:11:47 CET 2008 - coolo@suse.de + +- support lzma payload using liblzma + ------------------------------------------------------------------- Thu Feb 21 21:58:39 CET 2008 - mls@suse.de diff --git a/rpm.spec b/rpm.spec index c4f0e67..abdb531 100644 --- a/rpm.spec +++ b/rpm.spec @@ -14,14 +14,14 @@ Name: rpm License: GPL v2 or later Group: System/Packages -BuildRequires: libbz2-devel ncurses-devel zlib-devel +BuildRequires: libbz2-devel lzma-alpha-devel ncurses-devel zlib-devel Provides: rpminst %define popt_version 1.7 PreReq: %insserv_prereq %fillup_prereq permissions AutoReqProv: on Summary: The RPM Package Manager Version: 4.4.2 -Release: 170 +Release: 177 Source: rpm-%{version}.tar.bz2 Source1: RPM-HOWTO.tar.bz2 Source2: RPM-Tips.html.tar.bz2 @@ -130,6 +130,8 @@ Patch100: rpm-gcc43.diff Patch101: lzma.diff Patch102: rpm-shorten-changelog.diff Patch103: noautoreloc.diff +Patch104: lzma-payload.diff +Patch105: lzma-payload-2.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -201,6 +203,7 @@ rm -f rpmdb/db.h %patch -P 80 -P 81 -P 82 -P 83 -P 84 -P 85 -P 86 -P 87 -P 88 -P 89 %patch -P 90 -P 91 -P 92 -P 93 -P 94 -P 95 -P 96 -P 97 -P 98 -P 99 %patch -P 100 -P 101 -P 102 -P 103 +%patch -P 104 -P 105 -b .lzma chmod 755 scripts/find-supplements{,.ksyms} chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms tar -xjvf %{SOURCE1} @@ -231,8 +234,6 @@ rm po/de.gmo make %{?jobs:-j%jobs} %install -rm -rf $RPM_BUILD_ROOT -mkdir $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr/lib mkdir -p $RPM_BUILD_ROOT/usr/share/locale ln -s ../share/locale $RPM_BUILD_ROOT/usr/lib/locale @@ -347,7 +348,7 @@ Summary: A C library for parsing command line parameters License: LGPL v2.1 or later Group: System/Libraries Version: 1.7 -Release: 398 +Release: 405 # %description -n popt @@ -370,7 +371,7 @@ Summary: C Library for Parsing Command Line Parameters License: LGPL v2.1 or later Group: System/Libraries Version: 1.7 -Release: 398 +Release: 405 Requires: popt = 1.7 Requires: glibc-devel @@ -405,6 +406,19 @@ Authors: %doc %{_mandir}/man3/popt.3* %changelog +* Tue Mar 18 2008 mls@suse.de +- make ia32 compatible to ia64, like it was in SLES9 [bnc#367705] +- fix memory leak and endless loops in lzma code +- make rpm provide the right lzma rpmlib name +* Tue Mar 18 2008 schwab@suse.de +- Fix broken db configuration. +* Fri Mar 14 2008 coolo@suse.de +- change it to the "alone" file format used by stable + distributions of 7zip and lzma +* Fri Mar 14 2008 coolo@suse.de +- daring some more compression time to get an overall picture +* Thu Mar 13 2008 coolo@suse.de +- support lzma payload using liblzma * Thu Feb 21 2008 mls@suse.de - do not configure autoreloc or colors * Thu Jan 31 2008 ro@suse.de diff --git a/rpmrc.diff b/rpmrc.diff index 399a67a..a974bf8 100644 --- a/rpmrc.diff +++ b/rpmrc.diff @@ -157,9 +157,12 @@ Index: rpmrc.in arch_compat: armv4l: armv3l arch_compat: armv3l: noarch -@@ -308,7 +325,7 @@ arch_compat: s390x: s390 noarch +@@ -306,9 +323,9 @@ arch_compat: i370: noarch + arch_compat: s390: noarch + arch_compat: s390x: s390 noarch - arch_compat: ia64: noarch +-arch_compat: ia64: noarch ++arch_compat: ia64: i686 noarch -arch_compat: x86_64: amd64 athlon noarch +arch_compat: x86_64: amd64 em64t athlon noarch