(void) headerAddI18NString(pkg->header, tag, field, lang);
break;
case RPMTAG_BUILDROOT:
- SINGLE_TOKEN_ONLY;
- { char * buildRoot = NULL;
-
- /*
- * Note: rpmGenPath should guarantee a "canonical" path. That means
- * that the following pathologies should be weeded out:
- * //bin//sh
- * //usr//bin/
- * /.././../usr/../bin//./sh
- */
- if (spec->buildRoot == NULL) {
- buildRoot = rpmGenPath(NULL, "%{?buildroot:%{buildroot}}", NULL);
- if (strcmp(buildRoot, "/")) {
- spec->buildRoot = buildRoot;
- macro = NULL;
- } else {
- const char * specPath = field;
-
- buildRoot = _free(buildRoot);
- if (*field == '\0') field = "/";
- buildRoot = rpmGenPath(spec->rootDir, specPath, NULL);
- spec->buildRoot = buildRoot;
- field = (char *) buildRoot;
- }
- spec->gotBuildRoot = 1;
- } else {
- macro = NULL;
- }
- buildRoot = rpmGenPath(NULL, spec->buildRoot, NULL);
- if (*buildRoot == '\0') buildRoot = "/";
- if (!strcmp(buildRoot, "/")) {
- rpmlog(RPMLOG_ERR,
- _("BuildRoot can not be \"/\": %s\n"), spec->buildRoot);
- free(buildRoot);
- return RPMRC_FAIL;
- }
- free(buildRoot);
- } break;
+ /* just silently ignore BuildRoot */
+ macro = NULL;
+ break;
case RPMTAG_PREFIXES: {
struct rpmtd_s td;
const char *str;
}
}
- /* Do some final processing on the header */
- if (!spec->gotBuildRoot && spec->buildRoot) {
- rpmlog(RPMLOG_ERR, _("Spec file can't use BuildRoot\n"));
- goto exit;
- }
-
/* XXX Skip valid arch check if not building binary package */
if (!spec->anyarch && checkForValidArchitectures(spec)) {
goto exit;
/* Set up a new Spec structure with no packages. */
spec = newSpec();
- /*
- * Note: rpmGetPath should guarantee a "canonical" path. That means
- * that the following pathologies should be weeded out:
- * //bin//sh
- * //usr//bin/
- * /.././../usr/../bin//./sh (XXX FIXME: dots not handled yet)
- */
spec->specFile = rpmGetPath(specFile, NULL);
spec->fileStack = newOpenFileInfo();
spec->fileStack->fileName = xstrdup(spec->specFile);
+ /* If buildRoot not specified, use default %{buildroot} */
if (buildRoot) {
- if (*buildRoot == '\0') {
- rpmlog(RPMLOG_ERR, _("BuildRoot couldn't be empty\n"));
- goto errxit;
- }
- if (!strcmp(buildRoot, "/")) {
- rpmlog(RPMLOG_ERR, _("BuildRoot can not be \"/\"\n"));
- goto errxit;
- }
- spec->gotBuildRoot = 1;
spec->buildRoot = xstrdup(buildRoot);
- addMacro(spec->macros, "buildroot", NULL, buildRoot, RMIL_SPEC);
+ } else {
+ spec->buildRoot = rpmGetPath("%{?buildroot:%{buildroot}}", NULL);
+ }
+ addMacro(spec->macros, "buildroot", NULL, spec->buildRoot, RMIL_SPEC);
+ if (*spec->buildRoot == '\0') {
+ rpmlog(RPMLOG_ERR, _("BuildRoot couldn't be empty\n"));
+ goto errxit;
+ }
+ if (!strcmp(spec->buildRoot, "/")) {
+ rpmlog(RPMLOG_ERR, _("BuildRoot can not be \"/\"\n"));
+ goto errxit;
}
addMacro(NULL, "_docdir", NULL, "%{_defaultdocdir}", RMIL_SPEC);
spec->recursing = recursing;
int force;
int anyarch;
- int gotBuildRoot;
-
char * passPhrase;
int timeCheck;
char * cookie;
spec->sourceHeader = NULL;
spec->sourceCpioList = NULL;
- spec->gotBuildRoot = 0;
spec->buildRoot = NULL;
spec->buildSubdir = NULL;