diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-01-11 15:11:37 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-01-11 15:41:22 +0200 |
commit | aee64fbc460a671faa3f950d329ec72f33ac660c (patch) | |
tree | d11d2baa2cd84b8820aa5d87fd3a8d17729bf32b /build/pack.c | |
parent | 1dc09307d85fc68bac450d5fa54db79450a3920c (diff) | |
download | rpm-aee64fbc460a671faa3f950d329ec72f33ac660c.tar.gz rpm-aee64fbc460a671faa3f950d329ec72f33ac660c.tar.bz2 rpm-aee64fbc460a671faa3f950d329ec72f33ac660c.zip |
Turn FSM into a blackbox, much like PSM is
- Similar in spirit to PSM blackbox treatment in
commit df9cdb1321ada8e3b120771f91a2eefab4ac2ad5, except that
technically fsm guts are still wide-open in fsm.h due to cpio
"needing" them (yuck).
- Allows getting rid of dumb a**-backwards things like rpmfiFSM()
which is just not needed, fsm is a relatively short-lived entity
inside psm and build, nobody else needs to bother with it except
for the returned results.
- Figure out the cpio map flags in fsmSetup() where it logically belongs,
we have all the necessary info available there.
- Get rid of newFSM() and freeFSM(), we can just as well place the
fsm on stack, merge the necessary cleanup bits from freeFSM()
into fsmTeardown()
- Supposedly no functional changes, knock wood.
Diffstat (limited to 'build/pack.c')
-rw-r--r-- | build/pack.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/build/pack.c b/build/pack.c index 194cc675d..494b13230 100644 --- a/build/pack.c +++ b/build/pack.c @@ -42,8 +42,7 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) rpmfs fs = NULL; char *failedFile = NULL; FD_t cfd; - rpmRC rc = RPMRC_OK; - int i; + int i, fsmrc; (void) Fflush(fdo); cfd = Fdopen(fdDup(Fileno(fdo)), fmodeMacro); @@ -64,24 +63,21 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) rpmfsSetAction(fs, i, FA_COPYOUT); } - if (fsmSetup(rpmfiFSM(fi), FSM_PKGBUILD, ts, te, fi, cfd, NULL, - &csa->cpioArchiveSize, &failedFile)) - rc = RPMRC_FAIL; - - (void) Fclose(cfd); + fsmrc = rpmfsmRun(FSM_PKGBUILD, ts, te, fi, cfd, NULL, + &csa->cpioArchiveSize, &failedFile); - if (fsmTeardown(rpmfiFSM(fi)) || rc == RPMRC_FAIL) { + if (fsmrc) { if (failedFile) rpmlog(RPMLOG_ERR, _("create archive failed on file %s\n"), failedFile); else rpmlog(RPMLOG_ERR, _("create archive failed\n")); - rc = RPMRC_FAIL; } free(failedFile); + Fclose(cfd); rpmtsFree(ts); - return rc; + return (fsmrc == 0) ? RPMRC_OK : RPMRC_FAIL; } static rpmRC addFileToTag(rpmSpec spec, const char * file, |