Hello community, here is the log from the commit of package rpm for openSUSE:Factory checked in at 2020-03-19 19:40:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rpm (Old) and /work/SRC/openSUSE:Factory/.rpm.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rpm" Thu Mar 19 19:40:05 2020 rev:277 rq:769573 version:4.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rpm/rpm.changes 2020-01-10 17:47:33.810156179 +0100 +++ /work/SRC/openSUSE:Factory/.rpm.new.3160/rpm.changes 2020-03-19 19:40:08.619842344 +0100 @@ -1,0 +2,21 @@ +Fri Jan 17 11:27:17 CET 2020 - m...@suse.de + +- Use libgcrypt as crypto library instead of beecrypt + * dropped patch: beecrypt-4.1.2-build.diff + * dropped patch: beecrypt-4.1.2.diff +- Rewrite rpmqpack to use rpm's database interface + modified patch: rpmqpack.diff +- Backport database detection code from upstream + new patch: db_ops_name.diff +- Backport read-only BerkeleyDB code + new patch: bdb_ro.diff +- Enable ndb backend +- Backport bdb disabling fix + new patch: disable_bdb.diff +- Backport ndb improvements + new patch: ndb_backport.diff +- Backport automatic db conversion + new patch: db_conversion.diff +- Disable the BerkeleyDB backend and switch over to 'ndb' + +------------------------------------------------------------------- Old: ---- beecrypt-4.1.2-build.diff beecrypt-4.1.2.diff beecrypt-4.1.2.tar.bz2 New: ---- bdb_ro.diff db_conversion.diff db_ops_name.diff disable_bdb.diff ndb_backport.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rpm.spec ++++++ --- /var/tmp/diff_new_pack.ikm4Ev/_old 2020-03-19 19:40:12.331844500 +0100 +++ /var/tmp/diff_new_pack.ikm4Ev/_new 2020-03-19 19:40:12.331844500 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-rpm # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017 Neal Gompa <ngomp...@gmail.com>. # # All modifications and additions to the file contributed by third parties @@ -34,6 +34,7 @@ BuildRequires: libbz2-devel BuildRequires: libcap-devel BuildRequires: libelf-devel +BuildRequires: libgcrypt-devel BuildRequires: libselinux-devel BuildRequires: libsemanage-devel BuildRequires: libtool ++++++ rpm.spec ++++++ --- /var/tmp/diff_new_pack.ikm4Ev/_old 2020-03-19 19:40:12.351844511 +0100 +++ /var/tmp/diff_new_pack.ikm4Ev/_new 2020-03-19 19:40:12.351844511 +0100 @@ -1,7 +1,7 @@ # # spec file for package rpm # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,6 +20,7 @@ %{?!_fillupdir:%define _fillupdir /var/adm/fillup-templates} %global librpmsover 9 +%global without_bdb 1 Name: rpm BuildRequires: binutils @@ -35,6 +36,7 @@ BuildRequires: libcap-devel BuildRequires: libdw-devel BuildRequires: libelf-devel +BuildRequires: libgcrypt-devel BuildRequires: libselinux-devel BuildRequires: libsemanage-devel BuildRequires: libtool @@ -66,14 +68,11 @@ Source5: rpmsort Source8: rpmconfigcheck Source9: sysconfig.services-rpm -Source10: beecrypt-4.1.2.tar.bz2 Source11: db-4.8.30.tar.bz2 Source12: baselibs.conf Source13: rpmconfigcheck.service -Patch1: beecrypt-4.1.2.diff Patch2: db.diff Patch3: rpm-4.12.0.1-fix-bashisms.patch -Patch4: beecrypt-4.1.2-build.diff Patch5: usr-lib-sysimage-rpm.patch # quilt patches start here Patch11: debugedit.diff @@ -127,6 +126,11 @@ Patch103: find-lang-qt-qm.patch Patch109: pythondistdeps.diff Patch117: findsupplements.diff +Patch118: db_ops_name.diff +Patch119: bdb_ro.diff +Patch120: disable_bdb.diff +Patch121: ndb_backport.diff +Patch122: db_conversion.diff Patch6464: auto-config-update-aarch64-ppc64le.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -212,19 +216,17 @@ %prep %setup -q -n rpm-%{version} rm -rf sqlite -rm -rf beecrypt -tar xjf %{SOURCE10} +%if 0%{?!without_bdb:1} tar xjf %{SOURCE11} ln -s db-4.8.30 db cd db %patch2 -p1 cd .. -ln -s beecrypt-4.1.2 beecrypt chmod -R u+w db/* rm -f rpmdb/db.h -%patch -P 1 +cp config.guess config.sub db/dist/ +%endif %patch3 -p1 -%patch -P 4 %patch5 -p1 %patch -P 11 -P 12 -P 13 -P 15 -P 16 -P 18 %patch -P 20 -P 21 -P 24 -P 25 -P 26 -P 27 -P 29 @@ -237,13 +239,12 @@ %patch -P 93 -P 94 -P 99 %patch -P 100 -P 102 -P 103 %patch -P 109 -P 117 +%patch -P 118 -P 119 -P 120 -P 121 -P 122 %ifarch aarch64 ppc64le riscv64 %patch6464 %endif -cp config.guess config.sub db/dist/ -cp config.guess config.sub beecrypt/ tar -xjvf %{SOURCE1} rm -f m4/libtool.m4 rm -f m4/lt*.m4 @@ -261,13 +262,6 @@ BUILDTARGET="--build=%{_target_cpu}-suse-linux" %endif -#cp -p /usr/share/gettext/config.rpath . -cp autogen.sh beecrypt -pushd beecrypt -./autogen.sh --disable-dependency-tracking --with-pic --without-python $BUILDTARGET -make %{?_smp_mflags} -popd - autoreconf -fi ./configure --disable-dependency-tracking --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \ --libdir=%{_libdir} --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib \ @@ -276,11 +270,16 @@ --with-rundir=/run \ --without-archive \ --with-selinux \ ---with-internal-beecrypt \ +--with-crypto=libgcrypt \ --with-acl \ --with-cap \ +--enable-shared \ +--enable-ndb \ +--enable-bdb-ro \ --enable-zstd \ ---enable-shared %{?with_python: --enable-python} $BUILDTARGET +%{?without_bdb: --enable-bdb=no} \ +%{?with_python: --enable-python} \ +$BUILDTARGET rm po/de.gmo make %{?_smp_mflags} @@ -292,7 +291,9 @@ %make_install mkdir -p %{buildroot}/bin ln -s /usr/bin/rpm %{buildroot}/bin/rpm +%if 0%{?!without_bdb:1} install -m 644 db3/db.h %{buildroot}/usr/include/rpm +%endif # remove .la file and the static variant of libpopt # have to remove the dependency from other .la files as well for f in %{buildroot}/%{_libdir}/*.la; do @@ -362,17 +363,24 @@ # so we need to enforce the platform here. echo -n "%{_target_cpu}-suse-linux-gnueabi" > %{buildroot}/etc/rpm/platform %endif +%if 0%{?without_bdb:1} +# make ndb the default database backend +echo "setting the default database backend to 'ndb'" +sed -i -e '/_db_backend/s/bdb/ndb/' %{buildroot}/usr/lib/rpm/macros +%endif %post %{fillup_only -an services} # var/lib/rpm migration: set forwards compatible symlink for /usr/lib/sysimage/rpm so scriptlets in same transaction will still work -if test ! -L var/lib/rpm -a -f var/lib/rpm/Packages -a ! -f usr/lib/sysimage/rpm/Packages ; then +if test ! -L var/lib/rpm -a ! -f usr/lib/sysimage/rpm/Packages -a ! -f usr/lib/sysimage/rpm/Packages.db ; then + if test -f var/lib/rpm/Packages -o -f var/lib/rpm/Packages.db ; then rmdir usr/lib/sysimage/rpm ln -s ../../../var/lib/rpm usr/lib/sysimage/rpm + fi fi -test -f usr/lib/sysimage/rpm/Packages || rpmdb --initdb +test -f usr/lib/sysimage/rpm/Packages -o -f usr/lib/sysimage/rpm/Packages.db || rpmdb --initdb test -e var/lib/rpm || ln -s ../../usr/lib/sysimage/rpm var/lib/rpm %posttrans @@ -381,7 +389,7 @@ # delete no longer maintained databases rm -f var/lib/rpm/Filemd5s var/lib/rpm/Filedigests var/lib/rpm/Requireversion var/lib/rpm/Provideversion - if test -f var/lib/rpm/Packages ; then + if test -f var/lib/rpm/Packages -o -f var/lib/rpm/Packages.db ; then echo "migrating rpmdb from /var/lib/rpm to /usr/lib/sysimage/rpm..." # remove forwards compatible symlink ++++++ bdb_ro.diff ++++++ ++++ 884 lines (skipped) ++++++ db_conversion.diff ++++++ --- ./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", + .readonly = 1, .open = bdbro_Open, .close = bdbro_Close, --- ./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) } rdb->db_descr = rdb->db_ops->name; + rdb->db_ops_config = ops_config; if (db_backend) free(db_backend); } +int dbiNeedConversion(rpmdb rdb) +{ + if (!rdb->db_ops) + dbDetectBackend(rdb); + return rdb->db_ops->readonly && rdb->db_ops_config + && rdb->db_ops_config->path && !rdb->db_ops_config->readonly; +} + const char * dbiName(dbiIndex dbi) { return dbi->dbi_file; --- ./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 */ + const struct rpmdbOps_s * db_ops_config; /*!< configured backend ops */ /* dbenv and related parameters */ void * db_dbenv; /*!< Backend private handle */ @@ -201,6 +203,14 @@ RPM_GNUC_INTERNAL const char * dbiName(dbiIndex dbi); /** \ingroup dbi + * Check if the database needs to be converted to a different format + * @param db rpm database + * @return boolean + */ +RPM_GNUC_INTERNAL +int dbiNeedConversion(rpmdb rdb); + +/** \ingroup dbi * Open a database cursor. * @param dbi index database handle * @param flags DBC_WRITE if writing, or 0 (DBC_READ) for reading @@ -246,6 +256,7 @@ const void * idxdbKey(dbiIndex dbi, dbiC struct rpmdbOps_s { const char *name; /* backend name */ const char *path; /* main database name */ + int readonly; /* cannot modify database */ int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags); int (*close)(dbiIndex dbi, unsigned int flags); --- ./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); } + /* 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, RPMDB_FLAG_CONVERT); + db->db_ops = NULL; /* force re-detection of backend */ + } + /* Just the primary Packages database opened here */ - rc = pkgdbOpen(db, db->db_flags, NULL); + if (!rc) + rc = pkgdbOpen(db, db->db_flags, NULL); 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; ++++++ db_ops_name.diff ++++++ --- ./lib/backend/db3.c.orig 2020-01-17 11:50:39.048477444 +0000 +++ ./lib/backend/db3.c 2020-01-17 11:58:15.351365745 +0000 @@ -421,10 +421,6 @@ static int db_init(rpmdb rdb, const char if (rdb->db_dbenv != NULL) { rdb->db_opens++; return 0; - } else { - /* On first call, set backend description to something... */ - free(rdb->db_descr); - rasprintf(&rdb->db_descr, "db%u", DB_VERSION_MAJOR); } /* @@ -1426,6 +1422,9 @@ static rpmRC db3_pkgdbNew(dbiIndex dbi, } struct rpmdbOps_s db3_dbops = { + .name = "bdb", + .path = "Packages", + .open = db3_dbiOpen, .close = db3_dbiClose, .verify = db3_dbiVerify, --- ./lib/backend/dbi.c.orig 2020-01-17 11:54:38.207894769 +0000 +++ ./lib/backend/dbi.c 2020-01-17 11:56:45.555584517 +0000 @@ -12,6 +12,19 @@ #include "lib/rpmdb_internal.h" #include "debug.h" +const struct rpmdbOps_s *backends[] = { +#if defined(WITH_LMDB) + &lmdb_dbops, +#endif +#ifdef ENABLE_NDB + &ndb_dbops, +#endif +#if defined(WITH_BDB) + &db3_dbops, +#endif + &dummydb_dbops, + NULL +}; dbiIndex dbiFree(dbiIndex dbi) { @@ -38,59 +51,58 @@ dbDetectBackend(rpmdb rdb) const char *dbhome = rpmdbHome(rdb); char *db_backend = rpmExpand("%{?_db_backend}", NULL); char *path = NULL; + const struct rpmdbOps_s **ops, *ops_config; -#if defined(WITH_LMDB) - if (!strcmp(db_backend, "lmdb")) { - rdb->db_ops = &lmdb_dbops; - } else -#endif -#ifdef ENABLE_NDB - if (!strcmp(db_backend, "ndb")) { - rdb->db_ops = &ndb_dbops; - } else -#endif -#if defined(WITH_BDB) - { - rdb->db_ops = &db3_dbops; - if (*db_backend == '\0') { - free(db_backend); - db_backend = xstrdup("bdb"); + rdb->db_ops = NULL; + + ops_config = NULL; + for (ops = backends; *ops; ops++) { + if (rstreq(db_backend, (*ops)->name)) { + ops_config = *ops; + break; } } -#endif -#if defined(WITH_LMDB) - path = rstrscat(NULL, dbhome, "/data.mdb", NULL); - if (access(path, F_OK) == 0 && rdb->db_ops != &lmdb_dbops) { - rdb->db_ops = &lmdb_dbops; - rpmlog(RPMLOG_WARNING, _("Found LMDB data.mdb database while attempting %s backend: using lmdb backend.\n"), db_backend); + /* if we have a configured backend, check it first */ + if (ops_config && ops_config->path) { + path = rstrscat(NULL, dbhome, "/", ops_config->path, NULL); + if (access(path, F_OK) == 0) + rdb->db_ops = ops_config; + free(path); } - free(path); -#endif -#ifdef ENABLE_NDB - path = rstrscat(NULL, dbhome, "/Packages.db", NULL); - if (access(path, F_OK) == 0 && rdb->db_ops != &ndb_dbops) { - rdb->db_ops = &ndb_dbops; - rpmlog(RPMLOG_WARNING, _("Found NDB Packages.db database while attempting %s backend: using ndb backend.\n"), db_backend); - } - free(path); -#endif + /* if it did not match, check all available backends */ + if (rdb->db_ops == NULL) { + for (ops = backends; *ops; ops++) { + if ((*ops)->path == NULL || *ops == ops_config) + continue; -#if defined(WITH_BDB) - path = rstrscat(NULL, dbhome, "/Packages", NULL); - if (access(path, F_OK) == 0 && rdb->db_ops != &db3_dbops) { - rdb->db_ops = &db3_dbops; - 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_DEBUG, + _("Found %s %s database while attempting %s backend: " + "using %s backend.\n"), + (*ops)->name, (*ops)->path, db_backend, (*ops)->name); + rdb->db_ops = *ops; + } + free(path); + if (rdb->db_ops != NULL) + break; + } } - free(path); -#endif + /* if we did not find a match, use the configured backend */ + if (rdb->db_ops == NULL && ops_config) + rdb->db_ops = ops_config; + + /* if everything failed fall back to dummydb */ if (rdb->db_ops == NULL) { rdb->db_ops = &dummydb_dbops; - rpmlog(RPMLOG_DEBUG, "using dummy database, installs not possible\n"); + rpmlog(RPMLOG_WARNING, "using dummy database, installs not possible\n"); } + rdb->db_descr = rdb->db_ops->name; + if (db_backend) free(db_backend); } --- ./lib/backend/dbi.h.orig 2020-01-17 11:52:17.960236465 +0000 +++ ./lib/backend/dbi.h 2020-01-17 11:57:36.907459407 +0000 @@ -51,7 +51,7 @@ struct rpmdb_s { int db_flags; int db_mode; /*!< open mode */ int db_perms; /*!< open permissions */ - char * db_descr; /*!< db backend description (for error msgs) */ + const char * db_descr; /*!< db backend description (for error msgs) */ struct dbChk_s * db_checked;/*!< headerCheck()'ed package instances */ rpmdb db_next; int db_opens; @@ -61,7 +61,7 @@ struct rpmdb_s { dbiIndex * db_indexes; /*!< Tag indices. */ int db_buildindex; /*!< Index rebuild indicator */ - struct rpmdbOps_s * db_ops; /*!< backend ops */ + const struct rpmdbOps_s * db_ops; /*!< backend ops */ /* dbenv and related parameters */ void * db_dbenv; /*!< Backend private handle */ @@ -244,6 +244,9 @@ RPM_GNUC_INTERNAL const void * idxdbKey(dbiIndex dbi, dbiCursor dbc, unsigned int *keylen); struct rpmdbOps_s { + const char *name; /* backend name */ + const char *path; /* main database name */ + int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags); int (*close)(dbiIndex dbi, unsigned int flags); int (*verify)(dbiIndex dbi, unsigned int flags); --- ./lib/backend/dummydb.c.orig 2020-01-17 11:50:49.472452046 +0000 +++ ./lib/backend/dummydb.c 2020-01-17 11:52:08.048260613 +0000 @@ -93,6 +93,9 @@ static const void * dummydb_idxdbKey(dbi struct rpmdbOps_s dummydb_dbops = { + .name = "dummy", + .path = NULL, + .open = dummydb_Open, .close = dummydb_Close, .verify = dummydb_Verify, --- ./lib/backend/lmdb.c.orig 2020-01-17 11:50:45.808460969 +0000 +++ ./lib/backend/lmdb.c 2020-01-17 11:58:30.247329459 +0000 @@ -137,10 +137,6 @@ static int db_init(rpmdb rdb, const char if (rdb->db_dbenv != NULL) { rdb->db_opens++; return 0; - } else { - /* On first call, set backend description to something... */ - free(rdb->db_descr); - rdb->db_descr = xstrdup("lmdb"); } MDB_dbi maxdbs = 32; @@ -916,6 +912,9 @@ exit: } struct rpmdbOps_s lmdb_dbops = { + .name = "lmdb", + .path = "data.mdb", + .open = lmdb_dbiOpen, .close = lmdb_dbiClose, .verify = lmdb_dbiVerify, --- ./lib/backend/ndb/glue.c.orig 2020-01-17 11:51:09.708402746 +0000 +++ ./lib/backend/ndb/glue.c 2020-01-17 11:51:56.272289298 +0000 @@ -482,6 +482,9 @@ static const void * ndb_idxdbKey(dbiInde struct rpmdbOps_s ndb_dbops = { + .name = "ndb", + .path = "Packages.db", + .open = ndb_Open, .close = ndb_Close, .verify = ndb_Verify, --- ./lib/rpmdb.c.orig 2020-01-17 11:59:15.279219743 +0000 +++ ./lib/rpmdb.c 2020-01-17 12:00:36.495021876 +0000 @@ -417,7 +417,6 @@ int rpmdbClose(rpmdb db) db->db_fullpath = _free(db->db_fullpath); db->db_checked = dbChkFree(db->db_checked); db->db_indexes = _free(db->db_indexes); - db->db_descr = _free(db->db_descr); if (next) { *prev = next->db_next; @@ -482,7 +481,6 @@ static rpmdb newRpmdb(const char * root, db->db_tags = dbiTags; db->db_ndbi = sizeof(dbiTags) / sizeof(rpmDbiTag); db->db_indexes = xcalloc(db->db_ndbi, sizeof(*db->db_indexes)); - db->db_descr = xstrdup("unknown db"); db->nrefs = 0; return rpmdbLink(db); } @@ -517,6 +515,8 @@ static int openDatabase(const char * pre /* Just the primary Packages database opened here */ rc = pkgdbOpen(db, db->db_flags, NULL); + if (!db->db_descr) + db->db_descr = "unknown db"; } if (rc || justCheck || dbp == NULL) ++++++ disable_bdb.diff ++++++ --- configure.ac.orig 2020-01-17 12:25:06.451387587 +0000 +++ configure.ac 2020-01-17 12:25:17.707357939 +0000 @@ -537,11 +537,11 @@ AC_ARG_ENABLE([bdb], [enable_bdb="$enableval"], [enable_bdb=yes]) +have_bdb="no" AS_IF([test "x$enable_bdb" != "xno"], [ if [ test -x db/dist/configure ]; then have_bdb="internal" else - have_bdb="no" AC_CHECK_HEADERS([db.h],[ AC_PREPROC_IFELSE([ AC_LANG_SOURCE([ ++++++ ndb_backport.diff ++++++ ++++ 733 lines (skipped) ++++++ rpmqpack.diff ++++++ --- /var/tmp/diff_new_pack.ikm4Ev/_old 2020-03-19 19:40:12.583844646 +0100 +++ /var/tmp/diff_new_pack.ikm4Ev/_new 2020-03-19 19:40:12.587844649 +0100 @@ -50,9 +50,9 @@ + +.SH AUTHOR +Michael Schroeder <m...@suse.de> ---- ./rpmqpack.c.orig 2017-12-01 15:04:13.398003904 +0000 -+++ ./rpmqpack.c 2017-12-01 15:04:13.398003904 +0000 -@@ -0,0 +1,59 @@ +--- ./rpmqpack.c.orig 2019-12-06 10:14:03.989178873 +0000 ++++ ./rpmqpack.c 2019-12-06 10:32:16.430275015 +0000 +@@ -0,0 +1,60 @@ +#include <sys/types.h> +#include <limits.h> +#include <fcntl.h> @@ -60,55 +60,56 @@ +#include <stdlib.h> +#include <string.h> + -+#include <db.h> -+ -+DBT key; -+DBT data; ++#include <rpm/rpmts.h> ++#include <rpm/rpmdb.h> ++#include <rpm/rpmmacro.h> + +int +main(int argc, char **argv) +{ -+ DB *db = 0; -+ DBC *dbc = 0; + int ret = 0; ++ rpmts ts; + -+ if (db_create(&db, 0, 0)) ++ rpmDefineMacro(NULL, "_dbpath /var/lib/rpm", 0); ++ ts = rpmtsCreate(); ++ if (!ts) + { -+ perror("db_create"); ++ fprintf(stderr, "rpmtsCreate failed\n"); + exit(1); + } -+ if (db->open(db, 0, "/var/lib/rpm/Name", 0, DB_UNKNOWN, DB_RDONLY, 0664)) ++ if (rpmtsOpenDB(ts, O_RDONLY)) + { -+ perror("db->open"); ++ perror("rpmtsOpenDB"); + exit(1); + } -+ if (argc == 1) ++ if (argc <= 1) + { -+ if (db->cursor(db, NULL, &dbc, 0)) ++ rpmdbIndexIterator ii; ++ ii = rpmdbIndexIteratorInit(rpmtsGetRdb(ts), RPMDBI_NAME); ++ if (ii) + { -+ perror("db->cursor"); -+ exit(1); ++ const void *key = 0; ++ size_t keylen = 0; ++ while ((rpmdbIndexIteratorNext(ii, &key, &keylen)) == 0) ++ printf("%*.*s\n", (int)keylen, (int)keylen, (char *)key); + } -+ while (dbc->c_get(dbc, &key, &data, DB_NEXT) == 0) -+ printf("%*.*s\n", (int)key.size, (int)key.size, (char *)key.data); -+ dbc->c_close(dbc); ++ rpmdbIndexIteratorFree(ii); + } + else + { + argc--; + while (argc--) + { ++ rpmdbMatchIterator mi; + argv++; -+ key.data = (void *)*argv; -+ key.size = strlen(*argv); -+ data.data = NULL; -+ data.size = 0; -+ if (db->get(db, 0, &key, &data, 0) == 0) ++ mi = rpmdbInitIterator(rpmtsGetRdb(ts), RPMDBI_NAME, (void *)*argv, strlen(*argv)); ++ if (mi && rpmdbGetIteratorCount(mi)) + printf("%s\n", *argv); -+ else ++ else + ret = 1; -+ } ++ rpmdbFreeIterator(mi); ++ } + } -+ db->close(db, 0); ++ rpmtsFree(ts); + return ret; +}