Bug 1680862 - Use fixed cwd in old.configure for m4 includes r=mhentges

js/src/aclocal.m4 contains includes starting with `../../`.
As explained in https://bugzilla.mozilla.org/show_bug.cgi?id=1680862#c8,
m4 will first try to resolve this path relative to the working directory
and only if that path doesn't exists, fall back to the location set by
`localdir` (from `-I`).

The working directory is usually MOZ_OBJDIR, an immediate subdirectory
of topsrcdir, so `../../` resolves to a location outside of topsrcdir.
Usually, that path does not exist, and m4 falls back to `localdir` that
was passed via `-I`.

But if that path existed and is incompatible with the current Gecko
checkout, then the build will fail (see bug report). To prevent this
from happening, this patch fixes the working directory to `localdir`,
so that m4 will immediately find the expected file.

Differential Revision: https://phabricator.services.mozilla.com/D101500
This commit is contained in:
Rob Wu 2021-01-14 18:15:12 +00:00
parent f108cdcd91
commit 2506b7584c

View File

@ -215,6 +215,10 @@ def old_configure_for(old_configure_path, extra_env=None):
"--localdir=%s" % os.path.dirname(old_configure),
old_configure + ".in",
],
# Fix the working directory, so that when m4 is called, that
# includes of relative paths are deterministically resolved
# relative to the directory containing old-configure.
cwd=os.path.dirname(old_configure),
env=env,
)
except CalledProcessError as exc: