Commit 4a9c487d authored by Wez Furlong's avatar Wez Furlong Committed by Facebook Github Bot

watchman: pass version info down to watchman build via environment

Summary:
This diff allows passing a watchman version number override
via the environment as well as via the cmake `WATCHMAN_VERSION_OVERRIDE`
option.

To help invalidate the build I've added a new section to the manifest
files that allows listing out additional env vars that the project
hashes should be sensitive to.  The effect of this is that we'll
re-run the cmake configure step if the listed env vars are changed.

Reviewed By: Ben0mega

Differential Revision: D17865896

fbshipit-source-id: 8ea5572b0b9b7af95ec5c310e494cb17a139ced4
parent e009093f
...@@ -260,6 +260,8 @@ class ManifestLoader(object): ...@@ -260,6 +260,8 @@ class ManifestLoader(object):
No caching of the computation is performed, which is theoretically No caching of the computation is performed, which is theoretically
wasteful but the computation is fast enough that it is not required wasteful but the computation is fast enough that it is not required
to cache across multiple invocations. """ to cache across multiple invocations. """
ctx = self.ctx_gen.get_context(manifest.name)
hasher = hashlib.sha256() hasher = hashlib.sha256()
# Some environmental and configuration things matter # Some environmental and configuration things matter
env = {} env = {}
...@@ -272,6 +274,8 @@ class ManifestLoader(object): ...@@ -272,6 +274,8 @@ class ManifestLoader(object):
env[name] = os.environ.get(name) env[name] = os.environ.get(name)
for tool in ["cc", "c++", "gcc", "g++", "clang", "clang++"]: for tool in ["cc", "c++", "gcc", "g++", "clang", "clang++"]:
env["tool-%s" % tool] = path_search(os.environ, tool) env["tool-%s" % tool] = path_search(os.environ, tool)
for name in manifest.get_section_as_args("depends.environment", ctx):
env[name] = os.environ.get(name)
fetcher = self.create_fetcher(manifest) fetcher = self.create_fetcher(manifest)
env["fetcher.hash"] = fetcher.hash() env["fetcher.hash"] = fetcher.hash()
...@@ -282,7 +286,6 @@ class ManifestLoader(object): ...@@ -282,7 +286,6 @@ class ManifestLoader(object):
if value is not None: if value is not None:
hasher.update(value.encode("utf-8")) hasher.update(value.encode("utf-8"))
ctx = self.ctx_gen.get_context(manifest.name)
manifest.update_hash(hasher, ctx) manifest.update_hash(hasher, ctx)
dep_list = sorted(manifest.get_section_as_dict("dependencies", ctx).keys()) dep_list = sorted(manifest.get_section_as_dict("dependencies", ctx).keys())
......
...@@ -49,6 +49,7 @@ SCHEMA = { ...@@ -49,6 +49,7 @@ SCHEMA = {
}, },
}, },
"dependencies": {"optional_section": True, "allow_values": False}, "dependencies": {"optional_section": True, "allow_values": False},
"depends.environment": {"optional_section": True},
"git": { "git": {
"optional_section": True, "optional_section": True,
"fields": {"repo_url": REQUIRED, "rev": OPTIONAL, "depth": OPTIONAL}, "fields": {"repo_url": REQUIRED, "rev": OPTIONAL, "depth": OPTIONAL},
......
...@@ -34,3 +34,6 @@ ENABLE_EDEN_SUPPORT=ON ...@@ -34,3 +34,6 @@ ENABLE_EDEN_SUPPORT=ON
WATCHMAN_STATE_DIR=/opt/facebook/watchman/var/run/watchman WATCHMAN_STATE_DIR=/opt/facebook/watchman/var/run/watchman
# tell cmake not to try to create /opt/facebook/... # tell cmake not to try to create /opt/facebook/...
INSTALL_WATCHMAN_STATE_DIR=OFF INSTALL_WATCHMAN_STATE_DIR=OFF
[depends.environment]
WATCHMAN_VERSION_OVERRIDE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment