ts->order = xrealloc(ts->order, sizeof(*ts->order) * ts->orderAlloced);
}
- p = rpmteNew(ts, h, TR_REMOVED, NULL, NULL, dboffset, depends);
+ p = rpmteNew(ts, h, TR_REMOVED, NULL, NULL, -1, depends);
ts->order[ts->orderCount] = p;
ts->orderCount++;
p->relocs[i].newPath = NULL;
}
- /* Set db_instance to 0 as it has not been installed
- * necessarily yet.
- */
- p->db_instance = 0;
+ p->db_instance = headerGetInstance(h);
p->key = key;
p->fd = NULL;
struct rpmtd_s size;
p->type = type;
+ p->pkgKey = pkgKey;
addTE(ts, p, h, key, relocs);
switch (type) {
case TR_ADDED:
- p->u.addedKey = pkgKey;
headerGet(h, RPMTAG_SIGSIZE, &size, HEADERGET_DEFAULT);
if ((ep = rpmtdGetUint32(&size))) {
p->pkgFileSize += 96 + 256 + *ep;
}
break;
case TR_REMOVED:
- p->u.removed.dependsOnKey = pkgKey;
- p->u.removed.dboffset = dboffset;
+ /* nothing to do */
break;
}
return p;
}
-/* Get the DB Instance value */
unsigned int rpmteDBInstance(rpmte te)
{
return (te != NULL ? te->db_instance : 0);
}
-/* Set the DB Instance value */
void rpmteSetDBInstance(rpmte te, unsigned int instance)
{
if (te != NULL)
rpmalKey rpmteAddedKey(rpmte te)
{
- return (te != NULL ? te->u.addedKey : RPMAL_NOMATCH);
+ return (te != NULL && te->type == TR_ADDED ? te->pkgKey : RPMAL_NOMATCH);
}
rpmalKey rpmteSetAddedKey(rpmte te, rpmalKey npkgKey)
{
rpmalKey opkgKey = RPMAL_NOMATCH;
- if (te != NULL) {
- opkgKey = te->u.addedKey;
- te->u.addedKey = npkgKey;
+ if (te != NULL && te->type == TR_ADDED) {
+ opkgKey = te->pkgKey;
+ te->pkgKey = npkgKey;
}
return opkgKey;
}
rpmalKey rpmteDependsOnKey(rpmte te)
{
- return (te != NULL ? te->u.removed.dependsOnKey : RPMAL_NOMATCH);
+ return (te != NULL && te->type == TR_REMOVED ? te->pkgKey : RPMAL_NOMATCH);
}
int rpmteDBOffset(rpmte te)
{
- return (te != NULL ? te->u.removed.dboffset : 0);
+ return rpmteDBInstance(te);
}
const char * rpmteEVR(rpmte te)
* @param type TR_ADDED/TR_REMOVED
* @param key (TR_ADDED) package retrieval key (e.g. file name)
* @param relocs (TR_ADDED) package file relocations
- * @param dboffset (TR_REMOVED) rpmdb instance
+ * @param dboffset unused
* @param pkgKey associated added package (if any)
* @return new transaction element
*/
int tree; /*!< Tree index. */
int depth; /*!< Depth in dependency tree. */
int breadth; /*!< Breadth in dependency tree. */
- unsigned int db_instance; /*!< Database Instance after add */
+ unsigned int db_instance; /*!< Database instance (of removed pkgs) */
tsortInfo tsi; /*!< Dependency ordering chains. */
rpmds this; /*!< This package's provided NEVR. */
int nrelocs; /*!< (TR_ADDED) No. of relocations. */
FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
- union {
- rpmalKey addedKey;
- struct {
- rpmalKey dependsOnKey;
- int dboffset;
- } removed;
- } u;
-
+ rpmalKey pkgKey;
};
/**