if (!headerIsEntry(h, *p)) {
rpmError(RPMERR_BADSPEC,
_("%s field must be present in package: %s\n"),
- tagName(*p), NVR);
+ rpmTagGetName(*p), NVR);
res = 1;
}
}
if (tag != lastTag)
continue;
rpmError(RPMERR_BADSPEC, _("Duplicate %s entries in package: %s\n"),
- tagName(tag), NVR);
+ rpmTagGetName(tag), NVR);
res = 1;
}
hi = headerFreeIterator(hi);
char *n;
if (hge(h, RPMTAG_NAME, NULL, (void **) &n, NULL)) {
char buf[1024];
- sprintf(buf, "%s(%s)", n, tagName(tag));
+ sprintf(buf, "%s(%s)", n, rpmTagGetName(tag));
t->t_msgid = xstrdup(buf);
}
}
if ((rc = parseBits(lang, buildScriptBits, &tagflags))) {
rpmError(RPMERR_BADSPEC,
_("line %d: Bad %s: qualifiers: %s\n"),
- spec->lineNum, tagName(tag), spec->line);
+ spec->lineNum, rpmTagGetName(tag), spec->line);
return rc;
}
if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
if ((rc = parseBits(lang, installScriptBits, &tagflags))) {
rpmError(RPMERR_BADSPEC,
_("line %d: Bad %s: qualifiers: %s\n"),
- spec->lineNum, tagName(tag), spec->line);
+ spec->lineNum, rpmTagGetName(tag), spec->line);
return rc;
}
if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
for (i = 0; i < st->st_ntags; i++) {
spectag t = st->st_t + i;
- const char * tn = tagName(t->t_tag);
+ const char * tn = rpmTagGetName(t->t_tag);
const char * errstr;
char fmt[1024];
const char * msgkey;
const char * msgid;
- { const char * tn = tagName(tag);
+ { const char * tn = rpmTagGetName(tag);
const char * n;
char * mk;
size_t nb = sizeof("()");
/* Parse for "tag=pattern" args. */
if ((ae = strchr(a, '=')) != NULL) {
*ae++ = '\0';
- tag = tagValue(a);
+ tag = rpmTagGetValue(a);
if (tag < 0) {
rpmError(RPMERR_QUERYINFO, _("unknown tag: \"%s\"\n"), a);
res = 1;
if (!res) {
if (_rpmgi_debug < 0)
-fprintf(stderr, "\tav %p[%ld]: \"%s\" -> %s ~= \"%s\"\n", gi->argv, (av - gi->argv), *av, tagName(tag), pat);
+fprintf(stderr, "\tav %p[%ld]: \"%s\" -> %s ~= \"%s\"\n", gi->argv, (av - gi->argv), *av, rpmTagGetName(tag), pat);
res = rpmdbSetIteratorRE(gi->mi, tag, RPMMIRE_DEFAULT, pat);
}
a = _free(a);
RPMTAG_HEADERI18NTABLE = HEADER_I18NTABLE, /*!< I18N string locales. */
-/* Retrofit (and uniqify) signature tags for use by tagName() and rpmQuery. */
+/* Retrofit (and uniqify) signature tags for use by rpmTagGetName() and rpmQuery. */
/* the md5 sum was broken *twice* on big endian machines */
/* XXX 2nd underscore prevents tagTable generation */
RPMTAG_SIG_BASE = HEADER_SIGBASE,
* @return tag name, "(unknown)" on not found
*/
static inline
-const char * tagName(int tag)
+const char * rpmTagGetName(int tag)
{
return ((*rpmTags->tagName)(tag));
}
* @return tag data type, RPM_NULL_TYPE on not found.
*/
static inline
-int tagType(int tag)
+int rpmTagGetType(int tag)
{
return ((*rpmTags->tagType)(tag));
}
* @return tag value, -1 on not found
*/
static inline
-int tagValue(const char * tagstr)
+int rpmTagGetValue(const char * tagstr)
{
return ((*rpmTags->tagValue)(tagstr));
}
ftsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
if (gitagstr != NULL) {
- gitag = tagValue(gitagstr);
+ gitag = rpmTagGetValue(gitagstr);
if (gitag < 0) {
fprintf(stderr, _("unknown --tag argument: %s\n"), gitagstr);
exit(EXIT_FAILURE);
return PyInt_AsLong(item);
} else if (PyString_Check(item)) {
str = PyString_AsString(item);
- return tagValue(str);
+ return rpmTagGetValue(str);
}
return -1;
}
const char * errstr;
fmt[0] = '\0';
- (void) stpcpy( stpcpy( stpcpy( fmt, "%{"), tagName(tag)), "}\n");
+ (void) stpcpy( stpcpy( stpcpy( fmt, "%{"), rpmTagGetName(tag)), "}\n");
/* XXX FIXME: memory leak. */
msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
}
}
- tagtype = tagType(tag);
+ tagtype = rpmTagGetType(tag);
#if NOTYET
/* this blows up with header extension types */
type = tagtype & RPM_MASK_TYPE;
} else {
#ifdef HACK /* XXX necessary to support dbsubfile */
dbfile = (dbi->dbi_file ? dbi->dbi_file : db3basename);
- dbsubfile = (dbi->dbi_subfile ? dbi->dbi_subfile : tagName(dbi->dbi_rpmtag));
+ dbsubfile = (dbi->dbi_subfile ? dbi->dbi_subfile : rpmTagGetName(dbi->dbi_rpmtag));
#else
- dbfile = (dbi->dbi_file ? dbi->dbi_file : tagName(dbi->dbi_rpmtag));
+ dbfile = (dbi->dbi_file ? dbi->dbi_file : rpmTagGetName(dbi->dbi_rpmtag));
dbsubfile = NULL;
#endif
}
db = dbi->dbi_db = NULL;
rpmMessage(RPMMESS_DEBUG, _("closed db index %s/%s\n"),
- dbhome, (dbfile ? dbfile : tagName(dbi->dbi_rpmtag)));
+ dbhome, (dbfile ? dbfile : rpmTagGetName(dbi->dbi_rpmtag)));
}
rpmMessage(RPMMESS_DEBUG, _("verified db index %s/%s\n"),
(dbhome ? dbhome : ""),
- (dbfile ? dbfile : tagName(dbi->dbi_rpmtag)));
+ (dbfile ? dbfile : rpmTagGetName(dbi->dbi_rpmtag)));
/*
* The DB handle may not be accessed again after
} else {
#ifdef HACK /* XXX necessary to support dbsubfile */
dbfile = (dbi->dbi_file ? dbi->dbi_file : db3basename);
- dbsubfile = (dbi->dbi_subfile ? dbi->dbi_subfile : tagName(dbi->dbi_rpmtag));
+ dbsubfile = (dbi->dbi_subfile ? dbi->dbi_subfile : rpmTagGetName(dbi->dbi_rpmtag));
#else
- dbfile = (dbi->dbi_file ? dbi->dbi_file : tagName(dbi->dbi_rpmtag));
+ dbfile = (dbi->dbi_file ? dbi->dbi_file : rpmTagGetName(dbi->dbi_rpmtag));
dbsubfile = NULL;
#endif
}
*/
if ((oflags & DB_CREATE) && (oflags & DB_RDONLY)) {
/* dbhome is writable, and DB->open flags may conflict. */
- const char * dbfn = (dbfile ? dbfile : tagName(dbi->dbi_rpmtag));
+ const char * dbfn = (dbfile ? dbfile : rpmTagGetName(dbi->dbi_rpmtag));
const char * dbf = rpmGetPath(dbhome, "/", dbfn, NULL);
if (access(dbf, F_OK) == -1) {
}
rpmMessage(RPMMESS_DEBUG, _("opening db index %s/%s %s mode=0x%x\n"),
- dbhome, (dbfile ? dbfile : tagName(dbi->dbi_rpmtag)),
+ dbhome, (dbfile ? dbfile : rpmTagGetName(dbi->dbi_rpmtag)),
prDbiOpenFlags(oflags, 0), dbi->dbi_mode);
if (rc == 0) {
char dbiTagMacro[128];
char * dbOpts;
- sprintf(dbiTagMacro, "%%{_dbi_config_%s}", tagName(rpmtag));
+ sprintf(dbiTagMacro, "%%{_dbi_config_%s}", rpmTagGetName(rpmtag));
dbOpts = rpmExpand(dbiTagMacro, NULL);
if (!(dbOpts && *dbOpts && *dbOpts != '%')) {
dbOpts = _free(dbOpts);
}
if (oe && *oe)
*oe++ = '\0';
- rpmtag = tagValue(o);
+ rpmtag = rpmTagGetValue(o);
if (rpmtag < 0) {
rpmMessage(RPMMESS_WARNING,
_("dbiTagsInit: unrecognized tag name: \"%s\" ignored\n"), o);
if (!_printed[dbix & 0x1f]++)
rpmError(RPMERR_DBOPEN,
_("cannot open %s index using db%d - %s (%d)\n"),
- tagName(rpmtag), _dbapi,
+ rpmTagGetName(rpmtag), _dbapi,
(rc > 0 ? strerror(rc) : ""), rc);
_dbapi = -1;
}
static int _printed[32];
if (!_printed[dbix & 0x1f]++)
rpmError(RPMERR_DBOPEN, _("cannot open %s index\n"),
- tagName(rpmtag));
+ rpmTagGetName(rpmtag));
rc = 1;
goto exit;
}
if (rc > 0) {
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
}
if (rc == 0)
} else { /* error */
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
rc = -1;
}
} else { /* error */
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
return RPMRC_FAIL;
}
if (rc) {
rpmError(RPMERR_DBPUTINDEX,
_("error(%d) storing record #%d into %s\n"),
- rc, mi->mi_prevoffset, tagName(dbi->dbi_rpmtag));
+ rc, mi->mi_prevoffset, rpmTagGetName(dbi->dbi_rpmtag));
}
xx = dbiSync(dbi, 0);
(void) unblockSignals(dbi->dbi_rpmdb, &signalMask);
break;
}
- if ((tagType(mire->tag) & RPM_MASK_RETURN_TYPE) ==
+ if ((rpmTagGetType(mire->tag) & RPM_MASK_RETURN_TYPE) ==
RPM_ARRAY_RETURN_TYPE) {
u.ptr = hfd(u.ptr, t);
}
if (rc != DB_NOTFOUND)
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
#ifdef SQLITE_HACK
xx = dbiCclose(dbi, dbcursor, 0);
dbcursor = NULL;
if (rc > 0) {
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
- rc, (key->data ? key->data : "???"), tagName(dbi->dbi_rpmtag));
+ rc, (key->data ? key->data : "???"), rpmTagGetName(dbi->dbi_rpmtag));
}
/* Join keys need to be native endian internally. */
if (rc) {
rpmError(RPMERR_DBGETINDEX,
_("error(%d) setting header #%d record for %s removal\n"),
- rc, hdrNum, tagName(dbi->dbi_rpmtag));
+ rc, hdrNum, rpmTagGetName(dbi->dbi_rpmtag));
} else
rc = dbiDel(dbi, dbcursor, key, data, 0);
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
if (rpmcnt == 1 && stringvalued) {
rpmMessage(RPMMESS_DEBUG,
_("removing \"%s\" from %s index.\n"),
- (char *)key->data, tagName(dbi->dbi_rpmtag));
+ (char *)key->data, rpmTagGetName(dbi->dbi_rpmtag));
} else {
rpmMessage(RPMMESS_DEBUG,
_("removing %d entries from %s index.\n"),
- rpmcnt, tagName(dbi->dbi_rpmtag));
+ rpmcnt, rpmTagGetName(dbi->dbi_rpmtag));
}
printed++;
}
} else { /* error */
rpmError(RPMERR_DBGETINDEX,
_("error(%d) setting \"%s\" records from %s index\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1;
continue;
}
if (rc) {
rpmError(RPMERR_DBPUTINDEX,
_("error(%d) storing record \"%s\" into %s\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1;
}
data->data = _free(data->data);
if (rc) {
rpmError(RPMERR_DBPUTINDEX,
_("error(%d) removing record \"%s\" from %s\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1;
}
}
if (rpmcnt == 1 && stringvalued) {
rpmMessage(RPMMESS_DEBUG,
_("adding \"%s\" to %s index.\n"),
- (char *)key->data, tagName(dbi->dbi_rpmtag));
+ (char *)key->data, rpmTagGetName(dbi->dbi_rpmtag));
} else {
rpmMessage(RPMMESS_DEBUG,
_("adding %d entries to %s index.\n"),
- rpmcnt, tagName(dbi->dbi_rpmtag));
+ rpmcnt, rpmTagGetName(dbi->dbi_rpmtag));
}
printed++;
}
} else if (rc != DB_NOTFOUND) { /* error */
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1;
continue;
}
if (rc) {
rpmError(RPMERR_DBPUTINDEX,
_("error(%d) storing record %s into %s\n"),
- rc, key->data, tagName(dbi->dbi_rpmtag));
+ rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1;
}
data->data = _free(data->data);
case 3:
if (dbiTags != NULL)
for (i = 0; i < dbiTagsMax; i++) {
- const char * base = tagName(dbiTags[i]);
+ const char * base = rpmTagGetName(dbiTags[i]);
sprintf(filename, "%s/%s/%s", prefix, dbpath, base);
(void)rpmCleanPath(filename);
if (!rpmioFileExists(filename))
if (isTemporaryDB((rpmtag = dbiTags[i])))
continue;
- base = tagName(rpmtag);
+ base = rpmTagGetName(rpmtag);
sprintf(ofilename, "%s/%s/%s", prefix, olddbpath, base);
(void)rpmCleanPath(ofilename);
if (!rpmioFileExists(ofilename))
rc = sqlite3_bind_int(scp->pStmt, pos, hnum);
} break;
default:
- switch (tagType(dbi->dbi_rpmtag)) {
+ switch (rpmTagGetType(dbi->dbi_rpmtag)) {
case RPM_NULL_TYPE:
case RPM_BIN_TYPE:
rc = sqlite3_bind_blob(scp->pStmt, pos, key->data, key->size, SQLITE_STATIC);
valtype = "blob";
break;
default:
- switch (tagType(dbi->dbi_rpmtag)) {
+ switch (rpmTagGetType(dbi->dbi_rpmtag)) {
case RPM_NULL_TYPE:
case RPM_BIN_TYPE:
default:
}
}
if (_debug)
-fprintf(stderr, "\t%s(%d) type(%d) keytype %s\n", tagName(dbi->dbi_rpmtag), dbi->dbi_rpmtag, tagType(dbi->dbi_rpmtag), keytype);
+fprintf(stderr, "\t%s(%d) type(%d) keytype %s\n", rpmTagGetName(dbi->dbi_rpmtag), dbi->dbi_rpmtag, rpmTagGetType(dbi->dbi_rpmtag), keytype);
sprintf(cmd, "CREATE TABLE '%s' (key %s, value %s)",
dbi->dbi_subfile, keytype, valtype);
rc = sqlite3_exec(sqldb->db, cmd, NULL, NULL, (char **)&scp->pzErrmsg);
dbi->dbi_root = root;
dbi->dbi_home = home;
- dbfile = tagName(dbi->dbi_rpmtag);
+ dbfile = rpmTagGetName(dbi->dbi_rpmtag);
enterChroot(dbi);
int rc = 0;
if (_debug)
-fprintf(stderr, "==> %s(%s) tag %d type %d scp %p\n", __FUNCTION__, tagName(dbi->dbi_rpmtag), dbi->dbi_rpmtag, tagType(dbi->dbi_rpmtag), scp);
+fprintf(stderr, "==> %s(%s) tag %d type %d scp %p\n", __FUNCTION__, rpmTagGetName(dbi->dbi_rpmtag), dbi->dbi_rpmtag, rpmTagGetType(dbi->dbi_rpmtag), scp);
enterChroot(dbi);
switch(c->injmode) {
case INJ_ADD:
if (!(rc && c->done > 0)) {
- warnx(_("failed to add tag %s"), tagName(c->tagval));
+ warnx(_("failed to add tag %s"), rpmTagGetName(c->tagval));
ec = 1;
}
break;
case INJ_DELETE:
if (!(!rc && c->done > 0)) {
- warnx(_("failed to delete tag %s"), tagName(c->tagval));
+ warnx(_("failed to delete tag %s"), rpmTagGetName(c->tagval));
ec = 1;
}
break;
case INJ_MODIFY:
if (!(rc && c->done > 0)) {
- warnx(_("failed to modify tag %s"), tagName(c->tagval));
+ warnx(_("failed to modify tag %s"), rpmTagGetName(c->tagval));
ec = 1;
}
break;
cmds[ncmds]->injmode = cmds[ncmds-1]->injmode;
ncmds++;
}
- c->tagval = tagValue(optArg);
+ c->tagval = rpmTagGetValue(optArg);
if (!((c->tagval >= RPMTAG_NAME && c->tagval < RPMTAG_FIRSTFREE_TAG)
|| c->tagval >= RPMTAG_EXTERNAL_TAG))
errx(EXIT_FAILURE, _("unknown rpm tag \"--tag %s\""), optArg);