/* forward declarations */
static void rpmteColorDS(rpmte te, rpmTag tag);
-static int rpmteClose(rpmte te, rpmts ts, int reset_fi);
+static int rpmteClose(rpmte te, int reset_fi);
void rpmteCleanDS(rpmte te)
{
free(colors);
}
-static Header rpmteDBHeader(rpmts ts, unsigned int rec)
+static Header rpmteDBHeader(rpmte te)
{
Header h = NULL;
rpmdbMatchIterator mi;
- mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, &rec, sizeof(rec));
+ mi = rpmtsInitIterator(te->ts, RPMDBI_PACKAGES,
+ &te->db_instance, sizeof(te->db_instance));
/* iterator returns weak refs, grab hold of header */
if ((h = rpmdbNextIterator(mi)))
h = headerLink(h);
return h;
}
-static Header rpmteFDHeader(rpmts ts, rpmte te)
+static Header rpmteFDHeader(rpmte te)
{
Header h = NULL;
- te->fd = rpmtsNotify(ts, te, RPMCALLBACK_INST_OPEN_FILE, 0, 0);
+ te->fd = rpmtsNotify(te->ts, te, RPMCALLBACK_INST_OPEN_FILE, 0, 0);
if (te->fd != NULL) {
rpmVSFlags ovsflags;
rpmRC pkgrc;
- ovsflags = rpmtsSetVSFlags(ts, rpmtsVSFlags(ts) | RPMVSF_NEEDPAYLOAD);
- pkgrc = rpmReadPackageFile(ts, te->fd, rpmteNEVRA(te), &h);
- rpmtsSetVSFlags(ts, ovsflags);
+ ovsflags = rpmtsSetVSFlags(te->ts,
+ rpmtsVSFlags(te->ts) | RPMVSF_NEEDPAYLOAD);
+ pkgrc = rpmReadPackageFile(te->ts, te->fd, rpmteNEVRA(te), &h);
+ rpmtsSetVSFlags(te->ts, ovsflags);
switch (pkgrc) {
default:
- rpmteClose(te, ts, 1);
+ rpmteClose(te, 1);
break;
case RPMRC_NOTTRUSTED:
case RPMRC_NOKEY:
return h;
}
-static int rpmteOpen(rpmte te, rpmts ts, int reload_fi)
+static int rpmteOpen(rpmte te, int reload_fi)
{
Header h = NULL;
- unsigned int instance;
- if (te == NULL || ts == NULL || rpmteFailed(te))
+ if (te == NULL || te->ts == NULL || rpmteFailed(te))
goto exit;
- instance = rpmteDBInstance(te);
rpmteSetHeader(te, NULL);
switch (rpmteType(te)) {
case TR_ADDED:
- h = instance ? rpmteDBHeader(ts, instance) : rpmteFDHeader(ts, te);
+ h = rpmteDBInstance(te) ? rpmteDBHeader(te) : rpmteFDHeader(te);
break;
case TR_REMOVED:
- h = rpmteDBHeader(ts, instance);
+ h = rpmteDBHeader(te);
break;
}
if (h != NULL) {
return (h != NULL);
}
-static int rpmteClose(rpmte te, rpmts ts, int reset_fi)
+static int rpmteClose(rpmte te, int reset_fi)
{
- if (te == NULL || ts == NULL)
+ if (te == NULL || te->ts == NULL)
return 0;
switch (te->type) {
case TR_ADDED:
if (te->fd) {
- rpmtsNotify(ts, te, RPMCALLBACK_INST_CLOSE_FILE, 0, 0);
+ rpmtsNotify(te->ts, te, RPMCALLBACK_INST_CLOSE_FILE, 0, 0);
te->fd = NULL;
}
break;
return payload;
}
-static int rpmteMarkFailed(rpmte te, rpmts ts)
+static int rpmteMarkFailed(rpmte te)
{
- rpmtsi pi = rpmtsiInit(ts);
+ rpmtsi pi = rpmtsiInit(te->ts);
rpmte p;
te->failed++;
return te->fs;
}
-int rpmteProcess(rpmte te, rpmts ts, pkgGoal goal)
+int rpmteProcess(rpmte te, pkgGoal goal)
{
/* Only install/erase resets pkg file info */
int scriptstage = (goal != PKG_INSTALL && goal != PKG_ERASE);
}
}
- if (rpmteOpen(te, ts, reset_fi)) {
- failed = rpmpsmRun(ts, te, goal);
- rpmteClose(te, ts, reset_fi);
+ if (rpmteOpen(te, reset_fi)) {
+ failed = rpmpsmRun(te->ts, te, goal);
+ rpmteClose(te, reset_fi);
}
/* XXX should %pretrans failure fail the package install? */
if (failed && !scriptstage) {
- failed = rpmteMarkFailed(te, ts);
+ failed = rpmteMarkFailed(te);
}
return failed;
rpmte p;
rpmtsi pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
- rpmteProcess(p, ts, goal);
+ rpmteProcess(p, goal);
}
pi = rpmtsiFree(pi);
return 0; /* what to do about failures? */
rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
- failed = rpmteProcess(p, ts, rpmteType(p));
+ failed = rpmteProcess(p, rpmteType(p));
if (failed) {
rpmlog(RPMLOG_ERR, "%s: %s %s\n", rpmteNEVRA(p),
rpmteTypeString(p), failed > 1 ? _("skipped") : _("failed"));