sigh
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=530
This commit is contained in:
parent
4f3b62c4df
commit
171912d01d
@ -1,6 +1,6 @@
|
||||
--- ./lib/backend/bdb_ro.c.orig 2020-01-17 12:42:10.916701298 +0000
|
||||
+++ ./lib/backend/bdb_ro.c 2020-01-17 12:42:50.924603470 +0000
|
||||
@@ -790,6 +790,7 @@ static unsigned int bdbro_pkgdbKey(dbiIn
|
||||
--- ./lib/backend/bdb_ro.c.orig 2020-01-17 15:48:50.622349363 +0000
|
||||
+++ ./lib/backend/bdb_ro.c 2020-01-17 15:49:20.514287856 +0000
|
||||
@@ -795,6 +795,7 @@ static unsigned int bdbro_pkgdbKey(dbiIn
|
||||
struct rpmdbOps_s bdbro_dbops = {
|
||||
.name = "bdb_ro",
|
||||
.path = "Packages",
|
||||
@ -8,8 +8,8 @@
|
||||
|
||||
.open = bdbro_Open,
|
||||
.close = bdbro_Close,
|
||||
--- ./lib/backend/dbi.c.orig 2020-01-17 12:42:10.916701298 +0000
|
||||
+++ ./lib/backend/dbi.c 2020-01-17 12:42:50.924603470 +0000
|
||||
--- ./lib/backend/dbi.c.orig 2020-01-17 15:48:50.622349363 +0000
|
||||
+++ ./lib/backend/dbi.c 2020-01-17 15:49:20.514287856 +0000
|
||||
@@ -105,11 +105,20 @@ dbDetectBackend(rpmdb rdb)
|
||||
}
|
||||
|
||||
@ -31,9 +31,17 @@
|
||||
const char * dbiName(dbiIndex dbi)
|
||||
{
|
||||
return dbi->dbi_file;
|
||||
--- ./lib/backend/dbi.h.orig 2020-01-17 12:42:10.916701298 +0000
|
||||
+++ ./lib/backend/dbi.h 2020-01-17 12:42:50.924603470 +0000
|
||||
@@ -62,6 +62,7 @@ struct rpmdb_s {
|
||||
--- ./lib/backend/dbi.h.orig 2020-01-17 15:48:50.622349363 +0000
|
||||
+++ ./lib/backend/dbi.h 2020-01-17 15:49:49.886227415 +0000
|
||||
@@ -10,6 +10,7 @@ enum rpmdbFlags {
|
||||
RPMDB_FLAG_JUSTCHECK = (1 << 0),
|
||||
RPMDB_FLAG_REBUILD = (1 << 1),
|
||||
RPMDB_FLAG_VERIFYONLY = (1 << 2),
|
||||
+ RPMDB_FLAG_CONVERT = (1 << 3),
|
||||
};
|
||||
|
||||
typedef enum dbCtrlOp_e {
|
||||
@@ -62,6 +63,7 @@ struct rpmdb_s {
|
||||
int db_buildindex; /*!< Index rebuild indicator */
|
||||
|
||||
const struct rpmdbOps_s * db_ops; /*!< backend ops */
|
||||
@ -41,7 +49,7 @@
|
||||
|
||||
/* dbenv and related parameters */
|
||||
void * db_dbenv; /*!< Backend private handle */
|
||||
@@ -201,6 +202,14 @@ RPM_GNUC_INTERNAL
|
||||
@@ -201,6 +203,14 @@ RPM_GNUC_INTERNAL
|
||||
const char * dbiName(dbiIndex dbi);
|
||||
|
||||
/** \ingroup dbi
|
||||
@ -56,7 +64,7 @@
|
||||
* Open a database cursor.
|
||||
* @param dbi index database handle
|
||||
* @param flags DBC_WRITE if writing, or 0 (DBC_READ) for reading
|
||||
@@ -246,6 +255,7 @@ const void * idxdbKey(dbiIndex dbi, dbiC
|
||||
@@ -246,6 +256,7 @@ const void * idxdbKey(dbiIndex dbi, dbiC
|
||||
struct rpmdbOps_s {
|
||||
const char *name; /* backend name */
|
||||
const char *path; /* main database name */
|
||||
@ -64,8 +72,8 @@
|
||||
|
||||
int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags);
|
||||
int (*close)(dbiIndex dbi, unsigned int flags);
|
||||
--- ./lib/rpmdb.c.orig 2020-01-17 12:42:10.916701298 +0000
|
||||
+++ ./lib/rpmdb.c 2020-01-17 12:42:50.924603470 +0000
|
||||
--- ./lib/rpmdb.c.orig 2020-01-17 15:48:50.622349363 +0000
|
||||
+++ ./lib/rpmdb.c 2020-01-17 15:53:52.241669094 +0000
|
||||
@@ -513,8 +513,16 @@ static int openDatabase(const char * pre
|
||||
rpmsqActivate(1);
|
||||
}
|
||||
@ -73,7 +81,7 @@
|
||||
+ /* Convert the database if needed */
|
||||
+ if (!db->db_pkgs && !justCheck && (mode & O_ACCMODE) == O_RDWR && dbiNeedConversion(db)) {
|
||||
+ rpmlog(RPMLOG_WARNING, _("Converting database from %s to %s format\n"), db->db_ops->name, db->db_ops_config->name);
|
||||
+ rc = rpmdbRebuild(prefix, NULL, NULL);
|
||||
+ rc = rpmdbRebuild(prefix, NULL, NULL, RPMDB_FLAG_CONVERT);
|
||||
+ db->db_ops = NULL; /* force re-detection of backend */
|
||||
+ }
|
||||
+
|
||||
@ -84,3 +92,79 @@
|
||||
if (!db->db_descr)
|
||||
db->db_descr = "unknown db";
|
||||
}
|
||||
@@ -2316,6 +2324,15 @@ int rpmdbAdd(rpmdb db, Header h)
|
||||
if (db == NULL)
|
||||
return 0;
|
||||
|
||||
+ if ((db->db_flags & RPMDB_FLAG_CONVERT) != 0) {
|
||||
+ /* keep old instance numbers when converting */
|
||||
+ hdrNum = headerGetInstance(h);
|
||||
+ if (hdrNum == 0) {
|
||||
+ ret = -1;
|
||||
+ goto exit;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
hdrBlob = headerExport(h, &hdrLen);
|
||||
if (hdrBlob == NULL || hdrLen == 0) {
|
||||
ret = -1;
|
||||
@@ -2331,7 +2348,8 @@ int rpmdbAdd(rpmdb db, Header h)
|
||||
|
||||
/* Add header to primary index */
|
||||
dbc = dbiCursorInit(dbi, DBC_WRITE);
|
||||
- ret = pkgdbNew(dbi, dbc, &hdrNum);
|
||||
+ if ((db->db_flags & RPMDB_FLAG_CONVERT) == 0)
|
||||
+ ret = pkgdbNew(dbi, dbc, &hdrNum);
|
||||
if (ret == 0)
|
||||
ret = pkgdbPut(dbi, dbc, hdrNum, hdrBlob, hdrLen);
|
||||
dbiCursorFree(dbi, dbc);
|
||||
@@ -2491,7 +2509,8 @@ static int rpmdbSetPermissions(char * sr
|
||||
}
|
||||
|
||||
int rpmdbRebuild(const char * prefix, rpmts ts,
|
||||
- rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg))
|
||||
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg),
|
||||
+ int newdbflags)
|
||||
{
|
||||
rpmdb olddb;
|
||||
char * dbpath = NULL;
|
||||
@@ -2536,7 +2555,7 @@ int rpmdbRebuild(const char * prefix, rp
|
||||
goto exit;
|
||||
}
|
||||
if (openDatabase(prefix, newdbpath, &newdb,
|
||||
- (O_RDWR | O_CREAT), 0644, RPMDB_FLAG_REBUILD)) {
|
||||
+ (O_RDWR | O_CREAT), 0644, RPMDB_FLAG_REBUILD | newdbflags)) {
|
||||
rc = 1;
|
||||
goto exit;
|
||||
}
|
||||
--- ./lib/rpmdb_internal.h.orig 2020-01-17 15:51:16.134030103 +0000
|
||||
+++ ./lib/rpmdb_internal.h 2020-01-17 15:50:27.050144956 +0000
|
||||
@@ -63,11 +63,13 @@ int rpmdbClose (rpmdb db);
|
||||
* @param prefix path to top of install tree
|
||||
* @param ts transaction set (or NULL)
|
||||
* @param (*hdrchk) headerCheck() vector (or NULL)
|
||||
+ * @param newdbflags extra flags for the new database
|
||||
* @return 0 on success
|
||||
*/
|
||||
RPM_GNUC_INTERNAL
|
||||
int rpmdbRebuild(const char * prefix, rpmts ts,
|
||||
- rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg));
|
||||
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, char ** msg),
|
||||
+ int newdbflags);
|
||||
|
||||
/** \ingroup rpmdb
|
||||
* Verify database components.
|
||||
--- ./lib/rpmts.c.orig 2020-01-17 15:51:37.813979967 +0000
|
||||
+++ ./lib/rpmts.c 2020-01-17 15:51:48.925954269 +0000
|
||||
@@ -143,9 +143,9 @@ int rpmtsRebuildDB(rpmts ts)
|
||||
txn = rpmtxnBegin(ts, RPMTXN_WRITE);
|
||||
if (txn) {
|
||||
if (!(ts->vsflags & RPMVSF_NOHDRCHK))
|
||||
- rc = rpmdbRebuild(ts->rootDir, ts, headerCheck);
|
||||
+ rc = rpmdbRebuild(ts->rootDir, ts, headerCheck, 0);
|
||||
else
|
||||
- rc = rpmdbRebuild(ts->rootDir, NULL, NULL);
|
||||
+ rc = rpmdbRebuild(ts->rootDir, NULL, NULL, 0);
|
||||
rpmtxnEnd(txn);
|
||||
}
|
||||
return rc;
|
||||
|
@ -112,7 +112,7 @@
|
||||
- rpmlog(RPMLOG_WARNING, _("Found BDB Packages database while attempting %s backend: using bdb backend.\n"), db_backend);
|
||||
+ path = rstrscat(NULL, dbhome, "/", (*ops)->path, NULL);
|
||||
+ if (access(path, F_OK) == 0) {
|
||||
+ rpmlog(RPMLOG_WARNING,
|
||||
+ rpmlog(RPMLOG_DEBUG,
|
||||
+ _("Found %s %s database while attempting %s backend: "
|
||||
+ "using %s backend.\n"),
|
||||
+ (*ops)->name, (*ops)->path, db_backend, (*ops)->name);
|
||||
|
@ -17,6 +17,7 @@ Fri Jan 17 11:27:17 CET 2020 - mls@suse.de
|
||||
new patch: ndb_backport.diff
|
||||
- Backport automatic db conversion
|
||||
new patch: db_conversion.diff
|
||||
- Disable the BerkeleyDB backend and switch over to 'ndb'
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 6 15:30:48 CET 2019 - mls@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user