Bazel: new versions, patches, conflicts, and java version contraints (#31402)

This commit is contained in:
Adam J. Stewart 2022-07-05 21:28:50 -07:00 committed by GitHub
parent 8037c91403
commit 8d1c723576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 107 additions and 47 deletions

View File

@ -0,0 +1,12 @@
diff -Naur a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc
--- a/src/main/cpp/blaze_util_posix.cc 1980-01-01 00:00:00.000000000 -0800
+++ b/src/main/cpp/blaze_util_posix.cc 2022-06-30 23:34:08.000000000 -0700
@@ -600,7 +600,7 @@
// Prefer OFD locks if available. POSIX locks can be lost "accidentally"
// due to any close() on the lock file, and are not reliably preserved
// across execve() on Linux, which we need for --batch mode.
- if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
+ if (fcntl(fd, F_SETLK, lock) == 0) return 0;
if (errno != EINVAL) {
if (errno != EACCES && errno != EAGAIN) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)

View File

@ -20,6 +20,14 @@ class Bazel(Package):
tags = ['build-tools']
version('5.2.0', sha256='820a94dbb14071ed6d8c266cf0c080ecb265a5eea65307579489c4662c2d582a')
version('5.1.1', sha256='7f5d3bc1d344692b2400f3765fd4b5c0b636eb4e7a8a7b17923095c7b56a4f78')
version('5.1.0', sha256='4de301f509fc6d0cbc697b2017384ecdc94df8f36245bbcbedc7ea6780acc9f5')
version('5.0.0', sha256='072dd62d237dbc11e0bac02e118d8c2db4d0ba3ba09f1a0eb1e2a460fb8419db')
version('4.2.2', sha256='9981d0d53a356c4e87962847750a97c9e8054e460854748006c80f0d7e2b2d33')
version('4.2.1', sha256='12ea7aa11e2bdb12de1dceb9939a22e96f5a480437cb17c123379d8e0fdf5e82')
version('4.2.0', sha256='74814b63920aaee47dbbbee7082e5c4317e4eebaf07e03c5fb5626e1716f1034')
version('4.1.0', sha256='f377d755c96a50f6bd2f423562598d822f43356783330a0b780ad442864d6eeb')
version('4.0.0', sha256='d350f80e70654932db252db380d2ec0144a00e86f8d9f2b4c799ffdb48e9cdd1')
version('3.7.2', sha256='de255bb42163a915312df9f4b86e5b874b46d9e8d4b72604b5123c3a845ed9b1')
version('3.7.1', sha256='c9244e5905df6b0190113e26082c72d58b56b1b0dec66d076f083ce4089b0307')
@ -113,14 +121,13 @@ class Bazel(Package):
variant('nodepfail', default=True, description='Disable failing dependency checks due to injected absolute paths - required for most builds using bazel with spack')
depends_on('java', type=('build', 'run'))
depends_on('java@11', when='@5.3:', type=('build', 'run'))
depends_on('java@8,11', when='@3.3:5.2', type=('build', 'run'))
depends_on('java@8', when='@0.6:3.2', type=('build', 'run'))
depends_on('java@7:8', when='@:0.5', type=('build', 'run'))
depends_on('python+pythoncmd', type=('build', 'run'))
depends_on('zip', when='platform=linux', type=('build', 'run'))
# make work on power9 (2x commits)
# https://github.com/bazelbuild/bazel/commit/5cff4f1edf8b95bf0612791632255852332f72b5
# https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0
patch('linux_ppc-0.29.1.patch', when='@0.29.1')
# Pass Spack environment variables to the build
patch('bazelruleclassprovider-0.25.patch', when='@0.25:')
patch('bazelruleclassprovider-0.14.patch', when='@0.14:0.24')
@ -144,9 +151,21 @@ class Bazel(Package):
patch('compile-0.4.patch', when='@0.4:0.5')
patch('compile-0.3.patch', when='@:0.3')
# for fcc
patch('patch_for_fcc.patch', when='@0.29.1:%fj')
patch('patch_for_fcc2.patch', when='@0.25:%fj')
# Disable dependency search
patch('cppcompileaction-0.3.2.patch', when='@0.3.2:+nodepfail')
patch('cppcompileaction-0.3.0.patch', when='@0.3.0:0.3.1+nodepfail')
# Fix build on power9 (2x commits)
# https://github.com/bazelbuild/bazel/commit/5cff4f1edf8b95bf0612791632255852332f72b5
# https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0
patch('build-0.29.1.patch', when='@0.29.1')
# Fix build with Fujitsu compiler
patch('blaze_util_posix-0.29.1.patch', when='@0.29.1:%fj')
patch('unix_cc_configure_fj-5.2.patch', when='@5.2:%fj')
patch('unix_cc_configure_fj-5.0.patch', when='@5.0:5.1%fj')
patch('unix_cc_configure_fj-0.29.1.patch', when='@0.29.1:4%fj')
patch('bazelruleclassprovider_fj-0.25.patch', when='@0.25:%fj')
conflicts(
'%fj',
when='@:0.24.1',
@ -154,8 +173,8 @@ class Bazel(Package):
'please use a newer release.'
)
patch('disabledepcheck.patch', when='@0.3.2:+nodepfail')
patch('disabledepcheck_old.patch', when='@0.3.0:0.3.1+nodepfail')
# https://blog.bazel.build/2021/05/21/bazel-4-1.html
conflicts('platform=darwin target=aarch64:', when='@:4.0')
executables = ['^bazel$']

View File

@ -1,37 +0,0 @@
diff --git a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc
index 87ba899180..1c967ee818 100644
--- a/src/main/cpp/blaze_util_posix.cc
+++ b/src/main/cpp/blaze_util_posix.cc
@@ -565,7 +565,8 @@ static int setlk(int fd, struct flock *lock) {
// Prefer OFD locks if available. POSIX locks can be lost "accidentally"
// due to any close() on the lock file, and are not reliably preserved
// across execve() on Linux, which we need for --batch mode.
- if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
+ //if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
+ if (fcntl(fd, F_SETLK, lock) == 0) return 0;
if (errno != EINVAL) {
if (errno != EACCES && errno != EAGAIN) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index ccb18a431a..0c5c8fd6f0 100644
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -379,7 +379,8 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
"",
False,
), ":")
- gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
+ #gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
+ gold_linker_path = None
cc_path = repository_ctx.path(cc)
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
# cc is outside the repository, set -B
@@ -468,7 +469,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
# Security hardening requires optimization.
# We need to undef it as some distributions now have it enabled by default.
"-U_FORTIFY_SOURCE",
- "-fstack-protector",
+ #"-fstack-protector",
# All warnings are enabled. Maybe enable -Werror as well?
"-Wall",
# Enable a few more warnings that aren't part of -Wall.

View File

@ -0,0 +1,20 @@
diff -Naur a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
--- a/tools/cpp/unix_cc_configure.bzl 1980-01-01 00:00:00.000000000 -0800
+++ b/tools/cpp/unix_cc_configure.bzl 2022-06-30 23:53:17.000000000 -0700
@@ -379,7 +379,7 @@
"",
False,
), ":")
- gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
+ gold_linker_path = None
cc_path = repository_ctx.path(cc)
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
# cc is outside the repository, set -B
@@ -468,7 +468,6 @@
# Security hardening requires optimization.
# We need to undef it as some distributions now have it enabled by default.
"-U_FORTIFY_SOURCE",
- "-fstack-protector",
# All warnings are enabled. Maybe enable -Werror as well?
"-Wall",
# Enable a few more warnings that aren't part of -Wall.

