From: Panu Matilainen Date: Tue, 24 Apr 2012 11:28:03 +0000 (+0300) Subject: Eliminate rpmts and rpmte kludgery from package building X-Git-Tag: tznext/4.11.0.1.tizen20130304~522 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4320b8125146f092dbefe8c61db47d1cc3d7960e;p=tools%2Flibrpm-tizen.git Eliminate rpmts and rpmte kludgery from package building - Package building has no associated transaction or ts members, this was all just fake-up kludgery to work around the way how fsm used to work. None of it relevant now, kill kill kill. --- diff --git a/build/pack.c b/build/pack.c index ef79eb6..416bb96 100644 --- a/build/pack.c +++ b/build/pack.c @@ -10,7 +10,6 @@ #include #include /* RPMSIGTAG*, rpmReadPackageFile */ -#include #include #include @@ -33,9 +32,6 @@ typedef struct cpioSourceArchive_s { */ 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; char *failedFile = NULL; FD_t cfd; int fsmrc; @@ -45,12 +41,7 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) if (cfd == NULL) return RPMRC_FAIL; - /* make up a transaction element for passing to fsm */ - ts = rpmtsCreate(); - rpmtsAddInstallElement(ts, h, NULL, 0, NULL); - te = rpmtsElement(ts, 0); - - fsmrc = rpmPackageFilesArchive(ts, te, fi, cfd, + fsmrc = rpmPackageFilesArchive(csa->cpioList, headerIsSource(h), cfd, &csa->cpioArchiveSize, &failedFile); if (fsmrc) { @@ -62,7 +53,6 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro) free(failedFile); Fclose(cfd); - rpmtsFree(ts); return (fsmrc == 0) ? RPMRC_OK : RPMRC_FAIL; } diff --git a/lib/fsm.c b/lib/fsm.c index 45f0ebd..ba25f43 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -1935,16 +1935,16 @@ int rpmPackageFilesRemove(rpmts ts, rpmte te, rpmfi fi, } -int rpmPackageFilesArchive(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, +int rpmPackageFilesArchive(rpmfi fi, int isSrc, FD_t cfd, rpm_loff_t * archiveSize, char ** failedFile) { - rpmfs fs = rpmteGetFileStates(te); - FSM_t fsm = fsmNew(FSM_PKGBUILD, ts, fs, fi, failedFile);; + rpmfs fs = rpmfsNew(rpmfiFC(fi), 0);; + FSM_t fsm = fsmNew(FSM_PKGBUILD, NULL, fs, fi, failedFile);; rpmcpio_t archive = rpmcpioOpen(cfd, O_WRONLY); int rc = 0; fsm->mapFlags |= CPIO_MAP_TYPE; - if (rpmteIsSource(te)) + if (isSrc) fsm->mapFlags |= CPIO_FOLLOW_SYMLINKS; if (archive == NULL) { @@ -2007,6 +2007,7 @@ int rpmPackageFilesArchive(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, *archiveSize = (rc == 0) ? rpmcpioTell(archive) : 0; rpmcpioFree(archive); + rpmfsFree(fs); fsmFree(fsm); return rc; diff --git a/lib/fsm.h b/lib/fsm.h index 5ff5801..7f19114 100644 --- a/lib/fsm.h +++ b/lib/fsm.h @@ -31,7 +31,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, int rpmPackageFilesRemove(rpmts ts, rpmte te, rpmfi fi, rpmpsm psm, char ** failedFile); -int rpmPackageFilesArchive(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, +int rpmPackageFilesArchive(rpmfi fi, int isSrc, FD_t cfd, rpm_loff_t * archiveSize, char ** failedFile); RPM_GNUC_INTERNAL