Use RPMMACRO_LITERAL/ME_LITERAL when defining some macros

It is used for setting __file_name, __file_lineno, buildsubdir.
We also use it for unmasking %license in the %files section.
This commit is contained in:
Michael Schroeder 2020-02-07 11:22:35 +01:00 committed by Panu Matilainen
parent cc66df4fa1
commit 490c70d43c
5 changed files with 8 additions and 8 deletions

View File

@ -2234,7 +2234,7 @@ int readManifest(rpmSpec spec, const char *path, const char *descr, int flags,
goto exit;
}
rpmPushMacro(spec->macros, "__file_name", NULL, fn, RMIL_SPEC);
rpmPushMacroFlags(spec->macros, "__file_name", NULL, fn, RMIL_SPEC, RPMMACRO_LITERAL);
nlines = 0;
while (fgets(buf, sizeof(buf), fd)) {
@ -2279,7 +2279,7 @@ static rpmRC readFilesManifest(rpmSpec spec, Package pkg, const char *path)
flags |= ALLOW_EMPTY;
/* XXX unmask %license while parsing files manifest*/
rpmPushMacro(spec->macros, "license", NULL, "%%license", RMIL_SPEC);
rpmPushMacroFlags(spec->macros, "license", NULL, "%license", RMIL_SPEC, RPMMACRO_LITERAL);
nlines = readManifest(spec, path, "%files", flags, &(pkg->fileList), NULL);

View File

@ -27,7 +27,7 @@ int parseFiles(rpmSpec spec)
};
/* XXX unmask %license while parsing %files */
rpmPushMacro(spec->macros, "license", NULL, "%%license", RMIL_SPEC);
rpmPushMacroFlags(spec->macros, "license", NULL, "%license", RMIL_SPEC, RPMMACRO_LITERAL);
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %%files: %s\n"),

View File

@ -302,7 +302,7 @@ static int doSetupMacro(rpmSpec spec, const char *line)
headerGetString(spec->packages->header, RPMTAG_NAME),
headerGetString(spec->packages->header, RPMTAG_VERSION));
}
rpmPushMacro(spec->macros, "buildsubdir", NULL, spec->buildSubdir, RMIL_SPEC);
rpmPushMacroFlags(spec->macros, "buildsubdir", NULL, spec->buildSubdir, RMIL_SPEC, RPMMACRO_LITERAL);
/* cd to the build dir */
{ char * buildDir = rpmGenPath(spec->rootDir, "%{_builddir}", "");

View File

@ -144,7 +144,7 @@ static OFI_t * pushOFI(rpmSpec spec, const char *fn)
ofi->readPtr = NULL;
ofi->next = spec->fileStack;
rpmPushMacro(spec->macros, "__file_name", NULL, fn, RMIL_SPEC);
rpmPushMacroFlags(spec->macros, "__file_name", NULL, fn, RMIL_SPEC, RPMMACRO_LITERAL);
spec->fileStack = ofi;
return spec->fileStack;
@ -202,7 +202,7 @@ int specExpand(rpmSpec spec, int lineno, const char *sbuf,
int rc;
snprintf(lnobuf, sizeof(lnobuf), "%d", lineno);
rpmPushMacro(spec->macros, "__file_lineno", NULL, lnobuf, RMIL_SPEC);
rpmPushMacroFlags(spec->macros, "__file_lineno", NULL, lnobuf, RMIL_SPEC, RPMMACRO_LITERAL);
rc = (rpmExpandMacros(spec->macros, sbuf, obuf, 0) < 0);

View File

@ -1696,7 +1696,7 @@ static int loadMacroFile(rpmMacroContext mc, const char * fn)
if (fd == NULL)
goto exit;
pushMacro(mc, "__file_name", NULL, fn, RMIL_MACROFILES, ME_NONE);
pushMacro(mc, "__file_name", NULL, fn, RMIL_MACROFILES, ME_LITERAL);
buf[0] = '\0';
while ((nlines = rdcl(buf, blen, fd)) > 0) {
@ -1712,7 +1712,7 @@ static int loadMacroFile(rpmMacroContext mc, const char * fn)
n++; /* skip % */
snprintf(lnobuf, sizeof(lnobuf), "%d", lineno);
pushMacro(mc, "__file_lineno", NULL, lnobuf, RMIL_MACROFILES, ME_NONE);
pushMacro(mc, "__file_lineno", NULL, lnobuf, RMIL_MACROFILES, ME_LITERAL);
if (defineMacro(mc, n, RMIL_MACROFILES))
nfailed++;
popMacro(mc, "__file_lineno");