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: 30-Jul-2007 03:58:10
Branch: rpm-4_5 Handle: 2007073002580901
Modified files: (Branch: rpm-4_5)
rpm CHANGES
rpm/lib formats.c rpmevr.h rpmgi.c rpmlib.h
Log:
- add RPMTAG_DBINSTANCE header extension.
- parameterize Depends index and dependency result caching.
- fix a --import memory leak.
Summary:
Revision Changes Path
1.1360.2.27 +3 -0 rpm/CHANGES
2.98.2.3 +39 -1 rpm/lib/formats.c
1.2.2.1 +4 -4 rpm/lib/rpmevr.h
2.24.2.1 +6 -2 rpm/lib/rpmgi.c
2.418.2.4 +1 -0 rpm/lib/rpmlib.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1360.2.26 -r1.1360.2.27 CHANGES
--- rpm/CHANGES 12 Jul 2007 10:54:53 -0000 1.1360.2.26
+++ rpm/CHANGES 30 Jul 2007 01:58:09 -0000 1.1360.2.27
@@ -1,4 +1,7 @@
4.4.9 -> 4.5:
+ - jbj: add RPMTAG_DBINSTANCE header extension.
+ - jbj: parameterize Depends index and dependency result caching.
+ - jbj: fix a --import memory leak.
- jbj: selinux: use matchpthcon() instead or rpmsx.
- jbj: insure that RPMFILE_EXISTS is set for %config files.
- jbj: fix ptr alignment problem seen on pld/sparc64.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/formats.c
============================================================================
$ cvs diff -u -r2.98.2.2 -r2.98.2.3 formats.c
--- rpm/lib/formats.c 18 Jun 2007 17:32:09 -0000 2.98.2.2
+++ rpm/lib/formats.c 30 Jul 2007 01:58:09 -0000 2.98.2.3
@@ -161,6 +161,7 @@
const unsigned char * s;
size_t ns;
int atype;
+ char * val;
switch (type) {
case RPM_OPENPGP_TYPE:
@@ -174,6 +175,8 @@
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
enc = data;
+ s = NULL;
+ ns = 0;
if (b64decode(enc, (void **)&s, &ns))
return xstrdup(_("(not base64)"));
atype = PGPARMOR_PUBKEY; /* XXX check pkt for pubkey */
@@ -191,7 +194,10 @@
}
/* XXX this doesn't use padding directly, assumes enough slop in retval. */
- return pgpArmorWrap(atype, s, ns);
+ val = pgpArmorWrap(atype, s, ns);
+ if (atype == PGPARMOR_PUBKEY)
+ s = _free(s);
+ return val;
}
/**
@@ -1565,6 +1571,37 @@
return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData);
}
+/**
+ * Retrieve db instance from header.
+ * @param h header
+ * @retval *type tag type
+ * @retval *data tag value
+ * @retval *count no. of data items
+ * @retval *freeData data-was-malloc'ed indicator
+ * @return 0 on success
+ */
+static int dbinstanceTag(Header h, /*@out@*/ rpmTagType * type,
+ /*@out@*/ const void ** data, /*@out@*/ int_32 * count,
+ /*@out@*/ int * freeData)
+ /*@globals rpmGlobalMacroContext, h_errno,
+ fileSystem, internalState @*/
+ /*@modifies *type, *data, *count, *freeData, rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
+ /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/
+{
+ int_32 * valuep = xcalloc(1, sizeof(*valuep));
+
+ *valuep = headerGetInstance(h);
+
+ *type = RPM_INT32_TYPE;
+ *data = valuep;
+ *count = 1;
+ *freeData = 1;
+
+ return 0;
+}
+
/*@-type@*/ /* FIX: cast? */
const struct headerSprintfExtension_s rpmHeaderFormats[] = {
{ HEADER_EXT_TAG, "RPMTAG_CHANGELOGNAME", { changelognameTag } },
@@ -1586,6 +1623,7 @@
{ HEADER_EXT_TAG, "RPMTAG_SUMMARY", { summaryTag } },
{ HEADER_EXT_TAG, "RPMTAG_TRIGGERCONDS", { triggercondsTag } },
{ HEADER_EXT_TAG, "RPMTAG_TRIGGERTYPE", { triggertypeTag } },
+ { HEADER_EXT_TAG, "RPMTAG_DBINSTANCE", { dbinstanceTag } },
{ HEADER_EXT_FORMAT, "armor", { armorFormat } },
{ HEADER_EXT_FORMAT, "base64", { base64Format } },
{ HEADER_EXT_FORMAT, "depflags", { depflagsFormat } },
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmevr.h
============================================================================
$ cvs diff -u -r1.2 -r1.2.2.1 rpmevr.h
--- rpm/lib/rpmevr.h 25 May 2007 18:34:13 -0000 1.2
+++ rpm/lib/rpmevr.h 30 Jul 2007 01:58:09 -0000 1.2.2.1
@@ -6,6 +6,10 @@
* Structure(s) and routine(s) used for EVR parsing and comparison.
*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
*/
/*@-exportlocal@*/
@@ -117,10 +121,6 @@
#define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
#endif /* _RPMEVR_INTERNAL */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/** \ingroup rpmds
* Segmented string compare.
* @param a 1st string
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmgi.c
============================================================================
$ cvs diff -u -r2.24 -r2.24.2.1 rpmgi.c
--- rpm/lib/rpmgi.c 25 May 2007 17:36:02 -0000 2.24
+++ rpm/lib/rpmgi.c 30 Jul 2007 01:58:09 -0000 2.24.2.1
@@ -85,7 +85,11 @@
/*@modifies rpmGlobalMacroContext, h_errno, internalState @*/
{
const char * fn = rpmExpand(path, NULL);
- FD_t fd = Fopen(fn, fmode);
+ FD_t fd;
+
+ /* FIXME (see http://rpm5.org/community/rpm-devel/0523.html) */
+ errno = 0;
+ fd = Fopen(fn, fmode);
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fn, Fstrerror(fd));
@@ -401,7 +405,7 @@
gi->mi = rpmtsInitIterator(gi->ts, gi->tag, gi->keyp, gi->keylen);
if (_rpmgi_debug < 0)
-fprintf(stderr, "*** gi %p key %p[%d]\tmi %p\n", gi, gi->keyp, gi->keylen, gi->mi);
+fprintf(stderr, "*** gi %p key %p[%d]\tmi %p\n", gi, gi->keyp, (int)gi->keylen, gi->mi);
if (gi->argv != NULL)
for (av = (const char **) gi->argv; *av != NULL; av++) {
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmlib.h
============================================================================
$ cvs diff -u -r2.418.2.3 -r2.418.2.4 rpmlib.h
--- rpm/lib/rpmlib.h 17 Jun 2007 14:41:57 -0000 2.418.2.3
+++ rpm/lib/rpmlib.h 30 Jul 2007 01:58:10 -0000 2.418.2.4
@@ -427,6 +427,7 @@
RPMTAG_REQUIREATTRSX = 1192, /* i[] (unimplemented) */
RPMTAG_BUILDPROVIDES = 1193, /* internal */
RPMTAG_BUILDOBSOLETES = 1194, /* internal */
+ RPMTAG_DBINSTANCE = 1195, /* i */
/*@-enummemuse@*/
RPMTAG_FIRSTFREE_TAG /*!< internal */
@@ .
Received on Mon Jul 30 03:58:10 2007