View File

@ -0,0 +1,23 @@
diff -Naur a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
--- a/tools/cpp/unix_cc_configure.bzl 1980-01-01 00:00:00.000000000 -0800
+++ b/tools/cpp/unix_cc_configure.bzl 2022-06-30 23:35:14.000000000 -0700
@@ -417,10 +417,7 @@
bazel_linklibs,
False,
), ":")
- gold_or_lld_linker_path = (
- _find_linker_path(repository_ctx, cc, "lld", is_clang) or
- _find_linker_path(repository_ctx, cc, "gold", is_clang)
- )
+ gold_or_lld_linker_path = None
cc_path = repository_ctx.path(cc)
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
# cc is outside the repository, set -B
@@ -531,7 +528,6 @@
# Security hardening requires optimization.
# We need to undef it as some distributions now have it enabled by default.
"-U_FORTIFY_SOURCE",
- "-fstack-protector",
# All warnings are enabled. Maybe enable -Werror as well?
"-Wall",
# Enable a few more warnings that aren't part of -Wall.

View File

@ -0,0 +1,23 @@
diff -Naur a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
--- a/tools/cpp/unix_cc_configure.bzl 1980-01-01 00:00:00.000000000 -0800
+++ b/tools/cpp/unix_cc_configure.bzl 2022-06-30 23:58:26.945067883 -0700
@@ -419,10 +419,7 @@
bazel_linklibs,
False,
), ":")
- gold_or_lld_linker_path = (
- _find_linker_path(repository_ctx, cc, "lld", is_clang) or
- _find_linker_path(repository_ctx, cc, "gold", is_clang)
- )
+ gold_or_lld_linker_path = None
cc_path = repository_ctx.path(cc)
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
# cc is outside the repository, set -B
@@ -530,7 +527,6 @@
"%{cxx_builtin_include_directories}": get_starlark_list(builtin_include_directories),
"%{compile_flags}": get_starlark_list(
[
- "-fstack-protector",
# All warnings are enabled. Maybe enable -Werror as well?
"-Wall",
# Enable a few more warnings that aren't part of -Wall.