aboutsummaryrefslogtreecommitdiff
path: root/pw_env_setup
diff options
context:
space:
mode:
authorTed Pudlik <tpudlik@google.com>2022-02-05 01:48:56 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-02-07 23:54:01 +0000
commit390e81ba52260bc8977cbcf5920aa304c95ff8ec (patch)
tree3d8c69ced0a44bb3de4bc2a635bce417f89d7877 /pw_env_setup
parent7a7bd509ad16756c01962ea2de5a20d9d37855be (diff)
downloadpigweed-390e81ba52260bc8977cbcf5920aa304c95ff8ec.tar.gz
pw_doctor: Check if Bazel version is current
If the user's bazel version is not current, they will be prompted to re-run bootstrap after running `source activate.sh`. Note that this solves the problem moving forward, but in the short run will not help us: bazel package versions before 5.0.0.1 either don't have the .versions data field at all (4.0.0) or have it set in the incorrect location (5.0.0). So, only users who have bootstrapped since 5.0.0.1 was made the current version on 2022-02-04 will be warned if their bazel is out of date. Tested: Manually, by editing bazel.json to specify a different version. Upon running `pw doctor`, I then got the expected `ERR CIPD package pigweed/third_party/bazel/linux-amd64 is out of date, please rerun bootstrap`. Without the edit, `pw doctor` passes. Bug: 623 Change-Id: I7a4c33116b246f01f3e402bc29a246286e3cc0e4 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/83084 Reviewed-by: Rob Mohr <mohrr@google.com> Commit-Queue: Ted Pudlik <tpudlik@google.com>
Diffstat (limited to 'pw_env_setup')
-rwxr-xr-xpw_env_setup/py/pw_env_setup/cipd_setup/update.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pw_env_setup/py/pw_env_setup/cipd_setup/update.py b/pw_env_setup/py/pw_env_setup/cipd_setup/update.py
index 380ff5742..f5f544e11 100755
--- a/pw_env_setup/py/pw_env_setup/cipd_setup/update.py
+++ b/pw_env_setup/py/pw_env_setup/cipd_setup/update.py
@@ -221,6 +221,17 @@ def write_ensure_file(package_file, ensure_file):
outs.write('{} {}\n'.format(pkg['path'], ' '.join(pkg['tags'])))
+def package_installation_path(root_install_dir, package_file):
+ """Returns the package installation path.
+
+ Args:
+ root_install_dir: The CIPD installation directory.
+ package_file: The path to the .json package definition file.
+ """
+ return os.path.join(root_install_dir,
+ os.path.basename(os.path.splitext(package_file)[0]))
+
+
def update(
cipd,
package_files,
@@ -262,9 +273,7 @@ def update(
os.path.splitext(package_file)[0] + '.ensure'))
write_ensure_file(package_file, ensure_file)
- install_dir = os.path.join(
- root_install_dir,
- os.path.basename(os.path.splitext(package_file)[0]))
+ install_dir = package_installation_path(root_install_dir, package_file)
name = os.path.basename(install_dir)