Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ single_version_override(
patch_strip = 1,
patches = [
"//patches/rules_python:single_import_lib.patch",
"//patches/rules_python:install_name_tool.patch",
"//patches/rules_python:lock_extension.patch",
],
version = "2.4.6",
Expand Down
10 changes: 5 additions & 5 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ The Version column is generated from `MODULE.bazel`, and every patch it applies
| `rules_swift` | 4.2.2 | `windows_swift_testing.patch` | Root only. The Windows toolchain puts the Swift Testing module and import library directories on the compile and link paths |
| `rules_swift` | 4.2.2 | `windows_unknown_vendor.patch` | Root only. Windows target triples use the `unknown` vendor |
| `rules_python` | 2.4.6 | `single_import_lib.patch` | `py_extension` on Windows links one CPython import library: the stable ABI one for limited API modules, else the versioned one. It passed both as one linker argument (bazel-contrib/rules_python#4426; drop when a rules_python release has it). Consumer fix: #11418 |
| `rules_python` | 2.4.6 | `install_name_tool.patch` | Root only. The macOS `python_repository` skips the LC_ID_DYLIB fixup, which needs `install_name_tool` on PATH, when `libpython` already names itself `@rpath/` |
| `rules_python` | 2.4.6 | `lock_extension.patch` | Root only. The `python` extension is OS and architecture dependent and not reproducible, so a lockfile written on one host does not pin another |
| `rules_py` | 2.0.0-alpha.11 | `py_cc_toolchain_platform.patch` | `py_cc_toolchain` picks the cc toolchain for the target platform. Consumer fix: #11398 |
| `rules_py` | 2.0.0-alpha.11 | `native_sdist_toolchain_flags.patch` | Native sdist builds get the cc toolchain flags (aspect-build/rules_py#1664). Consumer fix: #11398 |
| `rules_py` | 2.0.0-alpha.11 | `pep517_msvc.patch` | PEP 517 builds find the MSVC toolchain on Windows (aspect-build/rules_py#1662). Consumer fix: #11398 |
| `rules_py` | 2.0.0-alpha.11 | `venv_bin_files.patch` | The runtime sets `venv_bin_files`, so `java_binary` analyzes on Windows; there the venv's `python.exe` and DLLs are file symlinks and wheels join `sys.path` through `.pth` lines, so the launcher does not hit `CreateProcess failed` and wheel imports resolve (aspect-build/rules_py#1670). Consumer fix: #11398 |
| `rules_py` | 2.0.0-alpha.11 | `host_interpreter_windows_arm64.patch` | rules_py can see its `python_3_13_aarch64_pc_windows_msvc` interpreter, so sdist builds load on Windows ARM64 hosts (aspect-build/rules_py#1676). Consumer fix: #11398 |
| `rules_py` | 2.0.0-alpha.11 | `external_repo_pytest_paths.patch` | `py_pytest_main` finds `.pytest_paths` for targets in an external repository under `../<repo>/<package>`. Consumer fix: #11398 |
| `rules_py` | 2.0.0-alpha.11 | `host_libc_glibc.patch` | The uv host repo reports glibc 2.28 on Linux without running `ldd`, so it fetches where no host `ldd` is on PATH. Consumer fix: #12482 |
| `rules_py` | 2.0.0-alpha.11 | `host_libc_glibc.patch` | The uv host repo reports glibc 2.28 on Linux without running `ldd` and libsystem 14.0 on macOS without running `sw_vers`, so it fetches where neither is on PATH. Consumer fix: #12482 |
| `rules_py` | 2.0.0-alpha.11 | `win32_x86_32.patch` | The `win32` wheel tag matches `@platforms//cpu:x86_32`, so x86_64 Windows selects the `win_amd64` wheel. Consumer fix: #12277 |
| `hermetic_launcher` | 0.0.17 | `windows_arm64_toolchains.patch` | Registers template and finalizer toolchains for the prebuilt aarch64 Windows stubs (hermeticbuild/hermetic-launcher#94). Consumer fix: #11416 |
| `avro-cpp` | 1.12.0.bcr.1 | `iterator.patch` | Missing std includes (`<iterator>`, `<memory>`, `<vector>`) with libc++, added to the headers that use them; `Exception.hh` includes `fmt/format.h` for fmt 12. Consumer fix: #6592 |
Expand Down
10 changes: 6 additions & 4 deletions patches/rules_py/host_libc_glibc.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
--- a/uv/private/host/repository.bzl
+++ b/uv/private/host/repository.bzl
@@ -25,35 +25,9 @@
@@ -23,38 +23,10 @@
os = _translate_os(rctx.os.name)

if os == "osx":
- res = rctx.execute(["sw_vers", "-productVersion"])
+ res = rctx.execute(["/usr/bin/sw_vers", "-productVersion"])
ver = res.stdout.strip().split(".")
return "libsystem", "{}.{}".format(ver[0], ver[1])
- ver = res.stdout.strip().split(".")
- return "libsystem", "{}.{}".format(ver[0], ver[1])
+ return "libsystem", "14.0"

elif os == "linux":
- res = rctx.execute(["ldd", "--version"])
Expand Down
1 change: 1 addition & 0 deletions patches/rules_python/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@rules_dx//core/quality:fixtures.bzl", "real_source_target")

exports_files([
"install_name_tool.patch",
"lock_extension.patch",
"single_import_lib.patch",
])
Expand Down
22 changes: 22 additions & 0 deletions patches/rules_python/install_name_tool.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- a/python/private/python_repository.bzl
+++ b/python/private/python_repository.bzl
@@ -215,12 +215,13 @@
# it appears in the Bazel workspace as its LC_ID_DYLIB using
# the `install_name_tool` bundled with macOS.
dylib = "libpython{}.dylib".format(python_short_version)
- repo_utils.execute_checked(
- rctx,
- op = "python_repository.FixUpDyldIdPath",
- arguments = [repo_utils.which_checked(rctx, "install_name_tool"), "-id", "@rpath/{}".format(dylib), "lib/{}".format(dylib)],
- logger = logger,
- )
+ if "@rpath/{}".format(dylib) not in rctx.read("lib/{}".format(dylib)):
+ repo_utils.execute_checked(
+ rctx,
+ op = "python_repository.FixUpDyldIdPath",
+ arguments = [repo_utils.which_checked(rctx, "install_name_tool"), "-id", "@rpath/{}".format(dylib), "lib/{}".format(dylib)],
+ logger = logger,
+ )

_create_pycache_symlinks(rctx, logger)
python_bin = "python.exe" if ("windows" in platform) else "bin/python3"
12 changes: 10 additions & 2 deletions tools/testing/hermetic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ pub fn miss_marker(os: &str) -> &'static str {
}
}

/// The bash Bazel's repository rules run `patch_cmds` with.
pub const UNIX_BAZEL_SH: &str = "BAZEL_SH=/bin/bash";

/// The arguments before the command a Unix probe records: `env -i`, its variables, `sh -c SCRIPT` and the workspace.
const UNIX_ENV_PREFIX: usize = 11;

pub const HOME_RC: &str = "build --action_env=DX_HOME_CONFIG=present\n";

pub const LEAKS_PACKAGE: &str = "dx_hermetic_leaks";
Expand Down Expand Up @@ -1401,6 +1407,7 @@ impl Session {
format!("PATH={}", self.applets.display()),
format!("BAZELISK_HOME={}", self.bazelisk_home.display()),
format!("XDG_CACHE_HOME={}", cache_home(probe.output_root).display()),
UNIX_BAZEL_SH.to_owned(),
"/bin/sh".to_owned(),
"-c".to_owned(),
"cd \"$0\" && \"$@\"; rc=$?; \"$1\" \"$2\" \"$3\" \"$4\" shutdown >/dev/null 2>&1; exit $rc"
Expand Down Expand Up @@ -1518,6 +1525,7 @@ impl Session {
format!("PATH={}:{}", bin.display(), self.applets.display()),
format!("BAZELISK_HOME={}", self.bazelisk_home.display()),
format!("XDG_CACHE_HOME={}", cache_home(output_root).display()),
UNIX_BAZEL_SH.to_owned(),
"/bin/sh".to_owned(),
"-c".to_owned(),
"cd \"$0\" && \"$@\"; rc=$?; bazel --max_idle_secs=60 shutdown >/dev/null 2>&1; exit $rc"
Expand All @@ -1526,7 +1534,7 @@ impl Session {
self.manifest.dx.to_string_lossy().into_owned(),
];
invocation.extend(args);
let recorded = invocation.get(10..).unwrap_or_default().to_vec();
let recorded = invocation.get(UNIX_ENV_PREFIX..).unwrap_or_default().to_vec();
// Lint exits 1 when it reports findings, which the manifest then compares.
let expect = if command == "lint" {
Expect::Findings
Expand Down Expand Up @@ -1569,7 +1577,7 @@ impl Session {
});
}
let argv = self.bazel_argv(probe);
let recorded = argv.get(10..).unwrap_or_default().to_vec();
let recorded = argv.get(UNIX_ENV_PREFIX..).unwrap_or_default().to_vec();
self.execute(Exec {
name: &probe.name,
net: probe.net,
Expand Down
7 changes: 4 additions & 3 deletions tools/testing/hermetic/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,14 +1137,15 @@ fn check_windows_sh_rejects_the_wsl_stub_and_an_empty_path() {
fn bazel_argv_pins_startup_and_build_flags_before_the_targets() {
let argv = fixture_session().bazel_argv(&fixture_probe());
assert_eq!(
argv[..6],
argv[..7],
[
"/usr/bin/env",
"-i",
"HOME=/q/home",
"PATH=/q/applets",
"BAZELISK_HOME=/q/bazelisk",
"XDG_CACHE_HOME=/q/cold_cache",
"BAZEL_SH=/bin/bash",
]
);
let gc_size = format!(
Expand All @@ -1156,7 +1157,7 @@ fn bazel_argv_pins_startup_and_build_flags_before_the_targets() {
dx_process::DISK_CACHE_GC_MAX_AGE
);
assert_eq!(
argv[9..],
argv[10..],
[
"/q/consumer ws",
"/q/bin/bazelisk",
Expand All @@ -1180,7 +1181,7 @@ fn bazel_argv_pins_startup_and_build_flags_before_the_targets() {
"//...",
]
);
assert!(argv[8].contains("shutdown"), "{}", argv[8]);
assert!(argv[9].contains("shutdown"), "{}", argv[9]);
}

#[test]
Expand Down
Loading