diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 40 | ||||
-rw-r--r-- | build/parseFiles.c | 16 | ||||
-rw-r--r-- | build/rpmspec.h | 2 | ||||
-rw-r--r-- | build/spec.c | 2 |
4 files changed, 28 insertions, 32 deletions
diff --git a/build/files.c b/build/files.c index 98abedd25..dfbd6757f 100644 --- a/build/files.c +++ b/build/files.c @@ -1744,35 +1744,33 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg, if (pkg->fileFile) { char *ffn; + ARGV_t filelists; FILE *fd; - /* XXX W2DO? urlPath might be useful here. */ - if (*pkg->fileFile == '/') { - ffn = rpmGetPath(pkg->fileFile, NULL); - } else { - /* XXX FIXME: add %{buildsubdir} */ + argvSplit(&filelists, getStringBuf(pkg->fileFile), "\n"); + for (fp = filelists; *fp != NULL; fp++) { ffn = rpmGetPath("%{_builddir}/", (spec->buildSubdir ? spec->buildSubdir : "") , - "/", pkg->fileFile, NULL); - } - fd = fopen(ffn, "r"); - - if (fd == NULL || ferror(fd)) { - rpmlog(RPMLOG_ERR, _("Could not open %%files file %s: %m\n"), ffn); - return RPMRC_FAIL; - } - ffn = _free(ffn); + "/", *fp, NULL); + fd = fopen(ffn, "r"); - while (fgets(buf, sizeof(buf), fd)) { - handleComments(buf); - if (expandMacros(spec, spec->macros, buf, sizeof(buf))) { - rpmlog(RPMLOG_ERR, _("line: %s\n"), buf); - fclose(fd); + if (fd == NULL || ferror(fd)) { + rpmlog(RPMLOG_ERR, _("Could not open %%files file %s: %m\n"), ffn); return RPMRC_FAIL; } - appendStringBuf(pkg->fileList, buf); + ffn = _free(ffn); + + while (fgets(buf, sizeof(buf), fd)) { + handleComments(buf); + if (expandMacros(spec, spec->macros, buf, sizeof(buf))) { + rpmlog(RPMLOG_ERR, _("line: %s\n"), buf); + fclose(fd); + return RPMRC_FAIL; + } + appendStringBuf(pkg->fileList, buf); + } + (void) fclose(fd); } - (void) fclose(fd); } /* Init the file list structure */ diff --git a/build/parseFiles.c b/build/parseFiles.c index 96e642936..b6ceb4cb1 100644 --- a/build/parseFiles.c +++ b/build/parseFiles.c @@ -65,15 +65,13 @@ int parseFiles(rpmSpec spec) goto exit; } - if (pkg->fileList != NULL) { - rpmlog(RPMLOG_ERR, _("line %d: Second %%files list\n"), - spec->lineNum); - goto exit; - } - - if (file) { - /* XXX not necessary as readline has expanded already, but won't hurt. */ - pkg->fileFile = rpmGetPath(file, NULL); + for (arg=1; arg<argc; arg++) { + if (!strcmp(argv[arg], "-f") && argv[arg+1]) { + file = rpmGetPath(argv[arg+1], NULL); + if (!pkg->fileFile) pkg->fileFile = newStringBuf(); + appendLineStringBuf(pkg->fileFile, file); + free(file); + } } pkg->fileList = newStringBuf(); diff --git a/build/rpmspec.h b/build/rpmspec.h index 3b115f670..eb9411875 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -169,7 +169,7 @@ struct Package_s { struct TriggerFileEntry * triggerFiles; - char * fileFile; + StringBuf fileFile; StringBuf fileList; /* If NULL, package will not be written */ Package next; diff --git a/build/spec.c b/build/spec.c index 76b22a28d..ca9710761 100644 --- a/build/spec.c +++ b/build/spec.c @@ -157,7 +157,7 @@ Package freePackage(Package pkg) pkg->header = headerFree(pkg->header); pkg->ds = rpmdsFree(pkg->ds); pkg->fileList = freeStringBuf(pkg->fileList); - pkg->fileFile = _free(pkg->fileFile); + pkg->fileFile = freeStringBuf(pkg->fileFile); if (pkg->cpioList) { rpmfi fi = pkg->cpioList; pkg->cpioList = NULL; |