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.
This commit is contained in:
Panu Matilainen 2010-08-26 12:21:33 +03:00
parent e38efea49c
commit d010ec1c90
5 changed files with 1 additions and 11 deletions

View File

@ -2164,9 +2164,6 @@ int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test)
const char *a; const char *a;
headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName); headerPutString(pkg->header, RPMTAG_SOURCERPM, spec->sourceRpmName);
if (pkg->fileList == NULL)
continue;
nvr = headerGetAsString(pkg->header, RPMTAG_NVRA); nvr = headerGetAsString(pkg->header, RPMTAG_NVRA);
rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr); rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr);
free(nvr); free(nvr);

View File

@ -680,9 +680,6 @@ rpmRC packageBinaries(rpmSpec spec)
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
char *fn; char *fn;
if (pkg->fileList == NULL)
continue;
if ((rc = processScriptFiles(spec, pkg))) if ((rc = processScriptFiles(spec, pkg)))
return rc; return rc;

View File

@ -73,8 +73,6 @@ int parseFiles(rpmSpec spec)
} }
} }
pkg->fileList = newStringBuf();
if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) { if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
nextPart = PART_NONE; nextPart = PART_NONE;
} else if (rc < 0) { } else if (rc < 0) {

View File

@ -99,6 +99,7 @@ Package newPackage(rpmSpec spec)
p->header = headerNew(); p->header = headerNew();
p->autoProv = 1; p->autoProv = 1;
p->autoReq = 1; p->autoReq = 1;
p->fileList = newStringBuf();
if (spec->packages == NULL) { if (spec->packages == NULL) {
spec->packages = p; spec->packages = p;

View File

@ -12,6 +12,3 @@ BuildArch: noarch
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)