Skip to content

Commit

Permalink
www/gitlab-ce: Use grpc 1.30.2
Browse files Browse the repository at this point in the history
We currently see problems and gitlab suggested to use grpc 1.30.2:
https://gitlab.com/gitlab-org/gitlab/-/issues/345693#note_734676746

Newer version of grpc and google-protobuf have known bugs.

The open bug that license files cannot not be handled is tracked here:
https://gitlab.com/gitlab-org/gitlab/-/issues/345693
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259848
  • Loading branch information
mfechner committed Nov 19, 2021
1 parent adba40c commit 0aac448
Show file tree
Hide file tree
Showing 19 changed files with 475 additions and 806 deletions.
1 change: 1 addition & 0 deletions devel/Makefile
Expand Up @@ -924,6 +924,7 @@
SUBDIR += grcov
SUBDIR += grex
SUBDIR += grpc
SUBDIR += grpc130
SUBDIR += grpc134
SUBDIR += grv
SUBDIR += gsettings-desktop-schemas
Expand Down
4 changes: 2 additions & 2 deletions devel/gitaly/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gitaly
DISTVERSION= 14.4.2
PORTREVISION= 0
PORTREVISION= 2
CATEGORIES= devel

#PATCH_SITES= https://gitlab.com/mfechner/gitaly/-/merge_requests/
Expand All @@ -23,7 +23,7 @@ MY_DEPENDS= git>=2.32.0:devel/git \
rubygem-rdoc>=6.3.2<7.0:devel/rubygem-rdoc \
rubygem-gitlab-gollum-lib>=4.2.7.10.gitlab.1<4.2.8:www/rubygem-gitlab-gollum-lib \
rubygem-gitlab-gollum-rugged_adapter>=0.4.4.4.gitlab.1<0.4.5.0:www/rubygem-gitlab-gollum-rugged_adapter \
rubygem-grpc>=1.30.2<2:net/rubygem-grpc \
rubygem-grpc130>=1.30.2<2:net/rubygem-grpc130 \
rubygem-sentry-raven>=3.0<4:devel/rubygem-sentry-raven \
rubygem-faraday>=1.0.1<2:www/rubygem-faraday \
rubygem-rbtrace>=0.4.14:devel/rubygem-rbtrace \
Expand Down
792 changes: 0 additions & 792 deletions devel/gitaly/files/patch-2

This file was deleted.

2 changes: 1 addition & 1 deletion devel/gitaly/files/patch-ruby_Gemfile
@@ -1,4 +1,4 @@
--- ruby/Gemfile.orig 2021-10-21 21:58:10 UTC
--- ruby/Gemfile.orig 2021-11-08 11:56:42 UTC
+++ ruby/Gemfile
@@ -19,15 +19,5 @@ gem 'gitlab-labkit', '~> 0.21.1'
# This version needs to be in sync with GitLab CE/EE
Expand Down
58 changes: 58 additions & 0 deletions devel/grpc130/Makefile
@@ -0,0 +1,58 @@
# Created by: vanilla@

PORTNAME= grpc
PORTVERSION= 1.30.2
DISTVERSIONPREFIX= v
CATEGORIES= devel
PKGNAMESUFFIX= 130

MAINTAINER= mfechner@FreeBSD.org
COMMENT= HTTP/2-based RPC framework

LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE

LIB_DEPENDS= libabsl_base.so:devel/abseil \
libbenchmark.so:devel/benchmark \
libcares.so:dns/c-ares \
libgflags.so:devel/gflags \
libprotobuf.so:devel/protobuf \
libre2.so:devel/re2

USES= cmake compiler:c++17-lang cpe localbase:ldflags pkgconfig ssl

USE_GITHUB= yes

CMAKE_ARGS= -DCMAKE_CXX_STANDARD=17 \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_BENCHMARK_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_GFLAGS_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package
CMAKE_ON= BUILD_SHARED_LIBS
USE_LDCONFIG= yes
STRIP=

PLIST_SUB= PORTVERSION=${PORTVERSION}

.include <bsd.port.pre.mk>

# Remove openssl from grpc.pc because we do not ship openssl.pc in base system
.if ${SSL_DEFAULT} == base
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-CMakeLists.txt
.endif

post-patch:
# Clean up bundled libraries
@${RM} -r ${WRKSRC}/third_party/abseil-cpp/
@${RM} -r ${WRKSRC}/third_party/benchmark/
@${RM} -r ${WRKSRC}/third_party/boringssl-with-bazel/
@${RM} -r ${WRKSRC}/third_party/cares/
@${RM} -r ${WRKSRC}/third_party/protobuf/
@${RM} -r ${WRKSRC}/third_party/re2/
@${RM} -r ${WRKSRC}/third_party/zlib/

