We don't support url's in db paths, rip.

- file:// vs / is silly and anything else wont work, so pretending
  url support just plain bogus
This commit is contained in:
Panu Matilainen 2008-04-03 20:48:17 +03:00
parent 110d354c72
commit 0bd84c9409
3 changed files with 11 additions and 46 deletions

View File

@ -12,7 +12,6 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#include <rpm/rpmtag.h>
#include <rpm/rpmmacro.h>
#include <rpm/rpmurl.h> /* XXX urlPath proto */
#include <rpm/rpmfileutil.h> /* rpmioMkPath */
#include <rpm/rpmlog.h>
@ -633,10 +632,9 @@ assert(db != NULL);
static int db3close(dbiIndex dbi, unsigned int flags)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
char * urlfn = NULL;
const char * root;
const char * home;
const char * dbhome;
char * dbhome;
const char * dbfile;
const char * dbsubfile;
DB * db = dbi->dbi_db;
@ -653,12 +651,7 @@ static int db3close(dbiIndex dbi, unsigned int flags)
root = NULL;
home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
urlfn = rpmGenPath(root, home, NULL);
(void) urlPath(urlfn, &dbhome);
dbhome = rpmGenPath(root, home, NULL);
if (dbi->dbi_temporary) {
dbfile = NULL;
dbsubfile = NULL;
@ -755,7 +748,7 @@ static int db3close(dbiIndex dbi, unsigned int flags)
exit:
dbi->dbi_db = NULL;
urlfn = _free(urlfn);
free(dbhome);
dbi = db3Free(dbi);
@ -765,10 +758,9 @@ exit:
static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
{
extern const struct _dbiVec db3vec;
char * urlfn = NULL;
const char * root;
const char * home;
const char * dbhome;
char * dbhome;
const char * dbfile;
const char * dbsubfile;
dbiIndex dbi = NULL;
@ -799,12 +791,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
root = NULL;
home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
urlfn = rpmGenPath(root, home, NULL);
(void) urlPath(urlfn, &dbhome);
dbhome = rpmGenPath(root, home, NULL);
if (dbi->dbi_temporary) {
dbfile = NULL;
dbsubfile = NULL;
@ -1183,7 +1170,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
(void) db3close(dbi, 0);
}
urlfn = _free(urlfn);
free(dbhome);
return rc;
}

View File

@ -901,26 +901,11 @@ rpmdb newRpmdb(const char * root,
if (perms >= 0) db->db_perms = perms;
if (flags >= 0) db->db_flags = flags;
/* HACK: no URL's for root prefixed dbpath yet. */
if (root && *root) {
const char * rootpath = NULL;
urltype ut = urlPath(root, &rootpath);
switch (ut) {
case URL_IS_PATH:
case URL_IS_UNKNOWN:
db->db_root = rpmGetPath(root, NULL);
break;
case URL_IS_HTTPS:
case URL_IS_HTTP:
case URL_IS_FTP:
case URL_IS_HKP:
case URL_IS_DASH:
default:
db->db_root = rpmGetPath(_DB_ROOT, NULL);
break;
}
db->db_root = rpmGetPath(root, NULL);
} else
db->db_root = rpmGetPath(_DB_ROOT, NULL);
db->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL);
if (!(db->db_home && db->db_home[0] != '%')) {
rpmlog(RPMLOG_ERR, _("no dbpath has been set\n"));

View File

@ -31,7 +31,6 @@
#include <rpm/rpmtag.h>
#include <rpm/rpmlog.h>
#include <rpm/rpmmacro.h>
#include <rpm/rpmurl.h> /* XXX urlPath proto */
#include <rpm/rpmfileutil.h> /* rpmioMkpath */
#include <rpm/rpmstring.h>
#include <rpm/rpmdb.h>
@ -776,10 +775,9 @@ static int sql_open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
{
extern const struct _dbiVec sqlitevec;
char * urlfn = NULL;
char * root;
char * home;
const char * dbhome;
char * dbhome;
const char * dbfile;
char * dbfname;
const char * sql_errcode;
@ -827,12 +825,7 @@ enterChroot(dbi);
dbi->dbi_mode=O_RDWR;
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
urlfn = rpmGenPath(NULL, home, NULL);
(void) urlPath(urlfn, &dbhome);
dbhome = rpmGenPath(NULL, home, NULL);
/*
* Create the /var/lib/rpm directory if it doesn't exist (root only).
@ -875,7 +868,7 @@ enterChroot(dbi);
(void) sql_close(dbi, 0);
}
urlfn = _free(urlfn);
free(dbhome);
dbfname = _free(dbfname);
leaveChroot(dbi);