Lose the remaining dbapi references in code + configuration

- Changing db_api to db_ver to force breakage on anything using the
  value, db_ver containing the BDB major version just to put something
  in the error messages where the dbapi version used to be.
This commit is contained in:
Panu Matilainen 2010-11-04 15:55:19 +02:00
parent 6a9bd4e97f
commit f9a32ac3de
5 changed files with 6 additions and 53 deletions

View File

@ -23,7 +23,7 @@ static const char * _errpfx = "rpmdb";
static int dbapi_err(rpmdb rdb, const char * msg, int error, int printit)
{
if (printit && error) {
int db_api = rdb->db_api;
int db_api = rdb->db_ver;
if (msg)
rpmlog(RPMLOG_ERR, _("db%d error(%d) from %s: %s\n"),
db_api, error, msg, db_strerror(error));

View File

@ -26,7 +26,7 @@ struct rpmdb_s {
int db_flags;
int db_mode; /*!< open mode */
int db_perms; /*!< open permissions */
int db_api; /*!< Berkeley API type */
int db_ver; /*!< Berkeley DB version */
unsigned char * db_bits; /*!< package instance bit mask. */
int db_nbits; /*!< no. of bits in mask. */
rpmdb db_next;

View File

@ -155,7 +155,6 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmDbiTagVal rpmtag, int flags)
{
int dbix;
dbiIndex dbi = NULL;
int _dbapi, _dbapi_rebuild, _dbapi_wanted;
int rc = 0;
if (db == NULL)
@ -172,19 +171,6 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmDbiTagVal rpmtag, int flags)
if ((dbi = db->_dbi[dbix]) != NULL)
return dbi;
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
if (_dbapi_rebuild < 1 || _dbapi_rebuild > 4)
_dbapi_rebuild = 4;
_dbapi_wanted = (db->db_flags & RPMDB_FLAG_REBUILD) ?
_dbapi_rebuild : db->db_api;
if (_dbapi == -1) {
_dbapi = 5;
}
if (_dbapi != 5) {
rpmlog(RPMLOG_ERR, _("dbiOpen: dbapi %d not available\n"), _dbapi);
return NULL;
}
errno = 0;
dbi = NULL;
rc = dbiOpen(db, rpmtag, &dbi, flags);
@ -193,7 +179,7 @@ static dbiIndex rpmdbOpenIndex(rpmdb db, rpmDbiTagVal rpmtag, int flags)
static int _printed[32];
if (!_printed[dbix & 0x1f]++)
rpmlog(RPMLOG_ERR, _("cannot open %s index using db%d - %s (%d)\n"),
rpmTagGetName(rpmtag), _dbapi,
rpmTagGetName(rpmtag), db->db_ver,
(rc > 0 ? strerror(rc) : ""), rc);
} else {
db->_dbi[dbix] = dbi;
@ -744,7 +730,7 @@ static rpmdb newRpmdb(const char * root, const char * home,
/* XXX remove environment after chrooted operations, for now... */
db->db_remove_env = (!rstreq(db->db_root, "/") ? 1 : 0);
db->_dbi = xcalloc(dbiTagsMax, sizeof(*db->_dbi));
db->db_api = -1; /* hmm... */
db->db_ver = DB_VERSION_MAJOR; /* XXX just to put something in messages */
db->nrefs = 0;
return rpmdbLink(db);
}
@ -2787,7 +2773,6 @@ exit:
* rm -f <prefix>/<dbpath>/__db.???
* Environment files not existing is not an error, failure to unlink is,
* return zero on success.
* Only useful for BDB, dbapi 3 and 4.
* TODO/FIX: push this down to db3.c where it belongs
*/
static int cleanDbenv(const char *prefix, const char *dbpath)
@ -2905,13 +2890,6 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
int failed = 0;
int removedir = 0;
int rc = 0, xx;
int _dbapi;
int _dbapi_rebuild;
if (prefix == NULL) prefix = "/";
_dbapi = rpmExpandNumeric("%{_dbapi}");
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
tfn = rpmGetPath("%{?_dbpath}", NULL);
if (rstreq(tfn, "")) {
@ -2954,23 +2932,18 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
}
removedir = 1;
rpmlog(RPMLOG_DEBUG, "opening old database with dbapi %d\n",
_dbapi);
rpmlog(RPMLOG_DEBUG, "opening old database\n");
if (openDatabase(prefix, dbpath, &olddb, O_RDONLY, 0644, 0)) {
rc = 1;
goto exit;
}
_dbapi = olddb->db_api;
rpmlog(RPMLOG_DEBUG, "opening new database with dbapi %d\n",
_dbapi_rebuild);
rpmlog(RPMLOG_DEBUG, "opening new database\n");
if (openDatabase(prefix, newdbpath, &newdb,
(O_RDWR | O_CREAT), 0644, RPMDB_FLAG_REBUILD)) {
rc = 1;
goto exit;
}
_dbapi_rebuild = newdb->db_api;
{ Header h = NULL;
rpmdbMatchIterator mi;
#define _RECNUM rpmdbGetIteratorOffset(mi)

View File

@ -538,15 +538,6 @@ print (t)\
# "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd".
%_dbi_config_Packages %{?_dbi_config} lockdbfd
# XXX legacy configuration.
# Choose db interface:
# 3 native db3 interface.
#
# There are two macros so that --rebuilddb can convert db1 -> db3.
#
%_dbapi 3
%_dbapi_rebuild 3
#==============================================================================
# ---- GPG/PGP/PGP5 signature macros.
# Macro(s) to hold the arguments passed to GPG/PGP for package

View File

@ -133,17 +133,6 @@ rpm alias --filecaps --qf '[%{FILENAMES}\t%|FILECAPS?{%{FILECAPS}}|\n]' \
# retrieving header group/description/summary.
rpm alias --i18ndomains --define '_i18ndomains !#:+'
# Choose db interface:
# 0 same as 1
# 1 native db1 interface (e.g. linux glibc libdb1 routines).
# 2 native db2 interface.
# 3 native db3 interface.
# -1 db3 -> db2 -> db1 (as available).
#
# There are two macros so that --rebuilddb can convert db1 -> db3
rpm alias --dbapi --define '_dbapi !#:+'
rpm alias --rebuilddbapi --define '_dbapi_rebuild !#:+'
rpm alias --rebuilddbpath --define '_dbapath_rebuild !#:+'
#==============================================================================