.include <bsd.port.post.mk>
3 changes: 3 additions & 0 deletions devel/grpc130/distinfo
@@ -0,0 +1,3 @@
TIMESTAMP = 1637134735
SHA256 (grpc-grpc-v1.30.2_GH0.tar.gz) = ba74b97a2f1b4e22ec5fb69d639d849d2069fb58ea7d6579a31f800af6fe3b6c
SIZE (grpc-grpc-v1.30.2_GH0.tar.gz) = 6978015
11 changes: 11 additions & 0 deletions devel/grpc130/files/extra-patch-CMakeLists.txt
@@ -0,0 +1,11 @@
--- CMakeLists.txt.orig 2021-09-25 02:33:41 UTC
+++ CMakeLists.txt
@@ -17664,7 +17664,7 @@ generate_pkgconfig(
"gRPC"
"high performance general RPC framework"
"${gRPC_CORE_VERSION}"
- "gpr openssl absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_inlined_vector absl_memory absl_optional absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_variant"
+ "gpr absl_base absl_bind_front absl_cord absl_core_headers absl_flat_hash_map absl_inlined_vector absl_memory absl_optional absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_variant"
"-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz"
""
"grpc.pc")
@@ -0,0 +1,11 @@
--- src/core/lib/security/credentials/jwt/jwt_verifier.cc.orig 2020-12-01 19:24:28 UTC
+++ src/core/lib/security/credentials/jwt/jwt_verifier.cc
@@ -472,7 +472,7 @@ static BIGNUM* bignum_from_base64(const char* b64) {
return result;
}

-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)

// Provide compatibility across OpenSSL 1.02 and 1.1.
static int RSA_set0_key(RSA* r, BIGNUM* n, BIGNUM* e, BIGNUM* d) {
11 changes: 11 additions & 0 deletions devel/grpc130/files/patch-src_core_tsi_alts_crypt_aes__gcm.cc
@@ -0,0 +1,11 @@
--- src/core/tsi/alts/crypt/aes_gcm.cc.orig 2020-12-01 19:24:28 UTC
+++ src/core/tsi/alts/crypt/aes_gcm.cc
@@ -185,7 +185,7 @@ static grpc_status_code aes_gcm_derive_aead_key(uint8_
const uint8_t* kdf_counter) {
unsigned char buf[EVP_MAX_MD_SIZE];
unsigned char ctr = 1;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
HMAC_CTX hmac;
HMAC_CTX_init(&hmac);
if (!HMAC_Init_ex(&hmac, kdf_key, kKdfKeyLen, EVP_sha256(), nullptr) ||
26 changes: 26 additions & 0 deletions devel/grpc130/files/patch-src_core_tsi_ssl__transport__security.cc
@@ -0,0 +1,26 @@
--- src/core/tsi/ssl_transport_security.cc.orig 2020-12-01 19:24:28 UTC
+++ src/core/tsi/ssl_transport_security.cc
@@ -70,11 +70,10 @@ extern "C" {
#define TSI_SSL_MAX_PROTECTED_FRAME_SIZE_LOWER_BOUND 1024
#define TSI_SSL_HANDSHAKER_OUTGOING_BUFFER_INITIAL_SIZE 1024

-/* Putting a macro like this and littering the source file with #if is really
- bad practice.
- TODO(jboeuf): refactor all the #if / #endif in a separate module. */
-#ifndef TSI_OPENSSL_ALPN_SUPPORT
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
#define TSI_OPENSSL_ALPN_SUPPORT 1
+#else
+#define TSI_OPENSSL_ALPN_SUPPORT 0
#endif

/* TODO(jboeuf): I have not found a way to get this number dynamically from the
@@ -1930,7 +1929,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory_wi
options->cipher_suites);
if (result != TSI_OK) break;
-#if OPENSSL_VERSION_NUMBER >= 0x10100000
+#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
// X509_STORE_up_ref is only available since OpenSSL 1.1.
if (options->root_store != nullptr) {
X509_STORE_up_ref(options->root_store->store);
6 changes: 6 additions & 0 deletions devel/grpc130/pkg-descr
@@ -0,0 +1,6 @@
gRPC is a modern, open source, high-performance remote procedure call (RPC)
framework that can run anywhere, enables client and server applications to
communicate transparently, and simplifies the building of connected systems.

WWW: https://grpc.io/
WWW: https://github.com/grpc/grpc

0 comments on commit 0aac448

Please sign in to comment.