Rip the stillborn, broken apply/commit transaction goo

- This was beginnings of something ten years ago, and that something
  was long since abandoned. These never did anything useful
  that --justdb/--noscripts wouldn't do.
This commit is contained in:
Panu Matilainen 2010-12-20 11:38:21 +02:00
parent c91e00e81e
commit 89c2fd9f51
5 changed files with 10 additions and 51 deletions

View File

@ -579,12 +579,6 @@ static int fsmMkdirs(FSM_t fsm);
static int fsmCreate(FSM_t fsm)
{
int rc;
{ rpmts ts = fsmGetTs(fsm);
#define _tsmask (RPMTRANS_FLAG_PKGCOMMIT | RPMTRANS_FLAG_COMMIT)
fsm->commit = ((ts && (rpmtsFlags(ts) & _tsmask) &&
fsm->goal != FSM_PKGCOMMIT) ? 0 : 1);
#undef _tsmask
}
fsm->path = _free(fsm->path);
fsm->opath = _free(fsm->opath);
fsm->dnlx = _free(fsm->dnlx);
@ -1661,7 +1655,6 @@ static int fsmStage(FSM_t fsm, fileStage stage)
}
break;
case FSM_PKGERASE:
case FSM_PKGCOMMIT:
while (1) {
/* Clean fsm, free'ing memory. */
rc = fsmInit(fsm);
@ -1915,12 +1908,10 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
*fsm->failedFile = xstrdup(fsm->path);
break;
case FSM_FINI:
if (!fsm->postpone && fsm->commit) {
if (!fsm->postpone) {
if (fsm->goal == FSM_PKGINSTALL)
rc = ((S_ISREG(st->st_mode) && st->st_nlink > 1)
? fsmCommitLinks(fsm) : fsmNext(fsm, FSM_COMMIT));
if (fsm->goal == FSM_PKGCOMMIT)
rc = fsmNext(fsm, FSM_COMMIT);
if (fsm->goal == FSM_PKGERASE)
rc = fsmNext(fsm, FSM_COMMIT);
}
@ -2069,9 +2060,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
while ((fsm->li = fsm->links) != NULL) {
fsm->links = fsm->li->next;
fsm->li->next = NULL;
if (fsm->goal == FSM_PKGINSTALL &&
fsm->commit && fsm->li->linksLeft)
{
if (fsm->goal == FSM_PKGINSTALL && fsm->li->linksLeft) {
for (nlink_t i = 0 ; i < fsm->li->linksLeft; i++) {
if (fsm->li->filex[i] < 0)
continue;
@ -2266,7 +2255,6 @@ static const char * fileStageString(fileStage a) {
case FSM_PKGINSTALL:return "INSTALL";
case FSM_PKGERASE: return "ERASE";
case FSM_PKGBUILD: return "BUILD";
case FSM_PKGCOMMIT: return "COMMIT";
case FSM_PKGUNDO: return "UNDO";
case FSM_CREATE: return "create";

View File

@ -34,7 +34,6 @@ typedef enum fileStage_e {
FSM_PKGINSTALL = _fd(7),
FSM_PKGERASE = _fd(8),
FSM_PKGBUILD = _fd(9),
FSM_PKGCOMMIT = _fd(10),
FSM_PKGUNDO = _fd(11),
FSM_CREATE = _fd(17),
@ -149,7 +148,6 @@ struct fsm_s {
int exists; /*!< Does current file exist on disk? */
int mkdirsdone; /*!< Have "orphan" dirs been created? */
int rc; /*!< External file stage return code. */
int commit; /*!< Commit synchronously? */
cpioMapFlags mapFlags; /*!< Bit(s) to control mapping. */
const char * dirName; /*!< File directory name. */
const char * baseName; /*!< File base name. */

View File

@ -122,11 +122,6 @@ struct poptOption rpmInstallPoptTable[] = {
N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
NULL},
{ "apply", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
(_noTransScripts|_noTransTriggers|
RPMTRANS_FLAG_APPLYONLY|RPMTRANS_FLAG_PKGCOMMIT),
N_("do not execute package scriptlet(s)"), NULL },
{ "badreloc", '\0', POPT_BIT_SET,
&rpmIArgs.probFilter, RPMPROB_FILTER_FORCERELOCATE,
N_("relocate files in non-relocatable package"), NULL},

View File

@ -36,12 +36,9 @@ typedef enum pkgStage_e {
PSM_UNDO = 5,
PSM_FINI = 6,
PSM_PKGCOMMIT = 10,
PSM_CREATE = 17,
PSM_NOTIFY = 22,
PSM_DESTROY = 23,
PSM_COMMIT = 25,
PSM_SCRIPT = 53,
PSM_TRIGGERS = 54,
@ -840,9 +837,6 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
xx = Fclose(payload);
errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */
if (!rc)
rc = rpmpsmNext(psm, PSM_COMMIT);
/* XXX make sure progress is closed out */
psm->what = RPMCALLBACK_INST_PROGRESS;
psm->amount = (fi->archiveSize ? fi->archiveSize : 100);
@ -870,7 +864,6 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
int fc = rpmfiFC(fi);
if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
/* XXX Synthesize callbacks for packages with no files. */
if (rpmfiFC(fi) <= 0) {
@ -916,8 +909,7 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
* If this package has already been installed, remove it from
* the database before adding the new one.
*/
if (rpmteDBInstance(psm->te) &&
!(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY)) {
if (rpmteDBInstance(psm->te)) {
rc = rpmpsmNext(psm, PSM_RPMDB_REMOVE);
if (rc) break;
}
@ -943,8 +935,7 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
if (rc) break;
}
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
rc = markReplacedFiles(psm);
rc = markReplacedFiles(psm);
}
if (psm->goal == PKG_ERASE) {
@ -964,8 +955,7 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
if (rc) break;
}
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
rc = rpmpsmNext(psm, PSM_RPMDB_REMOVE);
rc = rpmpsmNext(psm, PSM_RPMDB_REMOVE);
}
break;
case PSM_UNDO:
@ -992,9 +982,6 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
fi->apath = _free(fi->apath);
break;
case PSM_PKGCOMMIT:
break;
case PSM_CREATE:
break;
case PSM_NOTIFY:
@ -1004,15 +991,6 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
} break;
case PSM_DESTROY:
break;
case PSM_COMMIT:
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_PKGCOMMIT)) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
rc = fsmSetup(rpmfiFSM(fi), FSM_PKGCOMMIT, ts, psm->te, fi,
NULL, NULL, &psm->failedFile);
xx = fsmTeardown(rpmfiFSM(fi));
break;
case PSM_SCRIPT: /* Run current package scriptlets. */
rc = runInstScript(psm);
break;

View File

@ -39,10 +39,10 @@ enum rpmtransFlags_e {
RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< obsolete, unused */
RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< obsolete, unused */
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11),
RPMTRANS_FLAG_PKGUNDO = (1 << 12),
RPMTRANS_FLAG_COMMIT = (1 << 13),
RPMTRANS_FLAG_UNDO = (1 << 14),
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11), /*!< obsolete, unused */
RPMTRANS_FLAG_PKGUNDO = (1 << 12), /*!< obsolete, unused */
RPMTRANS_FLAG_COMMIT = (1 << 13), /*!< obsolete, unused */
RPMTRANS_FLAG_UNDO = (1 << 14), /*!< obsolete, unused */
RPMTRANS_FLAG_REVERSE = (1 << 15), /*!< obsolete, unused */
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16), /*!< from --notriggerprein */
@ -54,7 +54,7 @@ enum rpmtransFlags_e {
RPMTRANS_FLAG_NOPOSTUN = (1 << 22), /*!< from --nopostun */
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23), /*!< from --notriggerpostun */
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
RPMTRANS_FLAG_APPLYONLY = (1 << 25), /*!< obsolete, unused */
RPMTRANS_FLAG_NOCOLLECTIONS = (1 << 26), /*!< from --nocollections */
RPMTRANS_FLAG_NOMD5 = (1 << 27), /*!< from --nomd5 */