update ndb_backport.diff

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=531
This commit is contained in:
Michael Schröder 2020-01-23 12:50:26 +00:00 committed by Git OBS Bridge
parent 171912d01d
commit cdda0f569d

View File

@ -1,5 +1,5 @@
--- ./lib/backend/ndb/glue.c.orig 2020-01-17 12:40:07.393014566 +0000
+++ ./lib/backend/ndb/glue.c 2020-01-17 12:40:21.244978080 +0000
--- ./lib/backend/ndb/glue.c.orig 2020-01-23 12:47:46.527816289 +0000
+++ ./lib/backend/ndb/glue.c 2020-01-23 12:48:20.915728982 +0000
@@ -52,8 +52,8 @@ static void closeEnv(rpmdb rdb)
if (ndbenv->data)
free(ndbenv->data);
@ -102,7 +102,7 @@
pkglistn = 0;
rc = rpmidxGet(dbc->dbi->dbi_db, k, kl, &pkglist, &pkglistn);
--- ./lib/backend/ndb/rpmpkg.c.orig 2019-11-13 09:19:29.306710577 +0000
+++ ./lib/backend/ndb/rpmpkg.c 2020-01-17 12:40:21.244978080 +0000
+++ ./lib/backend/ndb/rpmpkg.c 2020-01-23 12:48:59.739630414 +0000
@@ -7,7 +7,6 @@
#include <sys/file.h>
#include <fcntl.h>
@ -395,7 +395,7 @@
if (rpmpkgReadSlots(pkgdb)) {
return RPMRC_FAIL;
}
@@ -981,7 +965,7 @@ static int rpmpkgPutInternal(rpmpkgdb pk
@@ -981,14 +965,15 @@ static int rpmpkgPutInternal(rpmpkgdb pk
return RPMRC_FAIL;
}
/* write new blob */
@ -403,8 +403,19 @@
+ if (rpmpkgWriteBlob(pkgdb, pkgidx, blkoff, blkcnt, blob, blobl, pkgdb->generation)) {
return RPMRC_FAIL;
}
+ /* update nextpkgidx if needed */
+ if (pkgidx >= pkgdb->nextpkgidx) {
+ pkgdb->nextpkgidx = pkgidx + 1;
+ }
/* write slot */
@@ -1006,7 +990,7 @@ static int rpmpkgPutInternal(rpmpkgdb pk
slotno = oldslot ? oldslot->slotno : pkgdb->freeslot;
- if (!slotno) {
- return RPMRC_FAIL;
- }
if (rpmpkgWriteslot(pkgdb, slotno, pkgidx, blkoff, blkcnt)) {
free(pkgdb->slots);
pkgdb->slots = 0;
@@ -1006,7 +991,7 @@ static int rpmpkgPutInternal(rpmpkgdb pk
/* just update the slot, no need to free the slot data */
oldslot->blkoff = blkoff;
oldslot->blkcnt = blkcnt;
@ -413,7 +424,7 @@
} else {
free(pkgdb->slots);
pkgdb->slots = 0;
@@ -1023,7 +1007,7 @@ static int rpmpkgDelInternal(rpmpkgdb pk
@@ -1023,7 +1008,7 @@ static int rpmpkgDelInternal(rpmpkgdb pk
if (rpmpkgReadSlots(pkgdb)) {
return RPMRC_FAIL;
}
@ -422,7 +433,7 @@
slot = rpmpkgFindSlot(pkgdb, pkgidx);
if (!slot) {
return RPMRC_OK;
@@ -1049,9 +1033,10 @@ static int rpmpkgDelInternal(rpmpkgdb pk
@@ -1049,9 +1034,10 @@ static int rpmpkgDelInternal(rpmpkgdb pk
}
slot->blkoff = 0;
slot->blkcnt = 0;
@ -434,7 +445,7 @@
for (i = 0; i < 2; i++, slot++) {
if (slot == pkgdb->slots + pkgdb->nslots)
slot -= 2;
@@ -1065,7 +1050,7 @@ static int rpmpkgDelInternal(rpmpkgdb pk
@@ -1065,7 +1051,7 @@ static int rpmpkgDelInternal(rpmpkgdb pk
blkoff += slot->blkcnt;
blkcnt -= slot->blkcnt;
}
@ -443,7 +454,7 @@
} else {
slot->blkoff = 0;
slot->blkcnt = 0;
@@ -1104,7 +1089,7 @@ static int rpmpkgListInternal(rpmpkgdb p
@@ -1104,7 +1090,7 @@ static int rpmpkgListInternal(rpmpkgdb p
*npkgidxlistp = pkgdb->nslots;
return RPMRC_OK;
}
@ -452,7 +463,7 @@
nslots = pkgdb->nslots;
pkgidxlist = xcalloc(nslots + 1, sizeof(unsigned int));
for (i = 0, slot = pkgdb->slots; i < nslots; i++, slot++) {
@@ -1115,6 +1100,22 @@ static int rpmpkgListInternal(rpmpkgdb p
@@ -1115,6 +1101,22 @@ static int rpmpkgListInternal(rpmpkgdb p
return RPMRC_OK;
}
@ -475,7 +486,7 @@
int rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char **blobp, unsigned int *bloblp)
{
int rc;
@@ -1127,10 +1128,6 @@ int rpmpkgGet(rpmpkgdb pkgdb, unsigned i
@@ -1127,10 +1129,6 @@ int rpmpkgGet(rpmpkgdb pkgdb, unsigned i
return RPMRC_FAIL;
rc = rpmpkgGetInternal(pkgdb, pkgidx, blobp, bloblp);
rpmpkgUnlock(pkgdb, 0);
@ -486,7 +497,7 @@
return rc;
}
@@ -1143,16 +1140,7 @@ int rpmpkgPut(rpmpkgdb pkgdb, unsigned i
@@ -1143,16 +1141,7 @@ int rpmpkgPut(rpmpkgdb pkgdb, unsigned i
}
if (rpmpkgLockReadHeader(pkgdb, 1))
return RPMRC_FAIL;
@ -503,7 +514,7 @@
rpmpkgUnlock(pkgdb, 1);
return rc;
}
@@ -1184,6 +1172,16 @@ int rpmpkgList(rpmpkgdb pkgdb, unsigned
@@ -1184,6 +1173,16 @@ int rpmpkgList(rpmpkgdb pkgdb, unsigned
return rc;
}
@ -520,7 +531,7 @@
int rpmpkgNextPkgIdx(rpmpkgdb pkgdb, unsigned int *pkgidxp)
{
if (rpmpkgLockReadHeader(pkgdb, 1))
@@ -1233,64 +1231,3 @@ int rpmpkgStats(rpmpkgdb pkgdb)
@@ -1233,64 +1232,3 @@ int rpmpkgStats(rpmpkgdb pkgdb)
return RPMRC_OK;
}
@ -586,7 +597,7 @@
-
-#endif
--- ./lib/backend/ndb/rpmpkg.h.orig 2019-06-26 14:17:31.406985703 +0000
+++ ./lib/backend/ndb/rpmpkg.h 2020-01-17 12:40:21.244978080 +0000
+++ ./lib/backend/ndb/rpmpkg.h 2020-01-23 12:48:20.919728972 +0000
@@ -12,6 +12,7 @@ int rpmpkgGet(rpmpkgdb pkgdb, unsigned i
int rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob, unsigned int blobl);
int rpmpkgDel(rpmpkgdb pkgdb, unsigned int pkgidx);
@ -596,7 +607,7 @@
int rpmpkgNextPkgIdx(rpmpkgdb pkgdb, unsigned int *pkgidxp);
int rpmpkgGeneration(rpmpkgdb pkgdb, unsigned int *generationp);
--- ./lib/backend/ndb/rpmxdb.c.orig 2019-11-13 09:19:29.307710583 +0000
+++ ./lib/backend/ndb/rpmxdb.c 2020-01-17 12:41:30.268800690 +0000
+++ ./lib/backend/ndb/rpmxdb.c 2020-01-23 12:48:20.919728972 +0000
@@ -224,11 +224,33 @@ static int usedslots_cmp(const void *a,
return sa->startpage > sb->startpage ? 1 : -1;
}
@ -704,7 +715,7 @@
int rpmxdbResizeBlob(rpmxdb xdb, unsigned int id, size_t newsize)
{
--- ./lib/backend/ndb/rpmxdb.h.orig 2019-11-13 09:19:29.307710583 +0000
+++ ./lib/backend/ndb/rpmxdb.h 2020-01-17 12:40:23.712971581 +0000
+++ ./lib/backend/ndb/rpmxdb.h 2020-01-23 12:48:20.919728972 +0000
@@ -14,6 +14,7 @@ int rpmxdbUnlock(rpmxdb xdb, int excl);
int rpmxdbLookupBlob(rpmxdb xdb, unsigned int *idp, unsigned int blobtag, unsigned int subtag, int flags);