From a4e345455d817ce6c56940600d652ee3ae0aa5d5 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 11 Nov 2008 21:01:02 +0200 Subject: [PATCH] Move file action calculations to rpmfiNew() where possible - for build operations and src.rpm install this is known --- build/files.c | 6 ------ lib/psm.c | 3 --- lib/rpmfi.c | 11 +++++++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build/files.c b/build/files.c index 5872aa9..09aafc4 100644 --- a/build/files.c +++ b/build/files.c @@ -1313,12 +1313,6 @@ static void genCpioListAndHeader(FileList fl, a = stpcpy(a, "./"); a = stpcpy(a, (flp->cpioPath + skipLen)); a++; /* skip apath NUL */ - - if (flp->flags & RPMFILE_GHOST) { - fi->actions[i] = FA_SKIP; - continue; - } - fi->actions[i] = FA_COPYOUT; } if (fip) *fip = fi; diff --git a/lib/psm.c b/lib/psm.c index 8d279ce..8e514a0 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -303,9 +303,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, fi->astriplen = 0; fi->striplen = 0; - for (i = 0; i < fi->fc; i++) - fi->actions[i] = FA_CREATE; - i = fi->fc; if (fi->h != NULL) { /* XXX can't happen */ diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 81a3e19..c41721a 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -1285,7 +1285,18 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags) fi->action = FA_UNKNOWN; fi->flags = 0; + /* For build and src.rpm's the file actions are known at this point */ fi->actions = xcalloc(fi->fc, sizeof(*fi->actions)); + if (isBuild) { + for (int i = 0; i < fi->fc; i++) { + int ghost = fi->fflags[i] & RPMFILE_GHOST; + fi->actions[i] = ghost ? FA_SKIP : FA_COPYOUT; + } + } else if (isSource) { + for (int i = 0; i < fi->fc; i++) { + fi->actions[i] = FA_CREATE; + } + } /* XXX TR_REMOVED needs CPIO_MAP_{ABSOLUTE,ADDDOT} CPIO_ALL_HARDLINKS */ -- 2.7.4