diff options
Diffstat (limited to 'build/parseFiles.c')
-rw-r--r-- | build/parseFiles.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/build/parseFiles.c b/build/parseFiles.c index ea0d6385f..5ccc94509 100644 --- a/build/parseFiles.c +++ b/build/parseFiles.c @@ -27,7 +27,7 @@ int parseFiles(rpmSpec spec) }; /* XXX unmask %license while parsing %files */ - addMacro(spec->macros, "license", NULL, "%%license", RMIL_SPEC); + rpmPushMacro(spec->macros, "license", NULL, "%%license", RMIL_SPEC); if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { rpmlog(RPMLOG_ERR, _("line %d: Error parsing %%files: %s\n"), @@ -61,10 +61,18 @@ int parseFiles(rpmSpec spec) } } - if (lookupPackage(spec, name, flag, &pkg)) { - rpmlog(RPMLOG_ERR, _("line %d: Package does not exist: %s\n"), - spec->lineNum, spec->line); + if (lookupPackage(spec, name, flag, &pkg)) goto exit; + + /* + * This should be an error, but its surprisingly commonly abused for the + * effect of multiple -f arguments in versions that dont support it. + * Warn but preserve behavior, except for leaking memory. + */ + if (pkg->fileList != NULL) { + rpmlog(RPMLOG_WARNING, _("line %d: multiple %%files for package '%s'\n"), + spec->lineNum, rpmstrPoolStr(pkg->pool, pkg->name)); + pkg->fileList = argvFree(pkg->fileList); } for (arg=1; arg<argc; arg++) { @@ -95,7 +103,7 @@ int parseFiles(rpmSpec spec) res = nextPart; exit: - delMacro(NULL, "license"); + rpmPopMacro(NULL, "license"); free(argv); poptFreeContext(optCon); |