Permit packages with no files to omit %files entirely
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 26 Aug 2010 09:21:33 +0000 (12:21 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 26 Aug 2010 09:31:01 +0000 (12:31 +0300)
- Fixes the long standing obscure behavior of missing %files
  section causes build to complete without errors but without producing
  any packages either. Packages without files in them are perfectly
  valid (eg metapackages), requiring empty %files section for those
  is just unnecessary spec noise.
- Remove %files section on one of the test-suite specs to create
  a test-case for this as a side-effect.
- This of course introduces a slight incompatibility with older rpm's,
  if compatibility is required then just add those empty %files in the
  spec, they dont hurt anything but the readers eyes.

build/files.c
build/pack.c
build/parseFiles.c
build/spec.c
tests/data/SPECS/versiontest.spec

index 6f8bd38..cf5e804 100644 (file)
@@ -2164,9 +2164,6 @@ int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test)
        const char *a;
        headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName);
 
-       if (pkg->fileList == NULL)
-           continue;
-
        nvr = headerGetAsString(pkg->header, RPMTAG_NVRA);
        rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr);
        free(nvr);
index 28630b7..8518080 100644 (file)
@@ -680,9 +680,6 @@ rpmRC packageBinaries(rpmSpec spec)
     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
        char *fn;
 
-       if (pkg->fileList == NULL)
-           continue;
-
        if ((rc = processScriptFiles(spec, pkg)))
            return rc;
        
index 3cdc576..44a92bb 100644 (file)
@@ -73,8 +73,6 @@ int parseFiles(rpmSpec spec)
        }
     }
 
-    pkg->fileList = newStringBuf();
-    
     if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
        nextPart = PART_NONE;
     } else if (rc < 0) {
index e3f9df3..9299807 100644 (file)
@@ -99,6 +99,7 @@ Package newPackage(rpmSpec spec)
     p->header = headerNew();
     p->autoProv = 1;
     p->autoReq = 1;
+    p->fileList = newStringBuf();
 
     if (spec->packages == NULL) {
        spec->packages = p;
index bc015e0..892c130 100644 (file)
@@ -12,6 +12,3 @@ BuildArch:    noarch
 
 %clean
 rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root,-)