parent
76e42fa65b
commit
9c0c7e9fbd
|
@ -35,7 +35,7 @@ falloc.lo: falloc.c $(top_srcdir)/system.h rpmio.h falloc.h
|
|||
db3.lo: db3.c $(top_srcdir)/system.h rpmlib.h rpmdb.h
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
for F in $*.o $*.lo ; do \
|
||||
@__LD@ -r -o $${F}.o $${F} -L/usr/lib -ldb-3.0 ; \
|
||||
@__LD@ -r -o $${F}.o $${F} -L/usr/lib -ldb-3.0 -lpthread ; \
|
||||
@__OBJCOPY@ `\
|
||||
@__NM@ -g --defined-only $${F}.o | \
|
||||
sed -e '/ [DRTW] /!d' -e 's/.* [DRTW] /-L /' | \
|
||||
|
|
302
lib/db0.c
302
lib/db0.c
|
@ -18,6 +18,7 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
|
|||
#include "falloc.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define DBC void
|
||||
#include "rpmdb.h"
|
||||
/*@access dbiIndex@*/
|
||||
/*@access dbiIndexSet@*/
|
||||
|
@ -77,55 +78,11 @@ static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
#if defined(__USE_DB2)
|
||||
static int db_init(const char *home, int dbflags,
|
||||
DB_ENV **dbenvp, DB_INFO **dbinfop)
|
||||
{
|
||||
DB_ENV *dbenv = xcalloc(1, sizeof(*dbenv));
|
||||
DB_INFO *dbinfo = xcalloc(1, sizeof(*dbinfo));
|
||||
int rc;
|
||||
|
||||
if (dbenvp) *dbenvp = NULL;
|
||||
if (dbinfop) *dbinfop = NULL;
|
||||
|
||||
dbenv->db_errfile = stderr;
|
||||
dbenv->db_errpfx = "rpmdb";
|
||||
dbenv->mp_size = 1024 * 1024;
|
||||
|
||||
rc = db_appinit(home, NULL, dbenv, dbflags);
|
||||
if (rc)
|
||||
goto errxit;
|
||||
|
||||
dbinfo->db_pagesize = 1024;
|
||||
|
||||
if (dbenvp)
|
||||
*dbenvp = dbenv;
|
||||
else
|
||||
free(dbenv);
|
||||
|
||||
if (dbinfop)
|
||||
*dbinfop = dbinfo;
|
||||
else
|
||||
free(dbinfo);
|
||||
|
||||
return 0;
|
||||
|
||||
errxit:
|
||||
if (dbenv) free(dbenv);
|
||||
if (dbinfo) free(dbinfo);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int db0sync(dbiIndex dbi, unsigned int flags) {
|
||||
DB * db = GetDB(dbi);
|
||||
int rc;
|
||||
|
||||
#if defined(__USE_DB2)
|
||||
rc = db->sync(db, flags);
|
||||
#else
|
||||
rc = db->sync(db, flags);
|
||||
#endif
|
||||
|
||||
switch (rc) {
|
||||
default:
|
||||
|
@ -143,6 +100,11 @@ static int db0sync(dbiIndex dbi, unsigned int flags) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int db0byteswapped(dbiIndex dbi)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int db0SearchIndex(dbiIndex dbi, const void * str, size_t len,
|
||||
dbiIndexSet * set)
|
||||
{
|
||||
|
@ -160,11 +122,7 @@ static int db0SearchIndex(dbiIndex dbi, const void * str, size_t len,
|
|||
data.data = NULL;
|
||||
data.size = 0;
|
||||
|
||||
#if defined(__USE_DB2)
|
||||
rc = db->get(db, NULL, &key, &data, 0);
|
||||
#else
|
||||
rc = db->get(db, &key, &data, 0);
|
||||
#endif
|
||||
|
||||
switch (rc) {
|
||||
default:
|
||||
|
@ -231,11 +189,7 @@ static int db0UpdateIndex(dbiIndex dbi, const char * str, dbiIndexSet set) {
|
|||
data.data = dbir;
|
||||
data.size = set->count * sizeof(*dbir);
|
||||
|
||||
#if defined(__USE_DB2)
|
||||
rc = db->put(db, NULL, &key, &data, 0);
|
||||
#else
|
||||
rc = db->put(db, &key, &data, 0);
|
||||
#endif
|
||||
|
||||
switch (rc) {
|
||||
default:
|
||||
|
@ -249,11 +203,7 @@ static int db0UpdateIndex(dbiIndex dbi, const char * str, dbiIndexSet set) {
|
|||
}
|
||||
} else {
|
||||
|
||||
#if defined(__USE_DB2)
|
||||
rc = db->del(db, NULL, &key, 0);
|
||||
#else
|
||||
rc = db->del(db, &key, 0);
|
||||
#endif
|
||||
|
||||
switch (rc) {
|
||||
default:
|
||||
|
@ -283,15 +233,19 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset)
|
|||
|
||||
h = headerRead(pkgs, HEADER_MAGIC_NO);
|
||||
|
||||
if (h == NULL) return NULL;
|
||||
if (h == NULL)
|
||||
goto exit;
|
||||
|
||||
/* the RPM used to build much of RH 5.1 could produce packages whose
|
||||
file lists did not have leading /'s. Now is a good time to fix
|
||||
that */
|
||||
/*
|
||||
* The RPM used to build much of RH 5.1 could produce packages whose
|
||||
* file lists did not have leading /'s. Now is a good time to fix that.
|
||||
*/
|
||||
|
||||
/* If this tag isn't present, either no files are in the package or
|
||||
we're dealing with a package that has just the compressed file name
|
||||
list */
|
||||
/*
|
||||
* If this tag isn't present, either no files are in the package or
|
||||
* we're dealing with a package that has just the compressed file name
|
||||
* list.
|
||||
*/
|
||||
if (!headerGetEntryMinMemory(h, RPMTAG_OLDFILENAMES, NULL,
|
||||
(void **) &fileNames, &fileCount)) goto exit;
|
||||
|
||||
|
@ -319,41 +273,29 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset)
|
|||
newFileNames, fileCount);
|
||||
}
|
||||
|
||||
/* The file list was moved to a more compressed format which not
|
||||
only saves memory (nice), but gives fingerprinting a nice, fat
|
||||
speed boost (very nice). Go ahead and convert old headers to
|
||||
the new style (this is a noop for new headers) */
|
||||
/*
|
||||
* The file list was moved to a more compressed format which not
|
||||
* only saves memory (nice), but gives fingerprinting a nice, fat
|
||||
* speed boost (very nice). Go ahead and convert old headers to
|
||||
* the new style (this is a noop for new headers).
|
||||
*/
|
||||
compressFilelist(h);
|
||||
|
||||
exit:
|
||||
if (h) {
|
||||
uh = headerUnload(h);
|
||||
headerFree(h);
|
||||
}
|
||||
return uh;
|
||||
}
|
||||
|
||||
static int db0copen(dbiIndex dbi) {
|
||||
int rc = 0;
|
||||
#if defined(__USE_DB2)
|
||||
{ DBC * dbcursor = NULL;
|
||||
rc = dbp->cursor(dbp, NULL, &dbcursor, 0);
|
||||
if (rc == 0)
|
||||
dbi->dbi_dbcursor = dbcursor;
|
||||
}
|
||||
#endif
|
||||
dbi->dbi_lastoffset = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int db0cclose(dbiIndex dbi) {
|
||||
int rc = 0;
|
||||
#if defined(__USE_DB2)
|
||||
#endif
|
||||
dbi->dbi_lastoffset = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int db0join(dbiIndex dbi) {
|
||||
int rc = 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -361,72 +303,90 @@ static int db0cget(dbiIndex dbi, void ** keyp, size_t * keylen,
|
|||
void ** datap, size_t * datalen)
|
||||
{
|
||||
DBT key, data;
|
||||
DB * db;
|
||||
int rc;
|
||||
int rc = 0;
|
||||
|
||||
if (dbi == NULL)
|
||||
return 1;
|
||||
|
||||
if (dbi->dbi_pkgs) {
|
||||
memset(&key, 0, sizeof(key));
|
||||
memset(&data, 0, sizeof(data));
|
||||
if (keyp) key.data = *keyp;
|
||||
if (keylen) key.size = *keylen;
|
||||
if (datap) data.data = *datap;
|
||||
if (datalen) data.size = *datalen;
|
||||
|
||||
if (dbi->dbi_rpmtag == 0) {
|
||||
unsigned int offset;
|
||||
unsigned int newSize;
|
||||
|
||||
if (key.data == NULL) { /* XXX simulated DB_NEXT */
|
||||
if (dbi->dbi_lastoffset == 0) {
|
||||
dbi->dbi_lastoffset = fadFirstOffset(dbi->dbi_pkgs);
|
||||
} else {
|
||||
dbi->dbi_lastoffset = fadNextOffset(dbi->dbi_pkgs, dbi->dbi_lastoffset);
|
||||
}
|
||||
if (keyp)
|
||||
*keyp = &dbi->dbi_lastoffset;
|
||||
if (keylen)
|
||||
*keylen = sizeof(dbi->dbi_lastoffset);
|
||||
return 0;
|
||||
key.data = &dbi->dbi_lastoffset;
|
||||
key.size = sizeof(dbi->dbi_lastoffset);
|
||||
}
|
||||
|
||||
if (dbi->dbi_db == NULL)
|
||||
memcpy(&offset, key.data, sizeof(offset));
|
||||
/* XXX hack to pass sizeof header to fadAlloc */
|
||||
newSize = data.size;
|
||||
|
||||
if (offset == 0) { /* XXX simulated offset 0 record */
|
||||
offset = fadAlloc(dbi->dbi_pkgs, newSize);
|
||||
if (offset == 0)
|
||||
return -1;
|
||||
offset--; /* XXX hack: caller will increment */
|
||||
/* XXX hack: return offset as data, free in db0cput */
|
||||
data.data = xmalloc(sizeof(offset));
|
||||
memcpy(data.data, &offset, sizeof(offset));
|
||||
data.size = sizeof(offset);
|
||||
} else { /* XXX simulated retrieval */
|
||||
data.data = doGetRecord(dbi->dbi_pkgs, offset);
|
||||
data.size = 0; /* XXX WRONG */
|
||||
if (data.data == NULL)
|
||||
rc = 1;
|
||||
}
|
||||
} else {
|
||||
DB * db;
|
||||
int _printit;
|
||||
|
||||
if ((db = dbi->dbi_db) == NULL)
|
||||
return 1;
|
||||
db = GetDB(dbi);
|
||||
_mymemset(&key, 0, sizeof(key));
|
||||
_mymemset(&data, 0, sizeof(data));
|
||||
|
||||
key.data = NULL;
|
||||
key.size = 0;
|
||||
|
||||
#if defined(__USE_DB2)
|
||||
{ DBC * dbcursor;
|
||||
|
||||
if ((dbcursor = dbi->dbi_dbcursor) == NULL) {
|
||||
rc = db2copen(dbi);
|
||||
if (rc)
|
||||
return rc;
|
||||
dbcursor = dbi->dbi_dbcursor;
|
||||
}
|
||||
|
||||
rc = dbcursor->c_get(dbcursor, &key, &data,
|
||||
(dbi->dbi_lastoffset++ ? DB_NEXT : DB_FIRST));
|
||||
if (rc == DB_NOTFOUND)
|
||||
db2cclose(dbcursor)
|
||||
}
|
||||
#else
|
||||
if (key.data == NULL) {
|
||||
rc = db->seq(db, &key, &data, (dbi->dbi_lastoffset++ ? R_NEXT : R_FIRST));
|
||||
#endif
|
||||
_printit = (rc == 1 ? 0 : _debug);
|
||||
rc = cvtdberr(dbi, "db->seq", rc, _printit);
|
||||
} else {
|
||||
rc = db->get(db, &key, &data, 0);
|
||||
_printit = (rc == 1 ? 0 : _debug);
|
||||
rc = cvtdberr(dbi, "db0cget", rc, _printit);
|
||||
}
|
||||
}
|
||||
|
||||
switch (rc) {
|
||||
default:
|
||||
case RET_ERROR: /* -1 */
|
||||
rc = -1;
|
||||
break;
|
||||
case RET_SPECIAL: /* 1 */
|
||||
rc = 1;
|
||||
if (keyp)
|
||||
*keyp = NULL;
|
||||
break;
|
||||
case RET_SUCCESS: /* 0 */
|
||||
rc = 0;
|
||||
if (keyp)
|
||||
*keyp = key.data;
|
||||
if (keyp) *keyp = key.data;
|
||||
if (keylen) *keylen = key.size;
|
||||
if (datap) *datap = data.data;
|
||||
if (datalen) *datalen = data.size;
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int db0del(dbiIndex dbi, void * keyp, size_t keylen)
|
||||
static int db0cdel(dbiIndex dbi, void * keyp, size_t keylen)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
@ -450,80 +410,86 @@ static int db0del(dbiIndex dbi, void * keyp, size_t keylen)
|
|||
return rc;
|
||||
}
|
||||
|
||||
#ifndef DYING
|
||||
static int db0get(dbiIndex dbi, void * keyp, size_t keylen,
|
||||
void ** datap, size_t * datalen)
|
||||
{
|
||||
unsigned int newSize = 0;
|
||||
DBT key, data;
|
||||
int rc = 0;
|
||||
|
||||
if (datap) *datap = NULL;
|
||||
if (datalen) {
|
||||
/* XXX hack to pass sizeof header to fadAlloc */
|
||||
newSize = *datalen;
|
||||
*datalen = 0;
|
||||
}
|
||||
memset(&key, 0, sizeof(key));
|
||||
memset(&data, 0, sizeof(data));
|
||||
if (keyp) key.data = keyp;
|
||||
if (keylen) key.size = keylen;
|
||||
if (datap) data.data = *datap;
|
||||
if (datalen) data.size = *datalen;
|
||||
|
||||
if (dbi->dbi_rpmtag == 0) {
|
||||
unsigned int offset;
|
||||
unsigned int newSize;
|
||||
|
||||
memcpy(&offset, keyp, sizeof(offset));
|
||||
memcpy(&offset, key.data, sizeof(offset));
|
||||
/* XXX hack to pass sizeof header to fadAlloc */
|
||||
newSize = data.size;
|
||||
|
||||
if (offset == 0) {
|
||||
if (offset == 0) { /* XXX simulated offset 0 record */
|
||||
offset = fadAlloc(dbi->dbi_pkgs, newSize);
|
||||
if (offset == 0)
|
||||
return -1;
|
||||
offset--; /* XXX hack: caller will increment */
|
||||
*datap = xmalloc(sizeof(offset));
|
||||
memcpy(*datap, &offset, sizeof(offset));
|
||||
*datalen = sizeof(offset);
|
||||
} else {
|
||||
void * uh = doGetRecord(dbi->dbi_pkgs, offset);
|
||||
if (uh == NULL)
|
||||
return 1;
|
||||
if (datap)
|
||||
*datap = uh;
|
||||
if (datalen)
|
||||
*datalen = 0; /* XXX WRONG */
|
||||
/* XXX hack: return offset as data, free in db0cput */
|
||||
data.data = xmalloc(sizeof(offset));
|
||||
memcpy(data.data, &offset, sizeof(offset));
|
||||
data.size = sizeof(offset);
|
||||
} else { /* XXX simulated retrieval */
|
||||
data.data = doGetRecord(dbi->dbi_pkgs, offset);
|
||||
data.size = 0; /* XXX WRONG */
|
||||
if (data.data == NULL)
|
||||
rc = 1;
|
||||
}
|
||||
} else {
|
||||
DBT key, data;
|
||||
DB * db = GetDB(dbi);
|
||||
|
||||
_mymemset(&key, 0, sizeof(key));
|
||||
_mymemset(&data, 0, sizeof(data));
|
||||
|
||||
key.data = keyp;
|
||||
key.size = keylen;
|
||||
data.data = NULL;
|
||||
data.size = 0;
|
||||
int _printit;
|
||||
|
||||
rc = db->get(db, &key, &data, 0);
|
||||
rc = cvtdberr(dbi, "db->get", rc, _debug);
|
||||
_printit = (rc == 1 ? 0 : _debug);
|
||||
rc = cvtdberr(dbi, "db0get", rc, _printit);
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
*datap = data.data;
|
||||
*datalen = data.size;
|
||||
}
|
||||
if (datap) *datap = data.data;
|
||||
if (datalen) *datalen = data.size;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif /* DYING */
|
||||
|
||||
static int db0put(dbiIndex dbi, void * keyp, size_t keylen,
|
||||
static int db0cput(dbiIndex dbi, void * keyp, size_t keylen,
|
||||
void * datap, size_t datalen)
|
||||
{
|
||||
DBT key, data;
|
||||
int rc = 0;
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
memset(&data, 0, sizeof(data));
|
||||
key.data = keyp;
|
||||
key.size = keylen;
|
||||
data.data = datap;
|
||||
data.size = datalen;
|
||||
|
||||
if (dbi->dbi_rpmtag == 0) {
|
||||
unsigned int offset;
|
||||
|
||||
memcpy(&offset, keyp, sizeof(offset));
|
||||
memcpy(&offset, key.data, sizeof(offset));
|
||||
|
||||
if (offset == 0) {
|
||||
if (datalen == sizeof(offset))
|
||||
free(datap);
|
||||
} else {
|
||||
Header h = headerLoad(datap);
|
||||
if (offset == 0) { /* XXX simulated offset 0 record */
|
||||
/* XXX hack: return offset as data, free in db0cput */
|
||||
if (data.size == sizeof(offset)) {
|
||||
free(data.data);
|
||||
}
|
||||
} else { /* XXX simulated DB_KEYLAST */
|
||||
Header h = headerLoad(data.data);
|
||||
int newSize = headerSizeof(h, HEADER_MAGIC_NO);
|
||||
|
||||
(void)Fseek(dbi->dbi_pkgs, offset, SEEK_SET);
|
||||
|
@ -535,17 +501,8 @@ static int db0put(dbiIndex dbi, void * keyp, size_t keylen,
|
|||
headerFree(h);
|
||||
}
|
||||
} else {
|
||||
DBT key, data;
|
||||
DB * db = GetDB(dbi);
|
||||
|
||||
_mymemset(&key, 0, sizeof(key));
|
||||
_mymemset(&data, 0, sizeof(data));
|
||||
|
||||
key.data = keyp;
|
||||
key.size = keylen;
|
||||
data.data = datap;
|
||||
data.size = datalen;
|
||||
|
||||
rc = db->put(db, &key, &data, 0);
|
||||
rc = cvtdberr(dbi, "db->put", rc, _debug);
|
||||
}
|
||||
|
@ -646,11 +603,11 @@ static int db0open(rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
|
|||
}
|
||||
|
||||
exit:
|
||||
if (rc == 0 && dbi->dbi_db != NULL && dbip != NULL) {
|
||||
if (rc == 0 && dbip) {
|
||||
rc = 0;
|
||||
*dbip = dbi;
|
||||
if (_debug < 0)
|
||||
fprintf(stderr, "*** db%dopen: %s\n", dbi->dbi_major, urlfn);
|
||||
fprintf(stderr, "*** db%dopen: rpmtag %d dbi %p %s\n", dbi->dbi_major, rpmtag, dbi, urlfn);
|
||||
} else {
|
||||
rc = 1;
|
||||
db3Free(dbi);
|
||||
|
@ -671,5 +628,6 @@ fprintf(stderr, "*** db%dopen: %s\n", dbi->dbi_major, urlfn);
|
|||
struct _dbiVec db0vec = {
|
||||
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
|
||||
db0open, db0close, db0sync, db0SearchIndex, db0UpdateIndex,
|
||||
db0del, db0get, db0put, db0copen, db0cclose, db0join, db0cget
|
||||
db0cdel, db0get, db0cput, db0copen, db0cclose, db0cdel, db0cget, db0cput,
|
||||
db0byteswapped
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
#include <rpmlib.h>
|
||||
|
||||
#include "depends.h"
|
||||
#include "rpmdb.h"
|
||||
#include "misc.h"
|
||||
|
||||
/*@access rpmdb@*/
|
||||
/*@access rpmTransactionSet@*/
|
||||
|
||||
int headerNVR(Header h, const char **np, const char **vp, const char **rp)
|
||||
|
@ -20,35 +20,40 @@ int headerNVR(Header h, const char **np, const char **vp, const char **rp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static /*@only@*/ char *printDepend(const char * key, const char * keyEVR,
|
||||
static /*@only@*/ char *printDepend(const char * depend, const char * key, const char * keyEVR,
|
||||
int keyFlags)
|
||||
{
|
||||
char *tbuf, *t;
|
||||
size_t nb;
|
||||
|
||||
nb = 0;
|
||||
if (depend) nb += strlen(depend) + 1;
|
||||
if (key) nb += strlen(key);
|
||||
if (keyFlags) {
|
||||
if (keyFlags & RPMSENSE_SENSEMASK) {
|
||||
if (nb) nb++;
|
||||
if (keyFlags & RPMSENSE_LESS) nb++;
|
||||
if (keyFlags & RPMSENSE_GREATER) nb++;
|
||||
if (keyFlags & RPMSENSE_EQUAL) nb++;
|
||||
}
|
||||
if (keyEVR) {
|
||||
if (keyEVR && *keyEVR) {
|
||||
if (nb) nb++;
|
||||
nb += strlen(keyEVR);
|
||||
}
|
||||
|
||||
t = tbuf = xmalloc(nb + 1);
|
||||
if (depend) {
|
||||
while(*depend) *t++ = *depend++;
|
||||
*t++ = ' ';
|
||||
}
|
||||
if (key)
|
||||
while(*key) *t++ = *key++;
|
||||
if (keyFlags) {
|
||||
if (keyFlags & RPMSENSE_SENSEMASK) {
|
||||
if (t != tbuf) *t++ = ' ';
|
||||
if (keyFlags & RPMSENSE_LESS) *t++ = '<';
|
||||
if (keyFlags & RPMSENSE_GREATER) *t++ = '>';
|
||||
if (keyFlags & RPMSENSE_EQUAL) *t++ = '=';
|
||||
}
|
||||
if (keyEVR) {
|
||||
if (keyEVR && *keyEVR) {
|
||||
if (t != tbuf) *t++ = ' ';
|
||||
while(*keyEVR) *t++ = *keyEVR++;
|
||||
}
|
||||
|
@ -394,8 +399,8 @@ int rpmFLAGS = RPMSENSE_EQUAL;
|
|||
static int rangesOverlap(const char *AName, const char *AEVR, int AFlags,
|
||||
const char *BName, const char *BEVR, int BFlags)
|
||||
{
|
||||
const char *aDepend = printDepend(AName, AEVR, AFlags);
|
||||
const char *bDepend = printDepend(BName, BEVR, BFlags);
|
||||
const char *aDepend = printDepend(NULL, AName, AEVR, AFlags);
|
||||
const char *bDepend = printDepend(NULL, BName, BEVR, BFlags);
|
||||
char *aEVR, *bEVR;
|
||||
const char *aE, *aV, *aR, *bE, *bV, *bR;
|
||||
int result;
|
||||
|
@ -884,6 +889,15 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
|
||||
if (suggestion) *suggestion = NULL;
|
||||
|
||||
{ mi = rpmdbInitIterator(rpmdep->db, 1, keyDepend, 0);
|
||||
if (mi) {
|
||||
rc = rpmdbGetIteratorOffset(mi);
|
||||
rpmdbFreeIterator(mi);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by Depends cache.\n"), keyType, keyDepend+2);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
{ const char * rcProvidesString;
|
||||
const char * start;
|
||||
|
||||
|
@ -892,7 +906,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
i = strlen(keyName);
|
||||
while ((start = strstr(rcProvidesString, keyName))) {
|
||||
if (isspace(start[i]) || start[i] == '\0' || start[i] == ',') {
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by rpmrc provides.\n"), keyType, keyDepend);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by rpmrc provides.\n"), keyType, keyDepend+2);
|
||||
goto exit;
|
||||
}
|
||||
rcProvidesString = start + 1;
|
||||
|
@ -920,7 +934,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
}
|
||||
rpmdbFreeIterator(mi);
|
||||
if (h) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db file lists.\n"), keyType, keyDepend);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db file lists.\n"), keyType, keyDepend+2);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -938,7 +952,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
}
|
||||
rpmdbFreeIterator(mi);
|
||||
if (h) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db provides.\n"), keyType, keyDepend);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db provides.\n"), keyType, keyDepend+2);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -956,7 +970,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
}
|
||||
rpmdbFreeIterator(mi);
|
||||
if (h) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db packages.\n"), keyType, keyDepend);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by db packages.\n"), keyType, keyDepend+2);
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
@ -969,7 +983,7 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
if (!strcmp(keyName, rpmNAME)) {
|
||||
i = rangesOverlap(keyName, keyEVR, keyFlags, rpmNAME, rpmEVR, rpmFLAGS);
|
||||
if (i) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by rpmlib version.\n"), keyType, keyDepend);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s satisfied by rpmlib version.\n"), keyType, keyDepend+2);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -979,10 +993,14 @@ static int unsatisfiedDepend(rpmTransactionSet rpmdep,
|
|||
*suggestion = alSatisfiesDepend(&rpmdep->availablePackages, NULL, NULL,
|
||||
keyName, keyEVR, keyFlags);
|
||||
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s unsatisfied.\n"), keyType, keyDepend);
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s: %s unsatisfied.\n"), keyType, keyDepend+2);
|
||||
rc = 1; /* dependency is unsatisfied */
|
||||
|
||||
exit:
|
||||
{ dbiIndex dbi;
|
||||
if ((dbi = dbiOpen(rpmdep->db, 1)) != NULL)
|
||||
(void) dbiPut(dbi, keyDepend, 0, &rc, sizeof(rc));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -1018,7 +1036,7 @@ static int checkPackageDeps(rpmTransactionSet rpmdep, struct problemsSet * psp,
|
|||
if (keyName && strcmp(keyName, requires[i]))
|
||||
continue;
|
||||
|
||||
keyDepend = printDepend(requires[i], requiresEVR[i], requireFlags[i]);
|
||||
keyDepend = printDepend("R", requires[i], requiresEVR[i], requireFlags[i]);
|
||||
|
||||
rc = unsatisfiedDepend(rpmdep, " requires", keyDepend,
|
||||
requires[i], requiresEVR[i], requireFlags[i], &suggestion);
|
||||
|
@ -1081,7 +1099,7 @@ static int checkPackageDeps(rpmTransactionSet rpmdep, struct problemsSet * psp,
|
|||
if (keyName && strcmp(keyName, conflicts[i]))
|
||||
continue;
|
||||
|
||||
keyDepend = printDepend(conflicts[i], conflictsEVR[i], conflictFlags[i]);
|
||||
keyDepend = printDepend("C", conflicts[i], conflictsEVR[i], conflictFlags[i]);
|
||||
|
||||
rc = unsatisfiedDepend(rpmdep, "conflicts", keyDepend,
|
||||
conflicts[i], conflictsEVR[i], conflictFlags[i], NULL);
|
||||
|
|
|
@ -511,9 +511,11 @@ static void *doHeaderUnload(Header h, /*@out@*/int * lengthPtr)
|
|||
|
||||
void *headerUnload(Header h)
|
||||
{
|
||||
void * uh;
|
||||
int length;
|
||||
|
||||
return doHeaderUnload(h, &length);
|
||||
uh = doHeaderUnload(h, &length);
|
||||
return uh;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
|
|
146
lib/rpmdb.c
146
lib/rpmdb.c
|
@ -102,7 +102,6 @@ static void dbiTagsInit(void)
|
|||
}
|
||||
|
||||
#define dbiSync(_dbi) (*(_dbi)->dbi_vec->sync) ((_dbi), 0)
|
||||
#define dbiClose(_dbi) (*(_dbi)->dbi_vec->close) ((_dbi), 0)
|
||||
|
||||
/**
|
||||
* Create and initialize element of index database set.
|
||||
|
@ -111,7 +110,7 @@ static void dbiTagsInit(void)
|
|||
* @return new element
|
||||
*/
|
||||
static inline dbiIndexRecord dbiReturnIndexRecordInstance(unsigned int recOffset, unsigned int fileNumber) {
|
||||
dbiIndexRecord rec = xmalloc(sizeof(*rec));
|
||||
dbiIndexRecord rec = xcalloc(1, sizeof(*rec));
|
||||
rec->recOffset = recOffset;
|
||||
rec->fileNumber = fileNumber;
|
||||
return rec;
|
||||
|
@ -264,27 +263,30 @@ static inline void dbiIndexRecordOffsetSave(dbiIndexSet set, int recno, unsigned
|
|||
set->recs[recno].recOffset = recoff;
|
||||
}
|
||||
|
||||
#ifdef DYING
|
||||
dbiIndex dbiNew(rpmdb rpmdb, int rpmtag) {
|
||||
dbiIndex dbi = xcalloc(1, sizeof(*dbi));
|
||||
int dbiClose(dbiIndex dbi, int flag) {
|
||||
int rc;
|
||||
|
||||
dbi->dbi_rpmdb = rpmdb;
|
||||
dbi->dbi_rpmtag = rpmtag;
|
||||
dbi->dbi_perms = 0644;
|
||||
dbi->dbi_jlen = (rpmtag == RPMTAG_BASENAMES ? 2 : 1) * sizeof(int_32);
|
||||
return dbi;
|
||||
rc = (*dbi->dbi_vec->close) (dbi, flag);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void dbiFree( /*@only@*/ /*@null@*/ dbiIndex dbi) {
|
||||
if (dbi) {
|
||||
if (dbi->dbi_errpfx) xfree(dbi->dbi_errpfx);
|
||||
if (dbi->dbi_re_source) xfree(dbi->dbi_re_source);
|
||||
if (dbi->dbi_dbenv) free(dbi->dbi_dbenv);
|
||||
if (dbi->dbi_dbinfo) free(dbi->dbi_dbinfo);
|
||||
xfree(dbi);
|
||||
}
|
||||
int dbiPut(dbiIndex dbi, const void * key, size_t keylen,
|
||||
const void * data, size_t datalen)
|
||||
{
|
||||
dbiIndexSet set = xcalloc(1, sizeof(*set));
|
||||
size_t nb = (datalen < sizeof(*set->recs) ? datalen : sizeof(*set->recs));
|
||||
int rc;
|
||||
|
||||
set->count = 1;
|
||||
set->recs = dbiReturnIndexRecordInstance(0, 0);
|
||||
memcpy(set->recs, data, nb);
|
||||
|
||||
rc = (*dbi->dbi_vec->UpdateIndex) (dbi, key, set);
|
||||
|
||||
dbiFreeIndexSet(set);
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct _dbiVec *mydbvecs[] = {
|
||||
DB0vec, DB1vec, DB2vec, DB3vec, NULL
|
||||
|
@ -296,7 +298,7 @@ static struct _dbiVec *mydbvecs[] = {
|
|||
* @param dbix dbi template to use
|
||||
* @return index database handle
|
||||
*/
|
||||
static dbiIndex dbiOpenIndex(rpmdb rpmdb, int rpmtag)
|
||||
dbiIndex dbiOpen(rpmdb rpmdb, int rpmtag)
|
||||
{
|
||||
int dbix;
|
||||
dbiIndex dbi = NULL;
|
||||
|
@ -355,7 +357,7 @@ static dbiIndex dbiOpenIndex(rpmdb rpmdb, int rpmtag)
|
|||
if (rc == 0) {
|
||||
rpmdb->_dbi[dbix] = dbi;
|
||||
} else if (dbi) {
|
||||
rpmError(RPMERR_DBOPEN, _("dbiOpenIndex: cannot open %s index"),
|
||||
rpmError(RPMERR_DBOPEN, _("dbiOpen: cannot open %s index"),
|
||||
tagName(rpmtag));
|
||||
db3Free(dbi);
|
||||
dbi = NULL;
|
||||
|
@ -364,20 +366,6 @@ static dbiIndex dbiOpenIndex(rpmdb rpmdb, int rpmtag)
|
|||
return dbi;
|
||||
}
|
||||
|
||||
#ifdef DYING
|
||||
/**
|
||||
* Close index database.
|
||||
* @param dbi index database handle
|
||||
*/
|
||||
static int dbiClose(dbiIndex dbi) {
|
||||
int rc;
|
||||
|
||||
rc = (*dbi->dbi_vec->close) (dbi, 0);
|
||||
db3Free(dbi);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX depends.c, install.c, query.c, rpminstall.c, transaction.c */
|
||||
void dbiFreeIndexSet(dbiIndexSet set) {
|
||||
if (set) {
|
||||
|
@ -390,17 +378,21 @@ void dbiFreeIndexSet(dbiIndexSet set) {
|
|||
|
||||
static sigset_t signalMask;
|
||||
|
||||
static void blockSignals(void)
|
||||
static void blockSignals(rpmdb rpmdb)
|
||||
{
|
||||
sigset_t newMask;
|
||||
|
||||
if (!(rpmdb && rpmdb->db_major == 3)) {
|
||||
sigfillset(&newMask); /* block all signals */
|
||||
sigprocmask(SIG_BLOCK, &newMask, &signalMask);
|
||||
}
|
||||
}
|
||||
|
||||
static void unblockSignals(void)
|
||||
static void unblockSignals(rpmdb rpmdb)
|
||||
{
|
||||
if (!(rpmdb && rpmdb->db_major == 3)) {
|
||||
sigprocmask(SIG_SETMASK, &signalMask, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#define _DB_ROOT "/"
|
||||
|
@ -427,7 +419,7 @@ void rpmdbClose (rpmdb rpmdb)
|
|||
for (dbix = rpmdb->db_ndbi; --dbix >= 0; ) {
|
||||
if (rpmdb->_dbi[dbix] == NULL)
|
||||
continue;
|
||||
dbiClose(rpmdb->_dbi[dbix]);
|
||||
dbiClose(rpmdb->_dbi[dbix], 0);
|
||||
rpmdb->_dbi[dbix] = NULL;
|
||||
}
|
||||
if (rpmdb->db_errpfx) {
|
||||
|
@ -526,7 +518,7 @@ static int openDatabase(const char * prefix, const char * dbpath, rpmdb *dbp,
|
|||
int rpmtag;
|
||||
|
||||
rpmtag = dbiTags[dbix];
|
||||
dbi = (justCheck ? NULL : dbiOpenIndex(rpmdb, rpmtag));
|
||||
dbi = dbiOpen(rpmdb, rpmtag);
|
||||
if (dbi == NULL)
|
||||
continue;
|
||||
|
||||
|
@ -551,6 +543,7 @@ static int openDatabase(const char * prefix, const char * dbpath, rpmdb *dbp,
|
|||
*/
|
||||
if (justCheck)
|
||||
break;
|
||||
xx = (*dbi->dbi_vec->copen) (dbi, NULL);
|
||||
xx = (*dbi->dbi_vec->cget) (dbi, &keyp, NULL, NULL, NULL);
|
||||
if (xx == 0) {
|
||||
const char * akey = keyp;
|
||||
|
@ -560,7 +553,7 @@ static int openDatabase(const char * prefix, const char * dbpath, rpmdb *dbp,
|
|||
rc |= 1;
|
||||
}
|
||||
}
|
||||
xx = (*dbi->dbi_vec->cclose) (dbi);
|
||||
xx = (*dbi->dbi_vec->cclose) (dbi, NULL);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
|
@ -569,10 +562,10 @@ static int openDatabase(const char * prefix, const char * dbpath, rpmdb *dbp,
|
|||
}
|
||||
|
||||
exit:
|
||||
if (!(rc || justCheck || dbp == NULL))
|
||||
*dbp = rpmdb;
|
||||
else
|
||||
if (rc || justCheck || dbp == NULL)
|
||||
rpmdbClose(rpmdb);
|
||||
else
|
||||
*dbp = rpmdb;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -614,7 +607,7 @@ Header rpmdbGetRecord(rpmdb rpmdb, unsigned int offset)
|
|||
int rc;
|
||||
|
||||
rpmtag = 0; /* RPMDBI_PACKAGES */
|
||||
dbi = dbiOpenIndex(rpmdb, rpmtag);
|
||||
dbi = dbiOpen(rpmdb, rpmtag);
|
||||
if (dbi == NULL)
|
||||
return NULL;
|
||||
rc = (*dbi->dbi_vec->get) (dbi, keyp, keylen, &uh, &uhlen);
|
||||
|
@ -654,7 +647,7 @@ static int rpmdbFindByFile(rpmdb rpmdb, const char * filespec,
|
|||
fpc = fpCacheCreate(20);
|
||||
fp1 = fpLookup(fpc, dirName, baseName, 1);
|
||||
|
||||
dbi = dbiOpenIndex(rpmdb, RPMTAG_BASENAMES);
|
||||
dbi = dbiOpen(rpmdb, RPMTAG_BASENAMES);
|
||||
rc = dbiSearchIndex(dbi, baseName, 0, &allMatches);
|
||||
if (rc) {
|
||||
dbiFreeIndexSet(allMatches);
|
||||
|
@ -797,7 +790,8 @@ void rpmdbFreeIterator(rpmdbMatchIterator mi)
|
|||
} else {
|
||||
int dbix = 0; /* RPMDBI_PACKAGES */
|
||||
dbiIndex dbi = mi->mi_rpmdb->_dbi[dbix];
|
||||
(void) (*dbi->dbi_vec->cclose) (dbi);
|
||||
if (dbi)
|
||||
(void) (*dbi->dbi_vec->cclose) (dbi, NULL);
|
||||
}
|
||||
if (mi->mi_key) {
|
||||
xfree(mi->mi_key);
|
||||
|
@ -848,8 +842,8 @@ Header rpmdbNextIterator(rpmdbMatchIterator mi)
|
|||
{
|
||||
dbiIndex dbi;
|
||||
int rpmtag;
|
||||
void * uh;
|
||||
size_t uhlen;
|
||||
void * uh = NULL;
|
||||
size_t uhlen = 0;
|
||||
void * keyp;
|
||||
size_t keylen;
|
||||
int rc;
|
||||
|
@ -858,16 +852,16 @@ Header rpmdbNextIterator(rpmdbMatchIterator mi)
|
|||
return NULL;
|
||||
|
||||
rpmtag = 0; /* RPMDBI_PACKAGES */
|
||||
dbi = dbiOpenIndex(mi->mi_rpmdb, rpmtag);
|
||||
dbi = dbiOpen(mi->mi_rpmdb, rpmtag);
|
||||
if (dbi == NULL)
|
||||
return NULL;
|
||||
keyp = &mi->mi_offset;
|
||||
keylen = sizeof(mi->mi_offset);
|
||||
|
||||
top:
|
||||
/* XXX skip over instances with 0 join key */
|
||||
do {
|
||||
if (mi->mi_set) {
|
||||
keyp = &mi->mi_offset;
|
||||
keylen = sizeof(mi->mi_offset);
|
||||
if (!(mi->mi_setx < mi->mi_set->count))
|
||||
return NULL;
|
||||
if (mi->mi_dbix != 0) { /* RPMDBI_PACKAGES */
|
||||
|
@ -875,8 +869,12 @@ top:
|
|||
mi->mi_filenum = dbiIndexRecordFileNumber(mi->mi_set, mi->mi_setx);
|
||||
}
|
||||
} else {
|
||||
rc = (*dbi->dbi_vec->cget) (dbi, &keyp, &keylen, NULL, NULL);
|
||||
if (keyp)
|
||||
keyp = NULL;
|
||||
keylen = 0;
|
||||
|
||||
rc = (*dbi->dbi_vec->cget) (dbi, &keyp, &keylen, &uh, &uhlen);
|
||||
|
||||
if (rc == 0 && keyp && mi->mi_setx)
|
||||
memcpy(&mi->mi_offset, keyp, sizeof(mi->mi_offset));
|
||||
|
||||
/* Terminate on error or end of keys */
|
||||
|
@ -890,9 +888,11 @@ top:
|
|||
return mi->mi_h;
|
||||
|
||||
/* Retrieve header */
|
||||
rc = (*dbi->dbi_vec->get) (dbi, keyp, keylen, &uh, &uhlen);
|
||||
if (uh == NULL) {
|
||||
rc = (*dbi->dbi_vec->cget) (dbi, &keyp, &keylen, &uh, &uhlen);
|
||||
if (rc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mi->mi_h) {
|
||||
headerFree(mi->mi_h);
|
||||
|
@ -1001,7 +1001,7 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb rpmdb, int rpmtag,
|
|||
dbix = dbiTagToDbix(rpmtag);
|
||||
if (dbix < 0)
|
||||
return NULL;
|
||||
dbi = dbiOpenIndex(rpmdb, rpmtag);
|
||||
dbi = dbiOpen(rpmdb, rpmtag);
|
||||
if (dbi == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -1040,13 +1040,12 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb rpmdb, int rpmtag,
|
|||
} else {
|
||||
mi->mi_key = NULL;
|
||||
mi->mi_keylen = 0;
|
||||
if (dbi)
|
||||
dbi->dbi_lastoffset = 0; /* db0: rewind to beginning */
|
||||
}
|
||||
mi->mi_rpmdb = rpmdb;
|
||||
mi->mi_dbi = dbi;
|
||||
|
||||
/* XXX falloc has dbi == NULL ) */
|
||||
assert(!(dbi && dbi->dbi_dbcursor));
|
||||
|
||||
mi->mi_dbix = dbix;
|
||||
mi->mi_set = set;
|
||||
mi->mi_setx = 0;
|
||||
|
@ -1118,7 +1117,7 @@ int rpmdbRemove(rpmdb rpmdb, unsigned int offset, int tolerant)
|
|||
rpmMessage(RPMMESS_VERBOSE, " --- %s-%s-%s\n", n, v, r);
|
||||
}
|
||||
|
||||
blockSignals();
|
||||
blockSignals(rpmdb);
|
||||
|
||||
{ int dbix;
|
||||
dbiIndexRecord rec = dbiReturnIndexRecordInstance(offset, 0);
|
||||
|
@ -1132,7 +1131,7 @@ int rpmdbRemove(rpmdb rpmdb, unsigned int offset, int tolerant)
|
|||
|
||||
/* XXX FIXME: this forces all indices open */
|
||||
rpmtag = dbiTags[dbix];
|
||||
dbi = dbiOpenIndex(rpmdb, rpmtag);
|
||||
dbi = dbiOpen(rpmdb, rpmtag);
|
||||
|
||||
if (dbi->dbi_rpmtag == 0) {
|
||||
(void) (*dbi->dbi_vec->del) (dbi, &offset, sizeof(offset));
|
||||
|
@ -1206,7 +1205,7 @@ int rpmdbRemove(rpmdb rpmdb, unsigned int offset, int tolerant)
|
|||
}
|
||||
}
|
||||
|
||||
unblockSignals();
|
||||
unblockSignals(rpmdb);
|
||||
|
||||
headerFree(h);
|
||||
|
||||
|
@ -1267,7 +1266,7 @@ int rpmdbAdd(rpmdb rpmdb, Header h)
|
|||
if (_noDirTokens)
|
||||
expandFilelist(h);
|
||||
|
||||
blockSignals();
|
||||
blockSignals(rpmdb);
|
||||
|
||||
{
|
||||
unsigned int firstkey = 0;
|
||||
|
@ -1278,29 +1277,33 @@ int rpmdbAdd(rpmdb rpmdb, Header h)
|
|||
int rc;
|
||||
|
||||
rpmtag = 0; /* RPMDBI_PACKAGES */
|
||||
dbi = dbiOpenIndex(rpmdb, rpmtag);
|
||||
dbi = dbiOpen(rpmdb, rpmtag);
|
||||
|
||||
/* XXX hack to pass sizeof header to fadAlloc */
|
||||
/* XXX db0: hack to pass sizeof header to fadAlloc */
|
||||
datap = h;
|
||||
datalen = headerSizeof(h, HEADER_MAGIC_NO);
|
||||
|
||||
(void) (*dbi->dbi_vec->copen) (dbi, NULL);
|
||||
|
||||
/* Retrieve join key for next header instance. */
|
||||
|
||||
rc = (*dbi->dbi_vec->get) (dbi, keyp, keylen, (void *)&datap, &datalen);
|
||||
rc = (*dbi->dbi_vec->cget) (dbi, &keyp, &keylen, &datap, &datalen);
|
||||
|
||||
offset = 0;
|
||||
if (rc == 0 && datap)
|
||||
memcpy(&offset, datap, sizeof(offset));
|
||||
|
||||
++offset;
|
||||
if (datap) {
|
||||
if (rc == 0 && datap) {
|
||||
memcpy(datap, &offset, sizeof(offset));
|
||||
} else {
|
||||
datap = &offset;
|
||||
datalen = sizeof(offset);
|
||||
}
|
||||
|
||||
rc = (*dbi->dbi_vec->put) (dbi, keyp, keylen, datap, datalen);
|
||||
rc = (*dbi->dbi_vec->cput) (dbi, keyp, keylen, datap, datalen);
|
||||
|
||||
(void) (*dbi->dbi_vec->cclose) (dbi, NULL);
|
||||
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
|
@ -1320,11 +1323,12 @@ int rpmdbAdd(rpmdb rpmdb, Header h)
|
|||
|
||||
/* XXX FIXME: this forces all indices open */
|
||||
rpmtag = dbiTags[dbix];
|
||||
dbi = dbiOpenIndex(rpmdb, rpmtag);
|
||||
dbi = dbiOpen(rpmdb, rpmtag);
|
||||
|
||||
if (dbi->dbi_rpmtag == 0) {
|
||||
size_t uhlen = headerSizeof(h, HEADER_MAGIC_NO);
|
||||
void * uh = headerUnload(h);
|
||||
|
||||
(void) (*dbi->dbi_vec->put) (dbi, &offset, sizeof(offset), uh, uhlen);
|
||||
free(uh);
|
||||
|
||||
|
@ -1421,7 +1425,7 @@ int rpmdbAdd(rpmdb rpmdb, Header h)
|
|||
}
|
||||
|
||||
exit:
|
||||
unblockSignals();
|
||||
unblockSignals(rpmdb);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -1666,7 +1670,7 @@ int findMatches(rpmdb rpmdb, const char * name, const char * version,
|
|||
int rc;
|
||||
int i;
|
||||
|
||||
dbi = dbiOpenIndex(rpmdb, RPMTAG_NAME);
|
||||
dbi = dbiOpen(rpmdb, RPMTAG_NAME);
|
||||
rc = dbiSearchIndex(dbi, name, 0, matches);
|
||||
|
||||
if (rc != 0) {
|
||||
|
|
127
lib/rpmdb.h
127
lib/rpmdb.h
|
@ -42,6 +42,14 @@ struct _dbiIndexSet {
|
|||
int count; /*!< number of records */
|
||||
};
|
||||
|
||||
/* XXX hack to get prototypes correct */
|
||||
#if !defined(DB_VERSION_MAJOR)
|
||||
#define DB_ENV void
|
||||
#define DBC void
|
||||
#define DBT void
|
||||
#define DB_LSN void
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Private methods for accessing an index database.
|
||||
*/
|
||||
|
@ -120,18 +128,22 @@ struct _dbiVec {
|
|||
|
||||
/**
|
||||
*/
|
||||
int (*copen) (dbiIndex dbi);
|
||||
int (*copen) (dbiIndex dbi, DBC ** dbcp);
|
||||
|
||||
/**
|
||||
*/
|
||||
int (*cclose) (dbiIndex dbi);
|
||||
int (*cclose) (dbiIndex dbi, DBC * dbcursor);
|
||||
|
||||
/**
|
||||
* Delete item using db->del or dbcursor->c_del.
|
||||
* @param dbi index database handle
|
||||
* @param keyp key data
|
||||
* @param keylen key data length
|
||||
*/
|
||||
int (*join) (dbiIndex dbi);
|
||||
int (*cdel) (dbiIndex dbi, void * keyp, size_t keylen);
|
||||
|
||||
/**
|
||||
* Retrieve item using dbcursor->c_get.
|
||||
* Retrieve item using db->get or dbcursor->c_get.
|
||||
* @param dbi index database handle
|
||||
* @param keyp address of key data
|
||||
* @param keylen address of key data length
|
||||
|
@ -141,20 +153,38 @@ struct _dbiVec {
|
|||
int (*cget) (dbiIndex dbi, void ** keyp, size_t * keylen,
|
||||
void ** datap, size_t * datalen);
|
||||
|
||||
};
|
||||
/**
|
||||
* Save item using db->put or dbcursor->c_put.
|
||||
* @param dbi index database handle
|
||||
* @param keyp key data
|
||||
* @param keylen key data length
|
||||
* @param datap data pointer
|
||||
* @param datalen data length
|
||||
*/
|
||||
int (*cput) (dbiIndex dbi, void * keyp, size_t keylen,
|
||||
void * datap, size_t datalen);
|
||||
|
||||
/* XXX hack to get prototypes correct */
|
||||
#if !defined(DB_VERSION_MAJOR)
|
||||
#define DB_ENV void
|
||||
#define DBT void
|
||||
#define DB_LSN void
|
||||
#endif
|
||||
/**
|
||||
*/
|
||||
int (*byteswapped) (dbiIndex dbi);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes an index database (implemented on Berkeley db[123] API).
|
||||
*/
|
||||
struct _dbiIndex {
|
||||
int dbi_flags; /*<! */
|
||||
const char * dbi_root;
|
||||
const char * dbi_home;
|
||||
const char * dbi_file;
|
||||
const char * dbi_subfile;
|
||||
|
||||
int dbi_cflags; /*<! db_create/db_env_create flags */
|
||||
int dbi_oeflags; /*<! common (db,dbenv}->open flags */
|
||||
int dbi_eflags; /*<! dbenv->open flags */
|
||||
int dbi_oflags; /*<! db->open flags */
|
||||
int dbi_tflags; /*<! dbenv->txn_begin flags */
|
||||
|
||||
int dbi_type; /*<! db index type */
|
||||
int dbi_mode; /*<! mode to use on open */
|
||||
int dbi_perms; /*<! file permission to use on open */
|
||||
|
@ -164,6 +194,7 @@ struct _dbiIndex {
|
|||
int dbi_use_cursors;
|
||||
int dbi_get_rmw_cursor;
|
||||
int dbi_no_fsync;
|
||||
int dbi_temporary;
|
||||
|
||||
/* dbenv parameters */
|
||||
int dbi_lorder;
|
||||
|
@ -221,8 +252,7 @@ struct _dbiIndex {
|
|||
void * dbi_db; /*<! Berkeley db[123] handle */
|
||||
void * dbi_dbenv;
|
||||
void * dbi_dbinfo;
|
||||
void * dbi_dbjoin;
|
||||
void * dbi_dbcursor;
|
||||
void * dbi_rmw; /*<! db cursor (with DB_WRITECURSOR) */
|
||||
void * dbi_pkgs;
|
||||
|
||||
/*@observer@*/ const struct _dbiVec * dbi_vec; /*<! private methods */
|
||||
|
@ -235,7 +265,8 @@ struct _dbiIndex {
|
|||
struct rpmdb_s {
|
||||
const char * db_root; /*<! path prefix */
|
||||
const char * db_home; /*<! directory path */
|
||||
int db_flags; /*<! */
|
||||
int db_flags;
|
||||
|
||||
int db_mode; /*<! open mode */
|
||||
int db_perms; /*<! open permissions */
|
||||
|
||||
|
@ -264,46 +295,84 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Return base file name for legacy index databases.
|
||||
* Return new configured index database handle instance.
|
||||
* @param rpmdb rpm database
|
||||
*/
|
||||
/*@only@*/ /*@null@*/ dbiIndex db3New(rpmdb rpmdb, int rpmtag);
|
||||
|
||||
/**
|
||||
* Destroy index database handle instance.
|
||||
* @param dbi index database handle
|
||||
*/
|
||||
void db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi);
|
||||
|
||||
/**
|
||||
* Return handle for an index database.
|
||||
* @param rpmdb rpm database
|
||||
* @param rpmtag rpm tag
|
||||
* @return index database handle
|
||||
*/
|
||||
dbiIndex dbiOpen(rpmdb rpmdb, int rpmtag);
|
||||
|
||||
/**
|
||||
* Store (key,data) pair in index database.
|
||||
* @param dbi index database handle
|
||||
* @param rpmdb rpm database
|
||||
* @return 0 on success
|
||||
*/
|
||||
int dbiPut(dbiIndex dbi, const void * key, size_t keylen, const void * data, size_t datalen);
|
||||
|
||||
/**
|
||||
* Close index database.
|
||||
* @param dbi index database handle
|
||||
* @param flag (unused)
|
||||
* @return 0 on success
|
||||
*/
|
||||
int dbiClose(dbiIndex dbi, int flag);
|
||||
|
||||
/**
|
||||
* Return base file name for index database (legacy).
|
||||
* @param rpmtag rpm tag
|
||||
* @return base file name
|
||||
*/
|
||||
char * db0basename(int rpmtag);
|
||||
|
||||
/*@only@*/ /*@null@*/ dbiIndex db3New(rpmdb rpmdb, int rpmtag);
|
||||
|
||||
void db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi);
|
||||
|
||||
/**
|
||||
* @param db rpm database
|
||||
* Remove package header from rpm database and indices.
|
||||
* @param rpmdb rpm database
|
||||
* @param offset location in Packages dbi
|
||||
* @param tolerant (legacy) print error messages?
|
||||
* @return 0 on success
|
||||
*/
|
||||
int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant);
|
||||
|
||||
/**
|
||||
* @param db rpm database
|
||||
* Add package header to rpm database and indices.
|
||||
* @param rpmdb rpm database
|
||||
* @param rpmtag rpm tag
|
||||
*/
|
||||
int rpmdbAdd(rpmdb db, Header dbentry);
|
||||
int rpmdbAdd(rpmdb rpmdb, Header dbentry);
|
||||
|
||||
/**
|
||||
* @param db rpm database
|
||||
* @param rpmdb rpm database
|
||||
*/
|
||||
int rpmdbUpdateRecord(rpmdb db, int secOffset, Header secHeader);
|
||||
int rpmdbUpdateRecord(rpmdb rpmdb, int secOffset, Header secHeader);
|
||||
|
||||
/**
|
||||
*/
|
||||
unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi);
|
||||
|
||||
/**
|
||||
* @param db rpm database
|
||||
* @param rpmdb rpm database
|
||||
*/
|
||||
int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, /*@out@*/dbiIndexSet * matchList,
|
||||
int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, /*@out@*/dbiIndexSet * matchList,
|
||||
int numItems);
|
||||
|
||||
/* XXX only for the benefit of runTransactions() */
|
||||
/**
|
||||
* @param db rpm database
|
||||
* @param rpmdb rpm database
|
||||
*/
|
||||
int findMatches(rpmdb db, const char * name, const char * version,
|
||||
int findMatches(rpmdb rpmdb, const char * name, const char * version,
|
||||
const char * release, /*@out@*/ dbiIndexSet * matches);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
void *vmefail(void)
|
||||
void *vmefail(size_t size)
|
||||
{
|
||||
fprintf(stderr, _("memory alloc returned NULL.\n"));
|
||||
fprintf(stderr, _("memory alloc (%u bytes) returned NULL.\n"), size);
|
||||
exit(EXIT_FAILURE);
|
||||
/*@notreached@*/
|
||||
return NULL;
|
||||
|
@ -20,7 +20,7 @@ void * xmalloc (size_t size)
|
|||
if (size == 0) size++;
|
||||
value = malloc (size);
|
||||
if (value == 0)
|
||||
value = vmefail();
|
||||
value = vmefail(size);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ void * xcalloc (size_t nmemb, size_t size)
|
|||
if (nmemb == 0) nmemb++;
|
||||
value = calloc (nmemb, size);
|
||||
if (value == 0)
|
||||
value = vmefail();
|
||||
value = vmefail(size);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -41,15 +41,16 @@ void * xrealloc (void *ptr, size_t size)
|
|||
if (size == 0) size++;
|
||||
value = realloc (ptr, size);
|
||||
if (value == 0)
|
||||
value = vmefail();
|
||||
value = vmefail(size);
|
||||
return value;
|
||||
}
|
||||
|
||||
char * xstrdup (const char *str)
|
||||
{
|
||||
char *newstr = (char *) malloc (strlen(str) + 1);
|
||||
size_t size = strlen(str) + 1;
|
||||
char *newstr = (char *) malloc (size);
|
||||
if (newstr == 0)
|
||||
newstr = (char *) vmefail();
|
||||
newstr = (char *) vmefail(size);
|
||||
strcpy (newstr, str);
|
||||
return newstr;
|
||||
}
|
||||
|
|
15
macros.in
15
macros.in
|
@ -1,4 +1,4 @@
|
|||
# $Id: macros.in,v 1.53 2000/04/23 20:37:57 jbj Exp $
|
||||
# $Id: macros.in,v 1.54 2000/04/25 19:41:37 jbj Exp $
|
||||
#==============================================================================
|
||||
# Macro naming conventions (preliminary):
|
||||
#
|
||||
|
@ -212,10 +212,9 @@
|
|||
# 3 native db3 interface.
|
||||
# -1 db3 -> db2 -> db1 -> db0 (as available).
|
||||
# There are two macros so that --rebuilddb can convert old_db_api -> new_db_api.
|
||||
%_dbapi 3
|
||||
%_dbapi 0
|
||||
%_dbapi_rebuild 3
|
||||
|
||||
# This is a colon separated list of tokens for Berkeley db configuration.
|
||||
#
|
||||
# token Berkeley db flag or value
|
||||
# =================================================
|
||||
|
@ -235,21 +234,26 @@
|
|||
# txn_nosync DB_TXN_NOSYNC
|
||||
# hash DB_HASH
|
||||
#
|
||||
# See http://www.sleepycat.com for Berkeley db-3.0.55 configuration.
|
||||
#
|
||||
# The (intended) default value for Red Hat Linux is
|
||||
# hash:mpool:shared:lock
|
||||
#
|
||||
# Additional rpm specific configuration:
|
||||
# teardown Should the DB3 environment be removed after use (experimental)?
|
||||
# usecursors Should DB3 cursors be used in get/put/del (experimental)?
|
||||
#
|
||||
%__dbi_flags create:mpool
|
||||
%__dbi_flags mpool
|
||||
%__dbi_type hash
|
||||
%__dbi_perms perms=0644
|
||||
%__dbi_major db%{_dbapi}
|
||||
%__dbi_other teardown:usecursors
|
||||
%__dbi_other usecursors
|
||||
%__dbi_verbose verbose
|
||||
%__dbi_mp_mmapsize mp_mmapsize=16Mb
|
||||
%__dbi_mp_size mp_size=2Mb
|
||||
|
||||
# This is a colon (or white space) separated list of tokens for Berkeley
|
||||
# dbi configuration.
|
||||
%_dbi_config \
|
||||
%{__dbi_flags}\
|
||||
%{__dbi_type}\
|
||||
|
@ -261,6 +265,7 @@
|
|||
%{__dbi_mp_size}\
|
||||
%{nil}
|
||||
|
||||
# This is the list of tags for which indices will be built.
|
||||
%_dbi_indices Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername
|
||||
|
||||
#==============================================================================
|
||||
|
|
178
po/rpm.pot
178
po/rpm.pot
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2000-04-23 16:19-0400\n"
|
||||
"POT-Creation-Date: 2000-04-25 15:13-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -1987,156 +1987,166 @@ msgid " failed - "
|
|||
msgstr ""
|
||||
|
||||
#. XXX legacy epoch-less requires/conflicts compatibility
|
||||
#: lib/depends.c:434
|
||||
#: lib/depends.c:439
|
||||
#, c-format
|
||||
msgid ""
|
||||
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
|
||||
"\tA %s\tB %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:463
|
||||
#: lib/depends.c:468
|
||||
#, c-format
|
||||
msgid " %s A %s\tB %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:792
|
||||
#: lib/depends.c:797
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by added file list.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:841
|
||||
#: lib/depends.c:846
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by added package.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:844
|
||||
#: lib/depends.c:849
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by added package (shouldn't happen).\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:862
|
||||
#: lib/depends.c:867
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by added provide.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:895
|
||||
#: lib/depends.c:896
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by Depends cache.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:909
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by rpmrc provides.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:923
|
||||
#: lib/depends.c:937
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by db file lists.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:941
|
||||
#: lib/depends.c:955
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by db provides.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:959
|
||||
#: lib/depends.c:973
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by db packages.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:972
|
||||
#: lib/depends.c:986
|
||||
#, c-format
|
||||
msgid "%s: %s satisfied by rpmlib version.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:982
|
||||
#: lib/depends.c:996
|
||||
#, c-format
|
||||
msgid "%s: %s unsatisfied.\n"
|
||||
msgstr ""
|
||||
|
||||
#. requirements are not satisfied.
|
||||
#: lib/depends.c:1030
|
||||
#: lib/depends.c:1048
|
||||
#, c-format
|
||||
msgid "package %s require not satisfied: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#. conflicts exist.
|
||||
#: lib/depends.c:1092
|
||||
#: lib/depends.c:1110
|
||||
#, c-format
|
||||
msgid "package %s conflicts: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1222
|
||||
#: lib/depends.c:1240
|
||||
#, c-format
|
||||
msgid "loop in prerequisite chain: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1426
|
||||
#: lib/depends.c:1444
|
||||
#, c-format
|
||||
msgid "cannot read header at %d for dependency check"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db0.c:608
|
||||
#: lib/db0.c:565
|
||||
#, c-format
|
||||
msgid "bad db file %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db0.c:617
|
||||
#: lib/db0.c:574
|
||||
#, c-format
|
||||
msgid "opening database mode 0x%x in %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db0.c:622 lib/url.c:445
|
||||
#: lib/db0.c:579 lib/url.c:445
|
||||
#, c-format
|
||||
msgid "failed to open %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db0.c:634
|
||||
#: lib/db0.c:591
|
||||
#, c-format
|
||||
msgid "cannot get %s lock on database"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db0.c:635
|
||||
#: lib/db0.c:592
|
||||
msgid "exclusive"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db0.c:635
|
||||
#: lib/db0.c:592
|
||||
msgid "shared"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:243
|
||||
#: lib/db3.c:249
|
||||
#, c-format
|
||||
msgid "dbiSetConfig: unrecognized db option: \"%s\" ignored\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:269
|
||||
#: lib/db3.c:277
|
||||
#, c-format
|
||||
msgid "%s has invalid numeric value, skipped\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:277
|
||||
#: lib/db3.c:285
|
||||
#, c-format
|
||||
msgid "%s has too large or too small long value, skipped\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:285
|
||||
#: lib/db3.c:293
|
||||
#, c-format
|
||||
msgid "%s has too large or too small integer value, skipped\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:440
|
||||
#: lib/db3.c:456
|
||||
#, c-format
|
||||
msgid "closed db environment %s/%s(%s)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:451
|
||||
#: lib/db3.c:468
|
||||
#, c-format
|
||||
msgid "removed db environment %s/%s(%s)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:1050
|
||||
#: lib/db3.c:505
|
||||
#, c-format
|
||||
msgid "opening db environment %s/%s(%s) %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:1117
|
||||
#, c-format
|
||||
msgid "closed db index %s/%s(%s)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/db3.c:1225
|
||||
#: lib/db3.c:1195
|
||||
#, c-format
|
||||
msgid "opened %s/%s(%s) %s\n"
|
||||
msgid "opening db index %s/%s(%s) %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/falloc.c:135
|
||||
|
@ -2150,7 +2160,7 @@ msgid ""
|
|||
msgstr ""
|
||||
|
||||
#: lib/formats.c:69 lib/formats.c:86 lib/formats.c:106 lib/formats.c:138
|
||||
#: lib/header.c:2188 lib/header.c:2204 lib/header.c:2223
|
||||
#: lib/header.c:2190 lib/header.c:2206 lib/header.c:2225
|
||||
msgid "(not a number)"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2183,74 +2193,74 @@ msgstr ""
|
|||
msgid "grabData() RPM_STRING_TYPE count must be 1.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:250 lib/header.c:813
|
||||
#: lib/header.c:250 lib/header.c:815
|
||||
#, c-format
|
||||
msgid "Data type %d not supported\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1172
|
||||
#: lib/header.c:1174
|
||||
#, c-format
|
||||
msgid "Bad count for headerAddEntry(): %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1581
|
||||
#: lib/header.c:1583
|
||||
#, c-format
|
||||
msgid "missing { after %"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1609
|
||||
#: lib/header.c:1611
|
||||
msgid "missing } after %{"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1621
|
||||
#: lib/header.c:1623
|
||||
msgid "empty tag format"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1631
|
||||
#: lib/header.c:1633
|
||||
msgid "empty tag name"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1646
|
||||
#: lib/header.c:1648
|
||||
msgid "unknown tag"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1672
|
||||
#: lib/header.c:1674
|
||||
msgid "] expected at end of array"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1688
|
||||
#: lib/header.c:1690
|
||||
msgid "unexpected ]"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1690
|
||||
#: lib/header.c:1692
|
||||
msgid "unexpected }"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1744
|
||||
#: lib/header.c:1746
|
||||
msgid "? expected in expression"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1751
|
||||
#: lib/header.c:1753
|
||||
msgid "{ expected after ? in expression"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1761 lib/header.c:1796
|
||||
#: lib/header.c:1763 lib/header.c:1798
|
||||
msgid "} expected in expression"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1769
|
||||
#: lib/header.c:1771
|
||||
msgid ": expected following ? subexpression"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1783
|
||||
#: lib/header.c:1785
|
||||
msgid "{ expected after : in expression"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1804
|
||||
#: lib/header.c:1806
|
||||
msgid "| expected at end of expression"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:1972
|
||||
#: lib/header.c:1974
|
||||
msgid "(unknown type)"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2827,22 +2837,22 @@ msgstr ""
|
|||
msgid "dbiTagsInit: unrecognized tag name: \"%s\" ignored\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:136
|
||||
#: lib/rpmdb.c:135
|
||||
#, c-format
|
||||
msgid "error getting record %s from %s index"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:157
|
||||
#: lib/rpmdb.c:156
|
||||
#, c-format
|
||||
msgid "error storing record %s into %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:162
|
||||
#: lib/rpmdb.c:161
|
||||
#, c-format
|
||||
msgid "error removing record %s from %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:343
|
||||
#: lib/rpmdb.c:345
|
||||
msgid ""
|
||||
"\n"
|
||||
"--> Please run \"rpm --rebuilddb\" as root to convert your database from\n"
|
||||
|
@ -2850,145 +2860,145 @@ msgid ""
|
|||
"\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:358
|
||||
#: lib/rpmdb.c:360
|
||||
#, c-format
|
||||
msgid "dbiOpenIndex: cannot open %s index"
|
||||
msgid "dbiOpen: cannot open %s index"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:481 lib/rpmdb.c:1791
|
||||
#: lib/rpmdb.c:473 lib/rpmdb.c:1795
|
||||
msgid "no dbpath has been set"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:558
|
||||
#: lib/rpmdb.c:551
|
||||
msgid ""
|
||||
"old format database is present; use --rebuilddb to generate a new format "
|
||||
"database"
|
||||
msgstr ""
|
||||
|
||||
#. error
|
||||
#: lib/rpmdb.c:743
|
||||
#: lib/rpmdb.c:736
|
||||
#, c-format
|
||||
msgid "cannot retrieve package \"%s\" from db"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1077
|
||||
#: lib/rpmdb.c:1076
|
||||
#, c-format
|
||||
msgid "key \"%s\" not found in %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1085
|
||||
#: lib/rpmdb.c:1084
|
||||
#, c-format
|
||||
msgid "key \"%s\" not removed from %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1111
|
||||
#: lib/rpmdb.c:1110
|
||||
#, c-format
|
||||
msgid "rpmdbRemove: cannot read header at 0x%x"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1145
|
||||
#: lib/rpmdb.c:1144
|
||||
#, c-format
|
||||
msgid "removing 0 %s entries.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1152
|
||||
#: lib/rpmdb.c:1151
|
||||
#, c-format
|
||||
msgid "removing \"%s\" from %s index.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1160
|
||||
#: lib/rpmdb.c:1159
|
||||
#, c-format
|
||||
msgid "removing %d entries in %s index:\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1164
|
||||
#: lib/rpmdb.c:1163
|
||||
#, c-format
|
||||
msgid "\t%6d %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1307
|
||||
#: lib/rpmdb.c:1310
|
||||
msgid "cannot allocate new instance in database"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1355
|
||||
#: lib/rpmdb.c:1359
|
||||
#, c-format
|
||||
msgid "adding 0 %s entries.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1368
|
||||
#: lib/rpmdb.c:1372
|
||||
#, c-format
|
||||
msgid "adding \"%s\" to %s index.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1375
|
||||
#: lib/rpmdb.c:1379
|
||||
#, c-format
|
||||
msgid "adding %d entries to %s index:\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1379
|
||||
#: lib/rpmdb.c:1383
|
||||
#, c-format
|
||||
msgid "%6d %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1697
|
||||
#: lib/rpmdb.c:1701
|
||||
#, c-format
|
||||
msgid "cannot read header at %d for lookup"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1816
|
||||
#: lib/rpmdb.c:1820
|
||||
#, c-format
|
||||
msgid "rebuilding database %s into %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1820
|
||||
#: lib/rpmdb.c:1824
|
||||
#, c-format
|
||||
msgid "temporary database %s already exists"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1826
|
||||
#: lib/rpmdb.c:1830
|
||||
#, c-format
|
||||
msgid "creating directory: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1828
|
||||
#: lib/rpmdb.c:1832
|
||||
#, c-format
|
||||
msgid "error creating directory %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1835
|
||||
#: lib/rpmdb.c:1839
|
||||
#, c-format
|
||||
msgid "opening old database with dbi_major %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1844
|
||||
#: lib/rpmdb.c:1848
|
||||
#, c-format
|
||||
msgid "opening new database with dbi_major %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1866
|
||||
#: lib/rpmdb.c:1870
|
||||
#, c-format
|
||||
msgid "record number %d in database is bad -- skipping."
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1898
|
||||
#: lib/rpmdb.c:1902
|
||||
#, c-format
|
||||
msgid "cannot add record originally at %d"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1916
|
||||
#: lib/rpmdb.c:1920
|
||||
msgid "failed to rebuild database; original database remains in place\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1924
|
||||
#: lib/rpmdb.c:1928
|
||||
msgid "failed to replace old database with new database!\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1926
|
||||
#: lib/rpmdb.c:1930
|
||||
#, c-format
|
||||
msgid "replace files in %s with files from %s to recover"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmdb.c:1932
|
||||
#: lib/rpmdb.c:1936
|
||||
#, c-format
|
||||
msgid "failed to remove directory %s: %s\n"
|
||||
msgstr ""
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
void *vmefail(void)
|
||||
void *vmefail(size_t size)
|
||||
{
|
||||
fprintf(stderr, _("memory alloc returned NULL.\n"));
|
||||
fprintf(stderr, _("memory alloc (%u bytes) returned NULL.\n"), size);
|
||||
exit(EXIT_FAILURE);
|
||||
/*@notreached@*/
|
||||
return NULL;
|
||||
|
@ -20,7 +20,7 @@ void * xmalloc (size_t size)
|
|||
if (size == 0) size++;
|
||||
value = malloc (size);
|
||||
if (value == 0)
|
||||
value = vmefail();
|
||||
value = vmefail(size);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ void * xcalloc (size_t nmemb, size_t size)
|
|||
if (nmemb == 0) nmemb++;
|
||||
value = calloc (nmemb, size);
|
||||
if (value == 0)
|
||||
value = vmefail();
|
||||
value = vmefail(size);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -41,15 +41,16 @@ void * xrealloc (void *ptr, size_t size)
|
|||
if (size == 0) size++;
|
||||
value = realloc (ptr, size);
|
||||
if (value == 0)
|
||||
value = vmefail();
|
||||
value = vmefail(size);
|
||||
return value;
|
||||
}
|
||||
|
||||
char * xstrdup (const char *str)
|
||||
{
|
||||
char *newstr = (char *) malloc (strlen(str) + 1);
|
||||
size_t size = strlen(str) + 1;
|
||||
char *newstr = (char *) malloc (size);
|
||||
if (newstr == 0)
|
||||
newstr = (char *) vmefail();
|
||||
newstr = (char *) vmefail(size);
|
||||
strcpy (newstr, str);
|
||||
return newstr;
|
||||
}
|
||||
|
|
10
system.h
10
system.h
|
@ -204,7 +204,7 @@ char *alloca ();
|
|||
/*@only@*/ void * xcalloc (size_t nmemb, size_t size);
|
||||
/*@only@*/ void * xrealloc (void *ptr, size_t size);
|
||||
/*@only@*/ char * xstrdup (const char *str);
|
||||
void *vmefail(void);
|
||||
void *vmefail(size_t size);
|
||||
|
||||
#if HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
|
@ -213,10 +213,10 @@ void *vmefail(void);
|
|||
|
||||
/* Memory allocation via macro defs to get meaningful locations from mtrace() */
|
||||
#if HAVE_MCHECK_H && defined(__GNUC__)
|
||||
#define xmalloc(_size) (malloc(_size) ? : vmefail())
|
||||
#define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail())
|
||||
#define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail())
|
||||
#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
|
||||
#define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
|
||||
#define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
|
||||
#define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
|
||||
#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
|
||||
#endif /* HAVE_MCHECK_H && defined(__GNUC__) */
|
||||
|
||||
/* Retrofit glibc __progname */
|
||||
|
|
Loading…
Reference in New Issue