From: Panu Matilainen Date: Tue, 24 Apr 2012 09:36:26 +0000 (+0300) Subject: Bury build filestate setting inside fsm remains X-Git-Tag: tznext/4.11.0.1.tizen20130304~527 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f4186766c7c628b8cc67fe0c62d58cf38b51c92;p=tools%2Flibrpm-tizen.git Bury build filestate setting inside fsm remains - This whole thing probably isn't needed anymore, but for now just lift the FA_SKIP/FA_COPYOUT setting to rpmPackageFilesArchive(), allowing rpmfsSetAction() to become properly internal-only function. - Trim out unnecessary now unnecessary librpm internal includes from librpmbuild code --- diff --git a/build/pack.c b/build/pack.c index ebfee57..ef79eb6 100644 --- a/build/pack.c +++ b/build/pack.c @@ -15,10 +15,7 @@ #include #include "rpmio/rpmio_internal.h" /* fdInitDigest, fdFiniDigest */ -#include "lib/cpio.h" #include "lib/fsm.h" -#include "lib/rpmfi_internal.h" /* rpmfiFSM() */ -#include "lib/rpmte_internal.h" /* rpmfs */ #include "lib/signature.h" #include "lib/rpmlead.h" #include "build/rpmbuild_internal.h" @@ -39,10 +36,9 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) rpmts ts = NULL; rpmfi fi = csa->cpioList; rpmte te = NULL; - rpmfs fs = NULL; char *failedFile = NULL; FD_t cfd; - int i, fsmrc; + int fsmrc; (void) Fflush(fdo); cfd = Fdopen(fdDup(Fileno(fdo)), fmodeMacro); @@ -53,15 +49,6 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) ts = rpmtsCreate(); rpmtsAddInstallElement(ts, h, NULL, 0, NULL); te = rpmtsElement(ts, 0); - fs = rpmteGetFileStates(te); - - fi = rpmfiInit(fi, 0); - while ((i = rpmfiNext(fi)) >= 0) { - if (rpmfiFFlags(fi) & RPMFILE_GHOST) - rpmfsSetAction(fs, i, FA_SKIP); - else - rpmfsSetAction(fs, i, FA_COPYOUT); - } fsmrc = rpmPackageFilesArchive(ts, te, fi, cfd, &csa->cpioArchiveSize, &failedFile); diff --git a/lib/fsm.c b/lib/fsm.c index b0e2e90..981c33b 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -1947,9 +1947,19 @@ int rpmPackageFilesArchive(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, rpmcpio_t archive = rpmcpioOpen(cfd, O_WRONLY); int rc = 0; - if (archive == NULL) + if (archive == NULL) { rc = CPIOERR_INTERNAL; + } else { + rpmfs fs = rpmteGetFileStates(te); + int ghost, i, fc = rpmfiFC(fi); + /* XXX Is this actually still needed? */ + for (i = 0; i < fc; i++) { + ghost = (rpmfiFFlagsIndex(fi, i) & RPMFILE_GHOST); + rpmfsSetAction(fs, i, ghost ? FA_SKIP : FA_COPYOUT); + } + } + while (!rc) { fsmReset(fsm); diff --git a/lib/rpmfs.h b/lib/rpmfs.h index ef478ad..4253dd2 100644 --- a/lib/rpmfs.h +++ b/lib/rpmfs.h @@ -55,7 +55,7 @@ rpm_fstate_t * rpmfsGetStates(rpmfs fs); RPM_GNUC_INTERNAL rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix); -/* XXX this should be internal too but build code needs for now */ +RPM_GNUC_INTERNAL void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action); #ifdef __cplusplus