diff options
author | 2023-01-09 10:20:17 -0800 | |
---|---|---|
committer | 2023-01-09 10:25:10 -0800 | |
commit | 461eeabd758f45685491cb25b9e6770577734939 (patch) | |
tree | d2fefe7aabd77c33f789bdf63c26cc1362d9720f /build.py | |
parent | 01d19e52ad385b871a7ad6a432327f37644dd4ff (diff) |
floss: Pin platform2 commit in build.py
Pin the platform2 repo to a certain commit in build.py and add a missing
default USE flag required by common-mk. We only depend on common-mk for
building so pinning is fine for this repo only.
Bug: 264776587
Tag: #floss
Test: ./floss/build/build-in-podman.py
Change-Id: I1e274473eb756a9ceac078e10ae7f48cd6f0bd05
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -43,6 +43,7 @@ COMMON_MK_USES = [ 'asan', 'coverage', 'cros_host', + 'cros_debug', 'fuzzer', 'fuzzer', 'msan', @@ -52,6 +53,9 @@ COMMON_MK_USES = [ 'ubsan', ] +# Use a specific commit version for common-mk to avoid build surprises. +COMMON_MK_COMMIT = "136c3e114b65f2c6c5f026376c2e75c73c2478a3" + # Default use flags. USE_DEFAULTS = { 'android': False, @@ -82,10 +86,12 @@ HOST_TESTS = [ # 'net_test_btpackets', ] +# Map of git repos to bootstrap and what commit to check them out at. None +# values will just checkout to HEAD. BOOTSTRAP_GIT_REPOS = { - 'platform2': 'https://chromium.googlesource.com/chromiumos/platform2', - 'rust_crates': 'https://chromium.googlesource.com/chromiumos/third_party/rust_crates', - 'proto_logging': 'https://android.googlesource.com/platform/frameworks/proto_logging' + 'platform2': ('https://chromium.googlesource.com/chromiumos/platform2', COMMON_MK_COMMIT), + 'rust_crates': ('https://chromium.googlesource.com/chromiumos/third_party/rust_crates', None), + 'proto_logging': ('https://android.googlesource.com/platform/frameworks/proto_logging', None), } # List of packages required for linux build @@ -625,9 +631,18 @@ class Bootstrap(): def _update_platform2(self): """Updates repositories used for build.""" - for repo in BOOTSTRAP_GIT_REPOS.keys(): - cwd = os.path.join(self.git_dir, repo) - subprocess.check_call(['git', 'pull'], cwd=cwd) + for project in BOOTSTRAP_GIT_REPOS.keys(): + cwd = os.path.join(self.git_dir, project) + (repo, commit) = BOOTSTRAP_GIT_REPOS[project] + + # Update to required commit when necessary or pull the latest code. + if commit: + head = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=cwd).strip() + if head != commit: + subprocess.check_call(['git', 'fetch'], cwd=cwd) + subprocess.check_call(['git', 'checkout', commit], cwd=cwd) + else: + subprocess.check_call(['git', 'pull'], cwd=cwd) def _setup_platform2(self): """ Set up platform2. @@ -645,8 +660,12 @@ class Bootstrap(): self._update_platform2() else: # Check out all repos in git directory - for repo in BOOTSTRAP_GIT_REPOS.values(): - subprocess.check_call(['git', 'clone', repo], cwd=self.git_dir) + for project in BOOTSTRAP_GIT_REPOS.keys(): + (repo, commit) = BOOTSTRAP_GIT_REPOS[project] + subprocess.check_call(['git', 'clone', repo, project], cwd=self.git_dir) + # Pin to commit. + if commit: + subprocess.check_call(['git', 'checkout', commit], cwd=os.path.join(self.git_dir, project)) # Symlink things symlinks = [ |