Explicitly tell rpmfiNew() when its being used for build
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 11 Jan 2012 10:16:53 +0000 (12:16 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 11 Jan 2012 10:16:53 +0000 (12:16 +0200)
- Eliminate feeble heuristic on archive size tag not being set during
  build for detecting this and have build code explicitly pass
  RPMFI_ISBUILD flag instead.
- Also eliminate the pointless isSource variable from rpmfiNew() while.

build/files.c
lib/rpmfi.c

index f222a5d..2302bb5 100644 (file)
@@ -1235,6 +1235,9 @@ static void genCpioListAndHeader(FileList fl,
     const char *fn;
     char *a, **apath;
 
+    /* Used to be guess... err, determined in rpmfiNew but lets be explicit */
+    flags |= RPMFI_ISBUILD;
+
     /* rpmfiNew() only groks compressed filelists */
     headerConvert(h, HEADERCONV_COMPRESSFILELIST);
     fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, flags);
index 6186d9f..3ff24ee 100644 (file)
@@ -1127,7 +1127,6 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
     rpmfi fi = NULL;
     rpm_loff_t *asize = NULL;
     unsigned char * t;
-    int isBuild, isSource;
     struct rpmtd_s fdigests, digalgo;
     struct rpmtd_s td;
     headerGetFlags scareFlags = (flags & RPMFI_KEEPHEADER) ? 
@@ -1151,11 +1150,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
     fi->archiveSize = asize ? *asize : 0;
     rpmtdFreeData(&td);
     
-    /* Archive size is not set when this gets called from build */
-    isBuild = (asize == NULL);
-    isSource = headerIsSource(h);
-    if (isBuild) fi->fiflags |= RPMFI_ISBUILD;
-    if (isSource) fi->fiflags |= RPMFI_ISSOURCE;
+    if (headerIsSource(h)) fi->fiflags |= RPMFI_ISSOURCE;
 
     _hgfi(h, RPMTAG_BASENAMES, &td, defFlags, fi->bnl);
     fi->fc = rpmtdCount(&td);