rpm/headeradddb.diff

56 lines
1.6 KiB
Diff
Raw Normal View History

Add rpmtsHeaderAddDB and rpmtsHeaderRemoveDB so that
convertdb1 will build again.
--- 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