diff options
author | jbj <devnull@localhost> | 2000-04-21 00:21:15 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-04-21 00:21:15 +0000 |
commit | ac6c6b770402ad1800e255df280458e39d0fc1a2 (patch) | |
tree | 2a0be69c6ba8cf6e0f27c51a1f324b17a3a22a87 /lib/db3.c | |
parent | eca43c56fb5c29ec13f3bea77b9ea4d76c9ec9e0 (diff) | |
download | rpm-ac6c6b770402ad1800e255df280458e39d0fc1a2.tar.gz rpm-ac6c6b770402ad1800e255df280458e39d0fc1a2.tar.bz2 rpm-ac6c6b770402ad1800e255df280458e39d0fc1a2.zip |
fix: legacy packages required provides EVR/Flags to be added.
fix: generating provides EVER was broke with epoch.
db3 tuned for installer speed (i.e. no locking, create/remove on fly).
add new_db_api and old_db_api macros to control precisely for db version used.
CVS patchset: 3691
CVS date: 2000/04/21 00:21:15
Diffstat (limited to 'lib/db3.c')
-rw-r--r-- | lib/db3.c | 53 |
1 files changed, 22 insertions, 31 deletions
@@ -8,6 +8,7 @@ static int __do_dbcursor_rmw = 0; #include <rpmlib.h> #include <rpmmacro.h> +#include <rpmurl.h> /* XXX urlPath proto */ #include "rpmdb.h" /*@access dbiIndex@*/ @@ -247,8 +248,6 @@ static int db_fini(dbiIndex dbi) DB_ENV * dbenv = (DB_ENV *)dbi->dbi_dbenv; #if defined(__USE_DB3) char **dbconfig = NULL; - char * dbhome; - char * dbfile; int rc; if (dbenv == NULL) { @@ -256,21 +255,20 @@ static int db_fini(dbiIndex dbi) return 0; } - dbhome = alloca(strlen(dbi->dbi_file) + 1); - strcpy(dbhome, dbi->dbi_file); - dbfile = strrchr(dbhome, '/'); - if (dbfile) - *dbfile++ = '\0'; - else - dbfile = dbhome; - rc = dbenv->close(dbenv, 0); rc = cvtdberr(dbi, "dbenv->close", rc, _debug); if (__do_dbenv_remove < 0) __do_dbenv_remove = rpmExpandNumeric("%{_db3_dbenv_remove}"); if (__do_dbenv_remove) { + rpmdb rpmdb = dbi->dbi_rpmdb; + const char * urlfn; + const char * dbhome; int xx; + + urlfn = rpmGenPath(rpmdb->db_root, rpmdb->db_home, NULL); + (void) urlPath(urlfn, &dbhome); + xx = db_env_create(&dbenv, 0); xx = cvtdberr(dbi, "db_env_create", rc, _debug); xx = dbenv->remove(dbenv, dbhome, dbconfig, 0); @@ -867,22 +865,21 @@ static int db3open(dbiIndex dbi) #if defined(__USE_DB2) || defined(__USE_DB3) DB * db = NULL; - char * dbhome; - char * dbfile; - u_int32_t dbflags; DB_ENV * dbenv = NULL; DB_TXN * txnid = NULL; - - dbhome = alloca(strlen(dbi->dbi_file) + 1); - strcpy(dbhome, dbi->dbi_file); - dbfile = strrchr(dbhome, '/'); - if (dbfile) - *dbfile++ = '\0'; - else - dbfile = dbhome; - - dbflags = ( !(dbi->dbi_mode & O_RDWR) ? DB_RDONLY : - ((dbi->dbi_mode & O_CREAT) ? DB_CREATE : 0)); + u_int32_t dbflags; + const char * urlfn; + const char * dbhome; + const char * dbfile = "packages.db3"; + const char * dbsubfile; + + urlfn = rpmGenPath(rpmdb->db_root, rpmdb->db_home, NULL); + (void) urlPath(urlfn, &dbhome); + dbsubfile = (dbi->dbi_rpmtag ? tagName(dbi->dbi_rpmtag) : "Packages"), + + dbflags = 0; + if (!dbi->dbi_mode & O_RDWR) dbflags |= DB_RDONLY; + if ( dbi->dbi_mode & O_CREAT) dbflags |= DB_CREATE; rc = db_init(dbi, dbhome, dbflags, &dbenv); dbi->dbi_dbinfo = NULL; @@ -925,14 +922,8 @@ static int db3open(dbiIndex dbi) rc = cvtdberr(dbi, "db->set_dup_compare", rc, _debug); } dbi->dbi_dbinfo = NULL; -#ifndef DYING /* XXX FIXME */ - rc = db->open(db, "packages.db3", dbfile, - dbi_to_dbtype(dbi->dbi_type), dbflags, dbi->dbi_perms); -#else - rc = db->open(db, "packages.db3", - (dbi->dbi_rpmtag ? tagName(dbi->dbi_rpmtag) : "Packages"), + rc = db->open(db, dbfile, dbsubfile, dbi_to_dbtype(dbi->dbi_type), dbflags, dbi->dbi_perms); -#endif rc = cvtdberr(dbi, "db->open", rc, _debug); __use_cursors = rpmExpandNumeric("%{_db3_use_cursors}"); |