Eliminate rpmts and rpmte kludgery from package building
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 24 Apr 2012 11:28:03 +0000 (14:28 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 24 Apr 2012 11:28:03 +0000 (14:28 +0300)
- 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.

build/pack.c
lib/fsm.c
lib/fsm.h

index ef79eb6..416bb96 100644 (file)
@@ -10,7 +10,6 @@
 #include <time.h>
 
 #include <rpm/rpmlib.h>                        /* RPMSIGTAG*, rpmReadPackageFile */
-#include <rpm/rpmts.h>
 #include <rpm/rpmfileutil.h>
 #include <rpm/rpmlog.h>
 
@@ -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;
 }
index 45f0ebd..ba25f43 100644 (file)
--- 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;
index 5ff5801..7f19114 100644 (file)
--- 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