Update Bazel 2.0.0 --> 2.1.0 (#5651)

* Update Bazel 2.0.0 --> 2.1.0

CHANGELOG_BEGIN
CHANGELOG_END

* Update rules_haskell

For Bazel 2.1.0 compatibility.

* nix: grpc: patch glibc version incompatibility

* Fix hlint warnings

* CcToolchainInfo.compiler

https://docs.bazel.build/versions/2.1.0/skylark/lib/CcToolchainInfo.html#compiler

* CcToolchainInfo.ar_executable

* texlive: add missing transparent package

* Leave a debug note on the docs target

* Ignore FutureWarning in //docs:docs-no-pdf

* Isolate PR

This is to avoid any interference with pipelines prior to the Bazel
update.

* Remove isolation

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
This commit is contained in:
Andreas Herrmann 2020-05-11 11:47:54 +02:00 committed by GitHub
parent 2a8c93a614
commit 35fe61ed06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 167 additions and 20 deletions

View File

@ -93,6 +93,8 @@ common_nix_file_deps = [
"//nix:nixpkgs.nix",
"//nix:nixpkgs/default.nix",
"//nix:nixpkgs/default.src.json",
"//nix:grpc-Rename-gettid-functions.patch",
"//nix:grpc-Fix-gettid-naming-conflict.patch",
]
# Use Nix provisioned cc toolchain

View File

@ -30,14 +30,10 @@ def _fat_cc_library_impl(ctx):
toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
feature_configuration = cc_common.configure_features(ctx = ctx, cc_toolchain = toolchain)
compiler = None
if is_darwin:
# toolchain.compiler_executable() fails on MacOS, see https://github.com/bazelbuild/bazel/issues/7105
compiler = ctx.executable._cc_compiler
elif is_windows:
compiler = toolchain.compiler_executable() + ".exe"
if is_windows:
compiler = toolchain.compiler + ".exe"
else:
compiler = toolchain.compiler_executable()
compiler = toolchain.compiler
ctx.actions.run(
mnemonic = "CppLinkFatDynLib",
outputs = [dyn_lib],
@ -65,7 +61,7 @@ def _fat_cc_library_impl(ctx):
mri_script = ctx.actions.declare_file(ctx.label.name + "_mri")
ctx.actions.write(mri_script, mri_script_content)
ar = toolchain.ar_executable()
ar = toolchain.ar_executable
if ar.find("libtool") >= 0:
# We are on MacOS where ar_executable is actually libtool, see

View File

@ -48,7 +48,7 @@ keepModule TransformOptions{..} m = includeModuleFilter && excludeModuleFilter
excludeModuleFilter = maybe True (not . moduleMatchesAny) to_excludeModules
moduleMatchesAny :: [String] -> Bool
moduleMatchesAny ps = any (?== name) (map withSlashes ps)
moduleMatchesAny = any ((?== name) . withSlashes)
withSlashes :: String -> String
withSlashes = replace "." [pathSeparator]

View File

@ -508,7 +508,7 @@ expectTextOnHover cursorRange expectedInfo = do
hoverPredicate = case expectedInfo of
NoInfo -> null
Contains t -> any (T.isInfixOf t)
NotContaining t -> all (not . T.isInfixOf t)
NotContaining t -> not . any (T.isInfixOf t)
HasType t -> any (T.isSuffixOf $ ": " <> t) . concatMap T.lines
-- | Expect a certain section to take fewer than the specified number of seconds.

View File

@ -31,8 +31,8 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
rules_scala_version = "6c16cff213b76a4126bdc850956046da5db1daaa"
rules_haskell_version = "cf6beb4e3748dce6dc401a95ab8cacb803c5d944"
rules_haskell_sha256 = "cadb4ceb63994d86343fb407a9b5eaab363af428850d1698d6c6132690ccfb71"
rules_haskell_version = "76f7b1c7328f59bf2f38b56bce0036153c65a40d"
rules_haskell_sha256 = "5553f76d40db672b499a76fd56fab75df6fe465531f2eedd7da39a3deaed54a6"
rules_nixpkgs_version = "c966bb8bd335f1e244c03efe6e7a1afa9784038e"
rules_nixpkgs_sha256 = "ccafea4fc4d5fa2ddba2882f76728558bfe2c12657f7f56078ece43a31761148"
buildifier_version = "0.26.0"

View File

@ -1,12 +1,12 @@
{
"homepage": "https://bazel.build",
"version": "2.0.0",
"version": "2.1.0",
"license": "Apache-2.0",
"bin": "bazel.exe",
"architecture": {
"64bit": {
"url": "https://github.com/bazelbuild/bazel/releases/download/2.0.0/bazel-2.0.0-windows-x86_64.zip",
"hash": "83d0e987fa84ac5085c1fe1cc8fd36f5c2bd7b0a3e84b346c2093b19cfa35a57"
"url": "https://github.com/bazelbuild/bazel/releases/download/2.1.0/bazel-2.1.0-windows-x86_64.zip",
"hash": "0c8492b49310f73cdfbc4df9173b5f2cd2aa547d8dfbe46b47b93f3d712e5864"
}
},
"depends": [

View File

@ -333,6 +333,20 @@ genrule(
# run twice to generate all references properly (this is a latex thing...)
../$(location @texlive_nix//:bin/lualatex) -halt-on-error -interaction=batchmode --shell-escape *.tex
../$(location @texlive_nix//:bin/lualatex) -halt-on-error -interaction=batchmode --shell-escape *.tex
# NOTE, if you get errors of the following form:
#
# luaotfload | db : Font names database not found, generating new one.
# luaotfload | db : This can take several minutes; please be patient.
# luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: "File not found: lmroman10-regular.".
#
# Then the error is most likely not font related. To debug the error
# run `bazel build` with `--sandbox_debug`, change into the sandbox
# directory and invoke lualatex from there. You will have to replicate
# the environment variable setup from above.
#
# In the past the following issues caused the error message above:
# - An update of sphinx in nixpkgs that had to be undone.
# - A missing texlive package that had to be added to the Nix derivation.
# Move output to target
mv DigitalAssetSDK.pdf ../$(location DigitalAssetSDK.pdf)""".format(sdk = sdk_version),
@ -394,8 +408,19 @@ genrule(
sed -i "s,__VERSION__,"{sdk}"," docs/configs/html/conf.py
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Sphinx 1.8.3 triggers the following warning:
#
# /nix/store/1v39mhhyn48s251przk2fwcvgm71vfqi-python3.7-sphinx-1.8.3/lib/python3.7/site-packages/sphinx/writers/html.py:462: FutureWarning:
# The iterable returned by Node.traverse()
# will become an iterator instead of a list in Docutils > 0.16.
# target_node = image_nodes and image_nodes[0] or node.parent
#
# We are using an older Sphinx (1.8.3) with a more recent nixpkgs revision.
# Unfortunately, an update is not so easy because Sphinx 2.3.1 breaks
# the PDF documentation due to issues with the FreeSerif font in the
# fontspec package. So, for now we ignore `FutureWarning`.
WARNINGS=$$(../$(location @sphinx_nix//:bin/sphinx-build) -c docs/configs/html docs/source html 2>&1 | \
grep -Ei "warning:" || true)
grep -Pi "(?<!future)warning:" || true)
if [ "$$WARNINGS" != "" ]; then
echo "$$WARNINGS"

View File

@ -108,6 +108,7 @@ let shared = rec {
titlesec
tocbibind
todonotes
transparent
trimspaces
varwidth
wrapfig

View File

@ -24,7 +24,7 @@ let
});
ghc = pkgs.callPackage ./overrides/ghc-8.6.5.nix rec {
bootPkgs = pkgs.haskell.packages.ghc863Binary;
bootPkgs = pkgs.haskell.packages.ghc865Binary;
inherit (pkgs.python3Packages) sphinx;
inherit (pkgs) buildLlvmPackages;
enableIntegerSimple = true;

View File

@ -0,0 +1,36 @@
From de6255941a5e1c2fb2d50e57f84e38c09f45023d Mon Sep 17 00:00:00 2001
From: Juanli Shen <juanlishen@google.com>
Date: Fri, 23 Aug 2019 08:46:09 -0700
Subject: [PATCH] Fix gettid() naming conflict
---
src/core/lib/gpr/log_linux.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc
index 561276f0c2..81026e5689 100644
--- a/src/core/lib/gpr/log_linux.cc
+++ b/src/core/lib/gpr/log_linux.cc
@@ -40,7 +40,9 @@
#include <time.h>
#include <unistd.h>
-static long gettid(void) { return syscall(__NR_gettid); }
+// Not naming it as gettid() to avoid duplicate declarations when complied with
+// GCC 9.1.
+static long local_gettid(void) { return syscall(__NR_gettid); }
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
@@ -70,7 +72,7 @@ void gpr_default_log(gpr_log_func_args* args) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
struct tm tm;
static __thread long tid = 0;
- if (tid == 0) tid = gettid();
+ if (tid == 0) tid = local_gettid();
timer = static_cast<time_t>(now.tv_sec);
final_slash = strrchr(args->file, '/');
--
2.20.1

View File

@ -0,0 +1,83 @@
From 57586a1ca7f17b1916aed3dea4ff8de872dbf853 Mon Sep 17 00:00:00 2001
From: Benjamin Peterson <benjamin@dropbox.com>
Date: Fri, 3 May 2019 08:11:00 -0700
Subject: [PATCH] Rename gettid() functions.
glibc 2.30 will declare its own gettid; see https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92. Rename the grpc versions to avoid naming conflicts.
---
src/core/lib/gpr/log_linux.cc | 6 ++----
src/core/lib/gpr/log_posix.cc | 4 ++--
src/core/lib/iomgr/ev_epollex_linux.cc | 4 ++--
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc
index 81026e5689..8b597b4cf2 100644
--- a/src/core/lib/gpr/log_linux.cc
+++ b/src/core/lib/gpr/log_linux.cc
@@ -40,9 +40,7 @@
#include <time.h>
#include <unistd.h>
-// Not naming it as gettid() to avoid duplicate declarations when complied with
-// GCC 9.1.
-static long local_gettid(void) { return syscall(__NR_gettid); }
+static long sys_gettid(void) { return syscall(__NR_gettid); }
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
@@ -72,7 +70,7 @@ void gpr_default_log(gpr_log_func_args* args) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
struct tm tm;
static __thread long tid = 0;
- if (tid == 0) tid = local_gettid();
+ if (tid == 0) tid = sys_gettid();
timer = static_cast<time_t>(now.tv_sec);
final_slash = strrchr(args->file, '/');
diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc
index b6edc14ab6..2f7c6ce376 100644
--- a/src/core/lib/gpr/log_posix.cc
+++ b/src/core/lib/gpr/log_posix.cc
@@ -31,7 +31,7 @@
#include <string.h>
#include <time.h>
-static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
+static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); }
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
@@ -86,7 +86,7 @@ void gpr_default_log(gpr_log_func_args* args) {
char* prefix;
gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]",
gpr_log_severity_string(args->severity), time_buffer,
- (int)(now.tv_nsec), gettid(), display_file, args->line);
+ (int)(now.tv_nsec), sys_gettid(), display_file, args->line);
fprintf(stderr, "%-70s %s\n", prefix, args->message);
gpr_free(prefix);
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index c2d80c08dd..4a83cb6c21 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -1077,7 +1077,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
}
#ifndef NDEBUG
-static long gettid(void) { return syscall(__NR_gettid); }
+static long sys_gettid(void) { return syscall(__NR_gettid); }
#endif
/* pollset->mu lock must be held by the caller before calling this.
@@ -1097,7 +1097,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
#define WORKER_PTR (&worker)
#endif
#ifndef NDEBUG
- WORKER_PTR->originator = gettid();
+ WORKER_PTR->originator = sys_gettid();
#endif
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_INFO,
--
2.20.1

View File

@ -19,7 +19,11 @@ let
};
# Upstream nixpkgs applies patches that are incompatbile with our version
# of grpc. So, we disable them.
patches = [];
patches = [
# Fix glibc version conflict.
./grpc-Fix-gettid-naming-conflict.patch
./grpc-Rename-gettid-functions.patch
];
});
ephemeralpg = pkgs.ephemeralpg.overrideAttrs(oldAttrs: {
installPhase = ''

View File

@ -2,6 +2,6 @@
"owner": "NixOS",
"repo": "nixpkgs-channels",
"branch": "nixpkgs-unstable",
"rev": "42a195919a10ce70309c3666dfe8206e380fae1b",
"sha256": "1iy3iz91xx58k9wgswalipa8gxxdafqq82lisg6s16ml8y232f00"
"rev": "10100a97c8964e82b30f180fda41ade8e6f69e41",
"sha256": "011f36kr3c1ria7rag7px26bh73d1b0xpqadd149bysf4hg17rln"
}