RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 21-Nov-2007 16:28:03
Branch: HEAD Handle: 2007112115280201
Added files:
rpm/rpmio rpmxar.c rpmxar.h
Modified files:
rpm CHANGES
rpm/lib poptALL.c
rpm/rpmio Makefile.am librpmio.vers
Log:
- jbj: stub in rpmio/rpmxar.c xar payload extraction.
Summary:
Revision Changes Path
1.1863 +1 -0 rpm/CHANGES
2.54 +5 -0 rpm/lib/poptALL.c
1.110 +8 -10 rpm/rpmio/Makefile.am
2.17 +7 -0 rpm/rpmio/librpmio.vers
2.1 +118 -0 rpm/rpmio/rpmxar.c
2.1 +48 -0 rpm/rpmio/rpmxar.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1862 -r1.1863 CHANGES
--- rpm/CHANGES 21 Nov 2007 14:24:35 -0000 1.1862
+++ rpm/CHANGES 21 Nov 2007 15:28:02 -0000 1.1863
@@ -1,4 +1,5 @@
5.0a2 -> 5.0a3:
+ - jbj: stub in rpmio/rpmxar.c xar payload extraction.
- jbj: create rpmWriteHeader with error msg returns.
- jbj: use rpmReadHeader with error msg returns.
- jbj: eliminate HDRread/HDRwrite vectors.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/poptALL.c
============================================================================
$ cvs diff -u -r2.53 -r2.54 poptALL.c
--- rpm/lib/poptALL.c 11 Nov 2007 04:04:26 -0000 2.53
+++ rpm/lib/poptALL.c 21 Nov 2007 15:28:03 -0000 2.54
@@ -125,6 +125,9 @@
extern int _rpmwf_debug;
/*@unchecked@*/
+extern int _xar_debug;
+
+/*@unchecked@*/
extern int _rpmts_macros;
/*@unchecked@*/
@@ -490,6 +493,8 @@
NULL, NULL},
{ "rpmwfdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmwf_debug, -1,
NULL, NULL},
+ { "xardebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_xar_debug, -1,
+ NULL, NULL},
{ "tardebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_tar_debug, -1,
N_("debug tar payloads"), NULL},
{ "stats", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmts_stats, -1,
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/Makefile.am
============================================================================
$ cvs diff -u -r1.109 -r1.110 Makefile.am
--- rpm/rpmio/Makefile.am 19 Nov 2007 18:57:59 -0000 1.109
+++ rpm/rpmio/Makefile.am 21 Nov 2007 15:28:03 -0000 1.110
@@ -33,25 +33,23 @@
pkgincdir = $(pkgincludedir)$(WITH_PATH_VERSIONED_SUFFIX)
pkginc_HEADERS = \
argv.h envvar.h fts.h mire.h rpmcb.h rpmdav.h rpmhash.h \
- rpmio-stub.h rpmmg.h \
- rpmio.h rpmurl.h rpmmacro.h rpmlog.h rpmpgp.h \
- rpmsq.h rpmsw.h ugid.h
+ rpmio.h rpmio-stub.h rpmlog.h rpmmacro.h rpmmg.h rpmpgp.h \
+ rpmsq.h rpmsw.h rpmurl.h rpmxar.h ugid.h
noinst_HEADERS = \
md2.h md4.h rmd128.h rmd160.h rmd256.h rmd320.h sha224.h \
salsa10.h salsa20.h tiger.h \
- LzmaDecode.h rpmio_internal.h rpmlua.h rpmhook.h
+ LzmaDecode.h rpmhook.h rpmio_internal.h rpmlua.h
usrlibdir = $(libdir)
usrlib_LTLIBRARIES = librpmio.la
librpmio_la_SOURCES = \
argv.c digest.c fts.c getpass.c macro.c mire.c mount.c \
md2.c md4.c rmd128.c rmd160.c rmd256.c rmd320.c sha224.c \
- salsa10.c salsa20.c tiger.c \
- rpmio-stub.c rpmmg.c \
- rpmdav.c rpmhash.c rpmhook.c rpmio.c rpmlog.c rpmlua.c rpmmalloc.c \
- rpmpgp.c rpmrpc.c rpmsq.c rpmsw.c strcasecmp.c strtolocale.c \
- url.c ugid.c \
- LzmaDecode.c
+ salsa10.c salsa20.c tiger.c LzmaDecode.c \
+ rpmdav.c rpmhash.c rpmhook.c rpmio.c rpmio-stub.c \
+ rpmlog.c rpmlua.c rpmmalloc.c rpmmg.c rpmpgp.c \
+ rpmrpc.c rpmsq.c rpmsw.c rpmxar.c \
+ strcasecmp.c strtolocale.c url.c ugid.c
librpmio_la_LDFLAGS = -release $(LT_CURRENT).$(LT_REVISION)
if HAVE_LD_VERSION_SCRIPT
librpmio_la_LDFLAGS += -Wl,--version-script=$(srcdir)/librpmio.vers
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/librpmio.vers
============================================================================
$ cvs diff -u -r2.16 -r2.17 librpmio.vers
--- rpm/rpmio/librpmio.vers 20 Nov 2007 17:37:04 -0000 2.16
+++ rpm/rpmio/librpmio.vers 21 Nov 2007 15:28:03 -0000 2.17
@@ -153,6 +153,7 @@
pgpDigNew;
XpgpDigLink;
XpgpDigUnlink;
+ _pgp_debug;
pgpFindPubkey;
pgpGetPubkey;
pgpGetSignature;
@@ -298,6 +299,11 @@
rpmswInit;
rpmswNow;
rpmswSub;
+ rpmxarFini;
+ rpmxarInit;
+ rpmxarNext;
+ rpmxarPush;
+ rpmxarPull;
Stat;
_Stat;
Symlink;
@@ -328,6 +334,7 @@
Utimes;
_Utimes;
vmefail;
+ _xar_debug;
xstrcasecmp;
xstrncasecmp;
xstrtolocale;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmxar.c
============================================================================
$ cvs diff -u -r0 -r2.1 rpmxar.c
--- /dev/null 2007-11-21 16:22:00 +0100
+++ rpmxar.c 2007-11-21 16:28:03 +0100
@@ -0,0 +1,118 @@
+#include "system.h"
+#include "xar.h"
+
+#include <rpmio.h>
+
+#define _RPMXAR_INTERNAL
+#include <rpmxar.h>
+
+#include "debug.h"
+
+/*@access FD_t @*/
+
+/*@unchecked@*/
+int _xar_debug = 0;
+
+#if defined(WITH_XAR)
+int rpmxarFini(rpmxar xar)
+{
+ int xx;
+
+if (_xar_debug)
+fprintf(stderr, "*** rpmxarFini(%p)\n", xar);
+/*@-moduncon@*/
+ if (xar->i) {
+/*@-noeffectuncon@*/
+ xar_iter_free(xar->i);
+/*@=noeffectuncon@*/
+ xar->i = NULL;
+ }
+ if (xar->x) {
+ xx = xar_close(xar->x);
+ xar->x = NULL;
+ }
+ return 0;
+/*@=moduncon@*/
+}
+
+int rpmxarInit(rpmxar xar, const char * fn, const char * fmode)
+{
+ int flags = ((fmode && *fmode == 'w') ? WRITE : READ);
+
+if (_xar_debug)
+fprintf(stderr, "*** rpmxarInit(%p, %s, %s)\n", xar, fn, fmode);
+assert(fn != NULL);
+
+/*@-moduncon@*/
+ xar->x = xar_open(fn, flags);
+ if (flags == READ) {
+ xar->i = xar_iter_new();
+ xar->first = 1;
+ }
+ return 0;
+/*@=moduncon@*/
+}
+
+int rpmxarNext(rpmxar xar)
+{
+if (_xar_debug)
+fprintf(stderr, "*** rpmxarNext(%p) first %d\n", xar, xar->first);
+/*@-moduncon@*/
+ if (xar->first) {
+ xar->f = xar_file_first(xar->x, xar->i);
+ xar->first = 0;
+ } else
+ xar->f = xar_file_next(xar->i);
+/*@=moduncon@*/
+
+ return (xar->f == NULL ? 1 : 0);
+}
+
+int rpmxarPush(rpmxar xar, const char * fn, void * b, size_t nb)
+{
+ if (xar->x && b != NULL && nb > 0) {
+/*@-moduncon@*/
+ xar->f = xar_add_frombuffer(xar->x, NULL, fn, b, nb);
+/*@=moduncon@*/
+ if (xar->f == NULL)
+ return 2;
+ }
+ return 0;
+}
+
+int rpmxarPull(rpmxar xar, const char * fn, void * bp, size_t * nbp)
+{
+/*@-moduncon@*/
+ const char * path = xar_get_path(xar->f);
+/*@=moduncon@*/
+ char * b = NULL;
+ size_t nb = 0;
+ int xx;
+
+ if (fn == NULL)
+ fn = path;
+ else
+ assert(!strcmp(fn, path));
+
+/*@-moduncon@*/
+ xx = (int) xar_extract_tobuffersz(xar->x, xar->f, &b, &nb);
+/*@=moduncon@*/
+if (_xar_debug)
+fprintf(stderr, "*** xx %d %p[%lu]\n", xx, b, (unsigned long)nb);
+ if (xx || b == NULL || nb == 0) {
+ path = _free(path);
+ return 1;
+ }
+
+if (_xar_debug)
+fprintf(stderr, "*** %s %p[%lu]\n", path, b, (unsigned long)nb);
+
+ if (bp)
+ *((char **)bp) = b;
+ if (nbp)
+ *nbp = nb;
+
+ path = _free(path);
+ return 0;
+}
+#endif
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmxar.h
============================================================================
$ cvs diff -u -r0 -r2.1 rpmxar.h
--- /dev/null 2007-11-21 16:22:00 +0100
+++ rpmxar.h 2007-11-21 16:28:03 +0100
@@ -0,0 +1,48 @@
+#ifndef H_RPMXAR
+#define H_RPMXAR
+
+/*@unchecked@*/
+extern int _xar_debug;
+
+typedef /*@abstract@*/ /*@refcounted@*/ struct rpmxar_s * rpmxar;
+
+#ifdef _RPMXAR_INTERNAL
+struct rpmxar_s {
+ int first;
+ xar_t x;
+ xar_file_t f;
+ xar_iter_t i;
+/*@refs@*/
+ int nrefs; /*!< Reference count. */
+};
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int rpmxarFini(rpmxar xar)
+ /*@globals fileSystem @*/
+ /*@modifies xar, fileSystem @*/;
+
+int rpmxarInit(rpmxar xar, const char * fn, const char * fmode)
+ /*@globals fileSystem @*/
+ /*@modifies xar, fileSystem @*/;
+
+int rpmxarNext(rpmxar xar)
+ /*@globals fileSystem @*/
+ /*@modifies xar, fileSystem @*/;
+
+int rpmxarPush(rpmxar xar, const char * fn, void * b, size_t nb)
+ /*@modifies xar @*/;
+
+int rpmxarPull(rpmxar xar, /*@null@*/ const char * fn,
+ /*@null@*/ void * bp, /*@null@*/ size_t * nbp)
+ /*@globals fileSystem @*/
+ /*@modifies xar, fileSystem @*/;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_RPMXAR */
@@ .
Received on Wed Nov 21 16:28:03 2007