From d010ec1c9026b35f5b2521be965c03c826894ce8 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 26 Aug 2010 12:21:33 +0300 Subject: [PATCH] Permit packages with no files to omit %files entirely - 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 | 3 --- build/pack.c | 3 --- build/parseFiles.c | 2 -- build/spec.c | 1 + tests/data/SPECS/versiontest.spec | 3 --- 5 files changed, 1 insertion(+), 11 deletions(-) diff --git a/build/files.c b/build/files.c index 6f8bd38..cf5e804 100644 --- a/build/files.c +++ b/build/files.c @@ -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); diff --git a/build/pack.c b/build/pack.c index 28630b7..8518080 100644 --- a/build/pack.c +++ b/build/pack.c @@ -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; diff --git a/build/parseFiles.c b/build/parseFiles.c index 3cdc576..44a92bb 100644 --- a/build/parseFiles.c +++ b/build/parseFiles.c @@ -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) { diff --git a/build/spec.c b/build/spec.c index e3f9df3..9299807 100644 --- a/build/spec.c +++ b/build/spec.c @@ -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; diff --git a/tests/data/SPECS/versiontest.spec b/tests/data/SPECS/versiontest.spec index bc015e0..892c130 100644 --- a/tests/data/SPECS/versiontest.spec +++ b/tests/data/SPECS/versiontest.spec @@ -12,6 +12,3 @@ BuildArch: noarch %clean rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root,-) -- 2.7.4