diff options
-rw-r--r-- | lib/psm.c | 101 | ||||
-rw-r--r-- | lib/psm.h | 32 | ||||
-rw-r--r-- | lib/rpmlib.h | 5 | ||||
-rw-r--r-- | lib/transaction.c | 15 | ||||
-rw-r--r-- | po/rpm.pot | 66 |
5 files changed, 171 insertions, 48 deletions
@@ -911,12 +911,103 @@ static int psmChroot(rpmTransactionSet ts, TFI_t fi, int enter) return rc; } +int psmStage(PSM_t psm, fileStage stage) +{ + const char * const cur = fileStageString(stage); + int rc = psm->rc; + int i; + + switch (stage) { + case FSM_UNKNOWN: + break; + case FSM_PKGINSTALL: + break; + case FSM_PKGERASE: + break; + case FSM_PKGCOMMIT: + break; + case FSM_PKGBUILD: + break; + case FSM_CREATE: + break; + case FSM_INIT: + break; + case FSM_PRE: + break; + case FSM_MAP: + break; + case FSM_MKDIRS: + break; + case FSM_RMDIRS: + break; + case FSM_PROCESS: + break; + case FSM_POST: + break; + case FSM_MKLINKS: + break; + case FSM_NOTIFY: + break; + case FSM_UNDO: + break; + case FSM_FINI: + break; + case FSM_COMMIT: + break; + case FSM_DESTROY: + break; + case FSM_VERIFY: + break; + + case FSM_UNLINK: + case FSM_RENAME: + case FSM_MKDIR: + case FSM_RMDIR: + case FSM_CHOWN: + case FSM_LCHOWN: + case FSM_CHMOD: + case FSM_UTIME: + case FSM_SYMLINK: + case FSM_LINK: + case FSM_MKFIFO: + case FSM_MKNOD: + case FSM_LSTAT: + case FSM_STAT: + case FSM_READLINK: + break; + case FSM_CHROOT: + break; + + case FSM_NEXT: + case FSM_EAT: + case FSM_POS: + case FSM_PAD: + case FSM_TRAILER: + case FSM_HREAD: + case FSM_HWRITE: + case FSM_DREAD: + case FSM_DWRITE: + case FSM_ROPEN: + case FSM_READ: + case FSM_RCLOSE: + case FSM_WOPEN: + case FSM_WRITE: + case FSM_WCLOSE: + default: + break; + } + + return rc; +} + /** * @todo Packages w/o files never get a callback, hence don't get displayed * on install with -v. */ -int installBinaryPackage(const rpmTransactionSet ts, TFI_t fi) +int installBinaryPackage(PSM_t psm) { + const rpmTransactionSet ts = psm->ts; + TFI_t fi = psm->fi; HGE_t hge = (HGE_t)fi->hge; /*@observer@*/ static char * stepName = " install"; Header oldH = NULL; @@ -1090,8 +1181,10 @@ exit: return ec; } -int removeBinaryPackage(const rpmTransactionSet ts, TFI_t fi) +int removeBinaryPackage(PSM_t psm) { + const rpmTransactionSet ts = psm->ts; + TFI_t fi = psm->fi; /*@observer@*/ static char * stepName = " erase"; Header h; const char * failedFile = NULL; @@ -1200,8 +1293,10 @@ exit: return rc; } -int repackage(const rpmTransactionSet ts, TFI_t fi) +int repackage(PSM_t psm) { + const rpmTransactionSet ts = psm->ts; + TFI_t fi = psm->fi; HGE_t hge = fi->hge; HFD_t hfd = fi->hfd; FD_t fd = NULL; @@ -96,6 +96,15 @@ struct transactionFileInfo_s { unsigned int record; }; +/** + */ +struct psm_s { + const rpmTransactionSet ts; + TFI_t fi; + int rc; /*!< External file stage return code. */ + fileStage stage; /*!< External package stage. */ +}; + #ifdef __cplusplus extern "C" { #endif @@ -131,26 +140,31 @@ void freeFi(TFI_t fi) /** * Install binary package (from transaction set). - * @param ts transaction set - * @param fi transaction element file info + * @param psm package state machine data * @return 0 on success, 1 on bad magic, 2 on error */ -int installBinaryPackage(const rpmTransactionSet ts, TFI_t fi); +int installBinaryPackage(PSM_t psm) + /*@modifies psm @*/; /** * Erase binary package (from transaction set). - * @param ts transaction set - * @param fi transaction element file info + * @param psm package state machine data * @return 0 on success */ -int removeBinaryPackage(const rpmTransactionSet ts, TFI_t fi); +int removeBinaryPackage(PSM_t psm) + /*@modifies psm @*/; /** - * @param ts transaction set - * @param fi transaction element file info + * @param psm package state machine data * @return 0 on success */ -int repackage(const rpmTransactionSet ts, TFI_t fi); +int repackage(PSM_t psm) + /*@modifies psm @*/; + +/** + */ +int psmStage(PSM_t psm, fileStage stage) + /*@modifies psm @*/; #ifdef __cplusplus } diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 9c82b24b1..233159936 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -935,6 +935,11 @@ typedef /*@abstract@*/ struct fsmIterator_s * FSMI_t; typedef /*@abstract@*/ struct fsm_s * FSM_t; /** \ingroup rpmtrans + * Package state machine data. + */ +typedef /*@abstract@*/ struct psm_s * PSM_t; + +/** \ingroup rpmtrans */ typedef /*@abstract@*/ struct transactionFileInfo_s * TFI_t; diff --git a/lib/transaction.c b/lib/transaction.c index 5c7d808ac..11c877a6c 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -40,6 +40,7 @@ /*@access rpmdb@*/ /*@access rpmTransactionSet@*/ /*@access TFI_t@*/ +/*@access PSM_t@*/ /*@access rpmProblemSet@*/ /*@access rpmProblem@*/ @@ -1377,6 +1378,8 @@ int rpmRunTransactions( rpmTransactionSet ts, int lastFailed; int oc; fingerPrintCache fpc; + struct psm_s psmbuf; + PSM_t psm = &psmbuf; void * tsi; /* FIXME: what if the same package is included in ts twice? */ @@ -1397,6 +1400,9 @@ int rpmRunTransactions( rpmTransactionSet ts, ts->chrootDone = 0; ts->id = time(NULL); + memset(psm, 0, sizeof(*psm)); + psm->ts = ts; + /* Get available space on mounted file systems. */ if (!(ts->ignoreSet & RPMPROB_FILTER_DISKSPACE) && !rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount)) { @@ -1755,6 +1761,7 @@ int rpmRunTransactions( rpmTransactionSet ts, tsi = tsInitIterator(ts); while ((fi = tsNextIterator(tsi)) != NULL) { + psm->fi = fi; if (fi->fc == 0) continue; fi->fps = _free(fi->fps); @@ -1787,12 +1794,13 @@ int rpmRunTransactions( rpmTransactionSet ts, if (ts->transFlags & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) { tsi = tsInitIterator(ts); while ((fi = tsNextIterator(tsi)) != NULL) { + psm->fi = fi; switch (fi->type) { case TR_ADDED: break; case TR_REMOVED: if (ts->transFlags & RPMTRANS_FLAG_REPACKAGE) - repackage(ts, fi); + repackage(psm); break; } } @@ -1809,6 +1817,7 @@ int rpmRunTransactions( rpmTransactionSet ts, int gotfd; gotfd = 0; + psm->fi = fi; switch (fi->type) { case TR_ADDED: @@ -1851,7 +1860,7 @@ assert(alp == fi->ap); ts->transFlags |= RPMTRANS_FLAG_MULTILIB; if (fi->ap == NULL) fi->ap = alp; /* XXX WTFO? */ - if (installBinaryPackage(ts, fi)) { + if (installBinaryPackage(psm)) { ourrc++; lastFailed = i; } @@ -1880,7 +1889,7 @@ if (fi->ap == NULL) fi->ap = alp; /* XXX WTFO? */ if (ts->order[oc].u.removed.dependsOnIndex == lastFailed) break; - if (removeBinaryPackage(ts, fi)) + if (removeBinaryPackage(psm)) ourrc++; break; diff --git a/po/rpm.pot b/po/rpm.pot index 982eed281..8ab3426e8 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-02-27 14:32-0500\n" +"POT-Creation-Date: 2001-02-27 17:00-0500\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" @@ -1808,7 +1808,7 @@ msgstr "" msgid "Could not open %s: %s\n" msgstr "" -#: build/pack.c:484 lib/psm.c:1304 +#: build/pack.c:484 lib/psm.c:1399 #, c-format msgid "Unable to write package: %s\n" msgstr "" @@ -1838,7 +1838,7 @@ msgstr "" msgid "Unable to write payload to %s: %s\n" msgstr "" -#: build/pack.c:566 lib/psm.c:1360 +#: build/pack.c:566 lib/psm.c:1455 #, c-format msgid "Wrote: %s\n" msgstr "" @@ -2925,18 +2925,18 @@ msgstr "" msgid "source package expected, binary found\n" msgstr "" -#: lib/psm.c:927 lib/psm.c:1101 +#: lib/psm.c:1018 lib/psm.c:1194 #, c-format msgid "%s: %s-%s-%s has %d files, test = %d\n" msgstr "" #. XXX WTFO? erase failures are not cause for stopping. -#: lib/psm.c:991 lib/psm.c:1059 lib/psm.c:1151 lib/psm.c:1176 +#: lib/psm.c:1082 lib/psm.c:1150 lib/psm.c:1244 lib/psm.c:1269 #, c-format msgid "%s: running %s script(s) (if any)\n" msgstr "" -#: lib/psm.c:998 +#: lib/psm.c:1089 msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n" msgstr "" @@ -3206,89 +3206,89 @@ msgstr "" msgid "removing %d entries from %s index.\n" msgstr "" -#: lib/rpmdb.c:1923 +#: lib/rpmdb.c:1890 #, c-format msgid "error(%d) allocating new package instance\n" msgstr "" -#: lib/rpmdb.c:1997 +#: lib/rpmdb.c:1964 #, c-format msgid "adding \"%s\" to %s index.\n" msgstr "" -#: lib/rpmdb.c:2006 +#: lib/rpmdb.c:1973 #, c-format msgid "adding %d entries to %s index.\n" msgstr "" -#: lib/rpmdb.c:2408 +#: lib/rpmdb.c:2342 #, c-format msgid "removing %s after successful db3 rebuild.\n" msgstr "" -#: lib/rpmdb.c:2434 +#: lib/rpmdb.c:2368 msgid "no dbpath has been set" msgstr "" -#: lib/rpmdb.c:2459 +#: lib/rpmdb.c:2393 #, c-format msgid "rebuilding database %s into %s\n" msgstr "" -#: lib/rpmdb.c:2463 +#: lib/rpmdb.c:2397 #, c-format msgid "temporary database %s already exists\n" msgstr "" -#: lib/rpmdb.c:2469 +#: lib/rpmdb.c:2403 #, c-format msgid "creating directory %s\n" msgstr "" -#: lib/rpmdb.c:2471 +#: lib/rpmdb.c:2405 #, c-format msgid "creating directory %s: %s\n" msgstr "" -#: lib/rpmdb.c:2478 +#: lib/rpmdb.c:2412 #, c-format msgid "opening old database with dbapi %d\n" msgstr "" -#: lib/rpmdb.c:2489 +#: lib/rpmdb.c:2423 #, c-format msgid "opening new database with dbapi %d\n" msgstr "" -#: lib/rpmdb.c:2512 +#: lib/rpmdb.c:2446 #, c-format msgid "record number %d in database is bad -- skipping.\n" msgstr "" -#: lib/rpmdb.c:2551 +#: lib/rpmdb.c:2485 #, c-format msgid "cannot add record originally at %d\n" msgstr "" -#: lib/rpmdb.c:2569 +#: lib/rpmdb.c:2503 msgid "failed to rebuild database: original database remains in place\n" msgstr "" -#: lib/rpmdb.c:2577 +#: lib/rpmdb.c:2511 msgid "failed to replace old database with new database!\n" msgstr "" -#: lib/rpmdb.c:2579 +#: lib/rpmdb.c:2513 #, c-format msgid "replace files in %s with files from %s to recover" msgstr "" -#: lib/rpmdb.c:2589 +#: lib/rpmdb.c:2523 #, c-format msgid "removing directory %s\n" msgstr "" -#: lib/rpmdb.c:2591 +#: lib/rpmdb.c:2525 #, c-format msgid "failed to remove directory %s: %s\n" msgstr "" @@ -3636,46 +3636,46 @@ msgstr "" msgid "You must set \"%%_pgp_name\" in your macro file\n" msgstr "" -#: lib/transaction.c:403 +#: lib/transaction.c:404 msgid "========== relocations\n" msgstr "" -#: lib/transaction.c:406 +#: lib/transaction.c:407 #, c-format msgid "%5d exclude %s\n" msgstr "" -#: lib/transaction.c:409 +#: lib/transaction.c:410 #, c-format msgid "%5d relocate %s -> %s\n" msgstr "" -#: lib/transaction.c:483 +#: lib/transaction.c:484 #, c-format msgid "excluding multilib path %s%s\n" msgstr "" -#: lib/transaction.c:532 +#: lib/transaction.c:533 #, c-format msgid "excluding %s %s\n" msgstr "" -#: lib/transaction.c:539 +#: lib/transaction.c:540 #, c-format msgid "relocating %s to %s\n" msgstr "" -#: lib/transaction.c:611 +#: lib/transaction.c:612 #, c-format msgid "relocating directory %s to %s\n" msgstr "" -#: lib/transaction.c:616 +#: lib/transaction.c:617 #, c-format msgid "excluding directory %s\n" msgstr "" -#: lib/transaction.c:740 +#: lib/transaction.c:741 #, c-format msgid "%s skipped due to missingok flag\n" msgstr "" |