!12 update version to 4.2.1 for tensorflow build

From: @zhangshaoning_uniontech 
Reviewed-by: @weidongkl, @zhunaipan 
Signed-off-by: @sinever
This commit is contained in:
openeuler-ci-bot 2022-06-28 06:20:14 +00:00 committed by Gitee
commit cbaaa6ed3b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 111 additions and 143 deletions

View File

@ -0,0 +1,11 @@
--- src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/plugins/dependency/StrictJavaDepsPlugin.java.orig 2019-10-16 13:05:10.252727691 +0000
+++ src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/plugins/dependency/StrictJavaDepsPlugin.java 2019-10-16 13:05:17.957900302 +0000
@@ -179,7 +179,7 @@ public final class StrictJavaDepsPlugin
log.error(diagnostic.pos(), Errors.ProcMessager(diagnostic.message()));
break;
case WARN:
- log.warning(diagnostic.pos(), Warnings.ProcMessager(diagnostic.message()));
+ //log.warning(diagnostic.pos(), Warnings.ProcMessager(diagnostic.message()));
break;
case OFF: // continue below
}

22
bazel-gcc.patch Normal file
View File

@ -0,0 +1,22 @@
--- ./third_party/ijar/mapped_file_unix.cc.orig 2021-09-01 00:46:12.255510754 +0300
+++ ./third_party/ijar/mapped_file_unix.cc 2021-09-01 00:46:47.039243899 +0300
@@ -18,6 +18,8 @@
#include <unistd.h>
#include <sys/mman.h>
+#include <stdexcept>
+#include <limits>
#include <algorithm>
#include "third_party/ijar/mapped_file.h"
--- third_party/ijar/zlib_client.h.orig 2021-09-01 00:53:22.196194178 +0300
+++ third_party/ijar/zlib_client.h 2021-09-01 00:52:20.869668731 +0300
@@ -15,6 +15,8 @@
#ifndef THIRD_PARTY_IJAR_ZLIB_CLIENT_H_
#define THIRD_PARTY_IJAR_ZLIB_CLIENT_H_
+#include <stdexcept>
+#include <limits>
#include <limits.h>
#include "third_party/ijar/common.h"

View File

