Warn on empty %files -f manifest files

- While there's nothing wrong with packages with no files, a manifest
  file with no files is likely to be an error or mistake of some
  sort and seems worth issuing a warning at least.
- Related to / inspired by ticket #870.
This commit is contained in:
Panu Matilainen 2014-02-18 12:49:39 +02:00
parent 2bcdeae52e
commit e7a6088093
1 changed files with 7 additions and 1 deletions

View File

@ -1589,6 +1589,7 @@ static rpmRC readFilesManifest(rpmSpec spec, Package pkg, const char *path)
char *fn, buf[BUFSIZ];
FILE *fd = NULL;
rpmRC rc = RPMRC_FAIL;
unsigned int nlines = 0;
if (*path == '/') {
fn = rpmGetPath(path, NULL);
@ -1604,14 +1605,19 @@ static rpmRC readFilesManifest(rpmSpec spec, Package pkg, const char *path)
}
while (fgets(buf, sizeof(buf), fd)) {
handleComments(buf);
if (handleComments(buf))
continue;
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmlog(RPMLOG_ERR, _("line: %s\n"), buf);
goto exit;
}
argvAdd(&(pkg->fileList), buf);
nlines++;
}
if (nlines == 0)
rpmlog(RPMLOG_WARNING, _("Empty %%files file %s\n"), fn);
if (ferror(fd))
rpmlog(RPMLOG_ERR, _("Error reading %%files file %s: %m\n"), fn);
else