Hmm, I see that rpmdbAdd() et al have been removed in favor
of rpmts, but there don't seem to be equivalent functions.
How about rpmtsHeaderAddDB() and rpmtsHeaderRemoveDB()?

Patch attached.

M.

-- 
Michael Schroeder                                   m...@suse.de
SUSE LINUX Products GmbH,  GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
--- lib/rpmts.c.orig	2011-05-12 13:21:03.000000000 +0000
+++ lib/rpmts.c	2011-05-12 13:26:25.000000000 +0000
@@ -159,6 +159,24 @@ int rpmtsVerifyDB(rpmts ts)
     return rc;
 }
 
+int rpmtsHeaderAddDB(rpmts ts, Header h)
+{
+    if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
+	return RPMRC_FAIL;
+    if (rpmdbAdd(rpmtsGetRdb(ts), h) != 0)
+	return RPMRC_FAIL;
+    return RPMRC_OK;
+}
+
+int rpmtsHeaderRemoveDB(rpmts ts, unsigned int hdrNum)
+{
+    if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
+	return RPMRC_FAIL;
+    if (rpmdbRemove(rpmtsGetRdb(ts), hdrNum) != 0)
+	return RPMRC_FAIL;
+    return RPMRC_OK;
+}
+
 /* keyp might no be defined. */
 rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag,
 			const void * keyp, size_t keylen)
--- lib/rpmts.h.orig	2011-05-12 13:21:11.000000000 +0000
+++ lib/rpmts.h	2011-05-12 13:28:32.000000000 +0000
@@ -264,6 +264,22 @@ int rpmtsRebuildDB(rpmts ts);
 int rpmtsVerifyDB(rpmts ts);
 
 /** \ingroup rpmts
+ * Add a header to the database used by the transaction.
+ * @param ts            transaction set 
+ * @param h             header to add
+ * @return              0 on success
+ */
+int rpmtsHeaderAddDB(rpmts ts, Header h);
+
+/** \ingroup rpmts
+ * Remove a header from the database used by the transaction.
+ * @param ts            transaction set 
+ * @param hdrNum        index of header to remove
+ * @return              0 on success
+ */
+int rpmtsHeaderRemoveDB(rpmts ts, unsigned int hdrNum);
+
+/** \ingroup rpmts
  * Return transaction database iterator.
  * @param ts		transaction set
  * @param rpmtag	database index tag
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to