@ -1,48 +1,94 @@
%define _disable_source_fetch 0
Name: bazel
Version: 4.2.1
Release: 0
Summary: Correct, reproducible, and fast builds for everyone.
License: Apache License 2.0
URL: http://bazel.io/
Source0: https://github.com/bazelbuild/bazel/releases/download/%{version}/bazel-%{version}-dist.zip
# FIXME: Java 11 log.warning generates backtrace
Patch1: bazel-1.0.0-log-warning.patch
Patch2: bazel-gcc.patch
# for folks with 'bazel' v1 package installed
Conflicts: bazel
Conflicts: bazel2
BuildRequires: java-11-openjdk-devel zlib-devel findutils gcc-c++ which unzip zip python3
BuildRequires: pkgconfig(bash-completion)
Requires: java-11-openjdk-devel
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null)
%global debug_package %{nil}
%define __os_install_post %{nil}
Name: bazel
Version: 3.5.0
Release: 4
Summary: a fast, scalable, multi-language and extensible build system
License: Apache License 2.0
URL: https://www.bazel.build/
Source0: https://github.com/bazelbuild/bazel/releases/download/%{version}/bazel-%{version}-dist.zip
Patch1: fix-build-error-with-gcc10.patch
BuildRequires: java-11-openjdk-devel python3 zip unzip python3-unversioned-command gcc-g++
Requires: libstdc++ libgcc java-11-openjdk-devel python3 zip unzip python3-unversioned-command
%description
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Correct, reproducible, and fast builds for everyone.
%prep
unzip %{SOURCE0}
%patch1 -p1
%setup -q -c -n bazel-%{version}
%patch1 -p0
%patch2 -p0
%build
env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh
chmod a+x output/bazel
find . -type f -regextype posix-extended -iregex '.*(sh|txt|py|_stub|stub_.*|bazel|get_workspace_status|protobuf_support|_so)' -exec %{__sed} -i -e '1s|^#!/usr/bin/env python$|#!/usr/bin/env python3|' "{}" \;
export EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS} --python_path=/usr/bin/python3"
# horrible of horribles, just to have `python` in the PATH
%{__mkdir_p} ./bin-hack
%{__ln_s} /usr/bin/python3 ./bin-hack/python
export PATH=$(pwd)/bin-hack:$PATH
%ifarch aarch64
export EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS} --nokeep_state_after_build --notrack_incremental_state --nokeep_state_after_build"
%else
%endif
%ifarch s390x
# increase heap size to addess s390x build failures
export BAZEL_JAVAC_OPTS="-J-Xmx4g -J-Xms512m"
%else
%endif
# loose epoch from their release date
export SOURCE_DATE_EPOCH="$(date -d $(head -1 CHANGELOG.md | %{__grep} -Eo '\b[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}\b' ) +%s)"
export EMBED_LABEL="%{version}"
# for debugging's sake
which g++
g++ --version
export TMPDIR=%{_tmppath}
export CC=gcc
export CXX=g++
export EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS} --sandbox_debug --host_javabase=@local_jdk//:jdk --verbose_failures --subcommands --explain=build.log --show_result=2147483647"
env ./compile.sh
env ./scripts/generate_bash_completion.sh --bazel=output/bazel --output=output/bazel-complete.bash
%install
mkdir -p %{buildroot}%{_bindir}
install -m755 output/bazel %{buildroot}%{_bindir}
%{__mkdir_p} %{buildroot}/%{_bindir}
%{__mkdir_p} %{buildroot}/%{bashcompdir}
%{__cp} output/bazel %{buildroot}/%{_bindir}/bazel-real
%{__cp} ./scripts/packages/bazel.sh %{buildroot}/%{_bindir}/bazel
%{__cp} output/bazel-complete.bash %{buildroot}/%{bashcompdir}/bazel
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/bazel
%attr(0755,root,root) %{_bindir}/bazel-real
%attr(0755,root,root) %{bashcompdir}/bazel
%changelog
* Mon 9 Aug 2021 zhangtao <zhangtao221@huawei.com> - 3.5.0-4
* Thu 23 Jun 2022 zhangshaoning <zhangshaoning@uniontech.com> - 4.2.1-0
- update version to 4.2.1
* Mon Aug 9 2021 zhangtao <zhangtao221@huawei.com> - 3.5.0-4
- fix build error with gcc10
* Tue Jul 13 2021 guoxiaoqi <guoxiaoqi2@huawei.com> - 3.5.0-3
@ -51,5 +97,5 @@ install -m755 output/bazel %{buildroot}%{_bindir}
* Mon May 31 2021 baizhonggui <baizhonggui@huawei.com> - 3.5.0-2
- Add gcc-g++ in BuildRequires
* Sun Sep 28 2020 Zhipeng Xie<xiezhipeng1@huawei.com> - 3.5.0-1
* Mon Sep 28 2020 Zhipeng Xie<xiezhipeng1@huawei.com> - 3.5.0-1
- Package init

View File

@ -1,4 +0,0 @@
version_control: github
src_repo: bazelbuild/bazel
tag_prefix:
seperator: .

View File

