Skip to content

Commit 557b4de

Browse files
authored
Don't consider system buck2 (#12245)
### Summary What are the benefits of looking for the system buck2? * I'm guessing only Meta engineers have buck2 pre-installed, and the internal version doesn't work with ET — it fails looking for a `.buck2` file * If someone really wants to use their system buck2, they can use the BUCK2 cmake arg ### Test plan CI cc @larryliu0820
1 parent c778063 commit 557b4de

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

tools/cmake/resolve_buck.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ def parse_args() -> argparse.Namespace:
101101
def resolve_buck2(args: argparse.Namespace) -> Union[str, int]:
102102
# Find buck2, in order of priority:
103103
# 1) Explicit buck2 argument.
104-
# 2) System buck2 (if correct version).
105-
# 3) Cached buck2 (previously downloaded).
104+
# 2) Cached buck2 (previously downloaded).
106105
# 3) Download buck2.
107106

108107
# Read the target version (build date) from the CI pin file. Note that
@@ -160,26 +159,19 @@ def resolve_buck2(args: argparse.Namespace) -> Union[str, int]:
160159
# such as a failed import, which exits with 1.
161160
return 2
162161
else:
163-
# Look for system buck2 and check version. Note that this can return
164-
# None.
165-
ver = buck_util.get_buck2_version("buck2")
166-
if ver == BUCK_TARGET_VERSION:
167-
# Use system buck2.
168-
return "buck2"
169-
else:
170-
# Download buck2 or used previously cached download.
171-
cache_dir = Path(args.cache_dir)
172-
os.makedirs(cache_dir, exist_ok=True)
162+
# Download buck2 or used previously cached download.
163+
cache_dir = Path(args.cache_dir)
164+
os.makedirs(cache_dir, exist_ok=True)
173165

174-
buck2_local_path = (
175-
(cache_dir / f"buck2-{BUCK_TARGET_VERSION}").absolute().as_posix()
176-
)
166+
buck2_local_path = (
167+
(cache_dir / f"buck2-{BUCK_TARGET_VERSION}").absolute().as_posix()
168+
)
177169

178-
# Check for a previously cached buck2 binary. The filename includes
179-
# the version hash, so we don't have to worry about using an
180-
# outdated binary, in the event that the target version is updated.
181-
if os.path.isfile(buck2_local_path):
182-
return buck2_local_path
170+
# Check for a previously cached buck2 binary. The filename includes
171+
# the version hash, so we don't have to worry about using an
172+
# outdated binary, in the event that the target version is updated.
173+
if os.path.isfile(buck2_local_path):
174+
return buck2_local_path
183175

184176
buck2_archive_url = f"https://github.com/facebook/buck2/releases/download/{target_buck_version}/{buck_info.archive_name}"
185177

0 commit comments

Comments
 (0)