From 998f8e67e2e66525128ebb99a92d9828a5ee37ac Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Tue, 22 Oct 2024 16:34:55 -0700 Subject: [PATCH 1/5] tests: use rules_cc 0.0.13 for ignore_root_user_error test This is so that the test works with Bazel@head --- tests/integration/ignore_root_user_error/WORKSPACE | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/integration/ignore_root_user_error/WORKSPACE b/tests/integration/ignore_root_user_error/WORKSPACE index c21b01e1bc..47f30ba032 100644 --- a/tests/integration/ignore_root_user_error/WORKSPACE +++ b/tests/integration/ignore_root_user_error/WORKSPACE @@ -1,3 +1,12 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "rules_cc", + sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80", + strip_prefix = "rules_cc-0.0.13", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"], +) + local_repository( name = "rules_python", path = "../../..", @@ -13,8 +22,6 @@ python_register_toolchains( python_version = "3.9", ) -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - http_archive( name = "bazel_skylib", sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d", From a0c57398de2b4ceb6e9e248a9882e5db429d7751 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Tue, 22 Oct 2024 20:31:20 -0700 Subject: [PATCH 2/5] add protobuf to workspace --- tests/integration/ignore_root_user_error/WORKSPACE | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/integration/ignore_root_user_error/WORKSPACE b/tests/integration/ignore_root_user_error/WORKSPACE index 47f30ba032..a1aa5b5009 100644 --- a/tests/integration/ignore_root_user_error/WORKSPACE +++ b/tests/integration/ignore_root_user_error/WORKSPACE @@ -1,5 +1,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "protobuf", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", +) + http_archive( name = "rules_cc", sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80", From 2dca754d4a5bbb88a4afb252b6edb573bb495979 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Tue, 22 Oct 2024 20:39:24 -0700 Subject: [PATCH 3/5] allow empty headers/libs --- python/private/local_runtime_repo_setup.bzl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/python/private/local_runtime_repo_setup.bzl b/python/private/local_runtime_repo_setup.bzl index 23fa99dfa9..3fa484e7c7 100644 --- a/python/private/local_runtime_repo_setup.bzl +++ b/python/private/local_runtime_repo_setup.bzl @@ -61,7 +61,11 @@ def define_local_runtime_toolchain_impl( cc_library( name = "_python_headers", # NOTE: Keep in sync with watch_tree() called in local_runtime_repo - srcs = native.glob(["include/**/*.h"]), + srcs = native.glob( + ["include/**/*.h"], + # A Python install may not have C headers + allow_empty = True, + ), includes = ["include"], ) @@ -69,10 +73,14 @@ def define_local_runtime_toolchain_impl( name = "_libpython", # Don't use a recursive glob because the lib/ directory usually contains # a subdirectory of the stdlib -- lots of unrelated files - srcs = native.glob([ - "lib/*{}".format(lib_ext), # Match libpython*.so - "lib/*{}*".format(lib_ext), # Also match libpython*.so.1.0 - ]), + srcs = native.glob( + [ + "lib/*{}".format(lib_ext), # Match libpython*.so + "lib/*{}*".format(lib_ext), # Also match libpython*.so.1.0 + ], + # A Python install may not have shared libraries. + allow_empty = True, + ), hdrs = [":_python_headers"], ) From 1dd8ad2f6df13029a095401248a5c48c739519d5 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Tue, 22 Oct 2024 20:50:31 -0700 Subject: [PATCH 4/5] compile pip integration test with rolling --- .../compile_pip_requirements/WORKSPACE | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/integration/compile_pip_requirements/WORKSPACE b/tests/integration/compile_pip_requirements/WORKSPACE index 0eeab2067c..fdd6b1da75 100644 --- a/tests/integration/compile_pip_requirements/WORKSPACE +++ b/tests/integration/compile_pip_requirements/WORKSPACE @@ -1,3 +1,19 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "protobuf", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", +) + +http_archive( + name = "rules_cc", + sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80", + strip_prefix = "rules_cc-0.0.13", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"], +) + local_repository( name = "rules_python", path = "../../..", From b41f83978b6ebc99c7ede3a4d352b52712c34f4a Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Tue, 22 Oct 2024 20:57:27 -0700 Subject: [PATCH 5/5] update pip_parse, py_cc_toolchain integration tests --- tests/integration/pip_parse/WORKSPACE | 16 ++++++++++++++++ .../py_cc_toolchain_registered/WORKSPACE | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/tests/integration/pip_parse/WORKSPACE b/tests/integration/pip_parse/WORKSPACE index db0cd0c7c8..e22fbedca2 100644 --- a/tests/integration/pip_parse/WORKSPACE +++ b/tests/integration/pip_parse/WORKSPACE @@ -1,3 +1,19 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "protobuf", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", +) + +http_archive( + name = "rules_cc", + sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80", + strip_prefix = "rules_cc-0.0.13", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"], +) + local_repository( name = "rules_python", path = "../../..", diff --git a/tests/integration/py_cc_toolchain_registered/WORKSPACE b/tests/integration/py_cc_toolchain_registered/WORKSPACE index de908549c0..b9d9f0f560 100644 --- a/tests/integration/py_cc_toolchain_registered/WORKSPACE +++ b/tests/integration/py_cc_toolchain_registered/WORKSPACE @@ -1,3 +1,19 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "protobuf", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", +) + +http_archive( + name = "rules_cc", + sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80", + strip_prefix = "rules_cc-0.0.13", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"], +) + local_repository( name = "rules_python", path = "../../..",