@ -1,107 +0,0 @@
From 0da3b3884873b057e04d135b33ac340f56aa6351 Mon Sep 17 00:00:00 2001
From: Yun Peng <pcloudy@google.com>
Date: Thu, 10 Sep 2020 17:15:51 +0200
Subject: [PATCH] Patch upb to fix build error with gcc 10
---
WORKSPACE | 14 ++++++++
third_party/grpc/BUILD | 2 +-
third_party/grpc/upb_gcc10_fix.patch | 51 ++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 1 deletion(-)
create mode 100644 third_party/grpc/upb_gcc10_fix.patch
diff --git a/WORKSPACE b/WORKSPACE
index 117dcb500dea..609ee77e595a 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1056,6 +1056,20 @@ register_local_rc_exe_toolchains()
register_toolchains("//src/main/res:empty_rc_toolchain")
+# Patch upb for grpc due to https://github.com/bazelbuild/bazel/issues/12056
+# TODO: Remove the following after upgrading grpc to a newer version that's not affected by this issue.
+http_archive(
+ name = "upb",
+ sha256 = "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
+ patches = ["//third_party/grpc:upb_gcc10_fix.patch"],
+ patch_args = ["-p1"],
+ strip_prefix = "upb-9effcbcb27f0a665f9f345030188c0b291e32482",
+ urls = [
+ "https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
+ "https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
+ ],
+)
+
http_archive(
name = "com_github_grpc_grpc",
urls = [
diff --git a/third_party/grpc/BUILD b/third_party/grpc/BUILD
index 71fc09eec21b..88071553565c 100644
--- a/third_party/grpc/BUILD
+++ b/third_party/grpc/BUILD
@@ -18,7 +18,7 @@ load("//tools/distributions:distribution_rules.bzl", "distrib_java_import", "dis
licenses(["notice"]) # Apache v2
-exports_files(["grpc_1.26.0.patch"])
+exports_files(["grpc_1.26.0.patch", "upb_gcc10_fix.patch"])
package(default_visibility = ["//visibility:public"])
diff --git a/third_party/grpc/upb_gcc10_fix.patch b/third_party/grpc/upb_gcc10_fix.patch
new file mode 100644
index 000000000000..5f82d4ea43bb
--- /dev/null
+++ b/third_party/grpc/upb_gcc10_fix.patch
@@ -0,0 +1,51 @@
+commit 9bd23dab4240b015321a53c45b3c9e4847fbf020
+Author: Joshua Haberman <jhaberman@gmail.com>
+Date: Tue Apr 7 15:22:11 2020 -0700
+
+ Changed upb status to suit GCC10's warning about strncpy(). (#268)
+
+ Added tests for all cases. Also removed ellipses from truncated
+ messages, they were more trouble than they are worth.
+
+diff --git a/upb/upb.c b/upb/upb.c
+index cb2cdfd..258192d 100644
+--- a/upb/upb.c
++++ b/upb/upb.c
+@@ -11,17 +11,6 @@
+
+ #include "upb/port_def.inc"
+
+-/* Guarantee null-termination and provide ellipsis truncation.
+- * It may be tempting to "optimize" this by initializing these final
+- * four bytes up-front and then being careful never to overwrite them,
+- * this is safer and simpler. */
+-static void nullz(upb_status *status) {
+- const char *ellipsis = "...";
+- size_t len = strlen(ellipsis);
+- UPB_ASSERT(sizeof(status->msg) > len);
+- memcpy(status->msg + sizeof(status->msg) - len, ellipsis, len);
+-}
+-
+ /* upb_status *****************************************************************/
+
+ void upb_status_clear(upb_status *status) {
+@@ -37,8 +26,8 @@ const char *upb_status_errmsg(const upb_status *status) { return status->msg; }
+ void upb_status_seterrmsg(upb_status *status, const char *msg) {
+ if (!status) return;
+ status->ok = false;
+- strncpy(status->msg, msg, sizeof(status->msg));
+- nullz(status);
++ strncpy(status->msg, msg, UPB_STATUS_MAX_MESSAGE - 1);
++ status->msg[UPB_STATUS_MAX_MESSAGE - 1] = '\0';
+ }
+
+ void upb_status_seterrf(upb_status *status, const char *fmt, ...) {
+@@ -52,7 +41,7 @@ void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args) {
+ if (!status) return;
+ status->ok = false;
+ _upb_vsnprintf(status->msg, sizeof(status->msg), fmt, args);
+- nullz(status);
++ status->msg[UPB_STATUS_MAX_MESSAGE - 1] = '\0';
+ }
+
+ /* upb_alloc ******************************************************************/