-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed as not planned
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: bug
Description
Description of the bug:
in 7.1.2 possible to use http_archive with url depend on current os/arch
in 7.2.0rc1 it fails with error
ERROR: Failed to load Starlark extension '@@host_platform//:constraints.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
- @@host_platform
This could either mean you have to add the '@@host_platform' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: Error computing the main repository mapping: cycles detected during computation of main repo mapping
How to fix this?
Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
==> BUILD.bazel <==
==> lib.bzl <==
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
def get_host_cpu():
cpu_constraint = "@platforms//cpu:"
for constraint in HOST_CONSTRAINTS:
if constraint.startswith(cpu_constraint):
return constraint[len(cpu_constraint):]
return
def get_host_os():
cpu_constraint = "@platforms//os:"
for constraint in HOST_CONSTRAINTS:
if constraint.startswith(cpu_constraint):
return constraint[len(cpu_constraint):]
return
def get_host_target():
return get_host_os() + "-" + get_host_cpu()
def packages():
http_archive(
name = "test",
url = "https://some.host/test/" + get_host_target(),
)
==> MODULE.bazel <==
==> WORKSPACE.bazel <==
load("lib.bzl", "packages")
packages()
Which operating system are you running Bazel on?
linux
What is the output of bazel info release?
7.2.0rc1
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
maybe bazelbuild/platforms#86
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
Metadata
Metadata
Assignees
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: bug