user/gitaly: upgrade to 16.1.0

This commit is contained in:
Antoine Martin 2023-06-25 10:46:49 -04:00 committed by Antoine Martin
parent 6be6db8341
commit b62b816e42
5 changed files with 17 additions and 263 deletions

View file

@ -2,34 +2,24 @@
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=gitaly
pkgver=15.3.3
pkgrel=4
pkgver=16.1.0
pkgrel=0
pkgdesc="A Git RPC service for handling all the git calls made by GitLab"
url="https://gitlab.com/gitlab-org/gitaly/"
arch="!armv7 all"
# GPL-2.0-only WITH GCC-exception-2.0: bundled libgit2
license="MIT AND GPL-2.0-only WITH GCC-exception-2.0"
depends="
git>=2.33
ruby3.0
ruby3.0-bigdecimal
ruby3.0-bundler
ruby3.0-io-console
ruby3.0-json
git>=2.40
"
makedepends="
bash
cmake
go
icu-dev
libffi-dev
libssh2-dev
libxml2-dev
libxslt-dev
ruby3.0-dev
ruby3.0-grpc=~1.42.0
ruby3.0-rugged=~1.5.0.1
zlib-dev
"
subpackages="
$pkgname-backup
@ -38,74 +28,20 @@ subpackages="
$pkgname-openrc
"
source="https://gitlab.com/gitlab-org/gitaly/-/archive/v$pkgver/gitaly-v$pkgver.tar.gz
gemfile-use-local-grpc.patch
gemfile-use-local-rugged.patch
config.patch
$pkgname.initd
"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check"
export BUNDLE_DEPLOYMENT=true
export BUNDLE_FORCE_RUBY_PLATFORM=true
export BUNDLE_FROZEN=true
export BUNDLE_JOBS=${JOBS:-2}
export BUNDLE_WITHOUT="development test"
prepare() {
local sysgemdir=$(ruby -e 'puts Gem.default_dir')
default_prepare
# Some gems are broken, so we copy our fixed version
# instead of installing it from RubyGems using Bundler.
for i in grpc rugged; do
mkdir -p ruby/vendor/$i/src/ruby/lib/$i
cp -r "$sysgemdir"/gems/$i-*/* ruby/vendor/$i/
cp "$sysgemdir"/specifications/$i-*.gemspec \
ruby/vendor/$i/$i.gemspec
cp "$sysgemdir"/extensions/*/*/$i-*/$i/*.so \
ruby/vendor/$i/src/ruby/lib/$i/
done
}
build() {
cd "$builddir"/ruby
bundle config --local build.ffi --enable-system-libffi
bundle config --local build.nokogiri --use-system-libraries \
--with-xml2-include=/usr/include/libxml2 \
--with-xslt-include=/usr/include/libxslt
bundle config --local build.rugged --use-system-libraries
# https://github.com/protocolbuffers/protobuf/issues/2335#issuecomment-579913357
bundle config --local build.google-protobuf --with-cflags=-D__va_copy=va_copy
bundle config --local path "vendor/bundle"
bundle config --local without "$BUNDLE_WITHOUT"
bundle install --no-cache
touch '.ruby-bundle' # prevent 'make install' below from running 'bundle install' again
cd "$builddir"
# NOTE: This builds and links statically libgit2 with bundled deps.
cat > config.mak <<-EOF
PREFIX = /usr
GITALY_VERSION = "$pkgver"
# build without tracing libs, see
# https://gitlab.com/gitlab-org/labkit/-/merge_requests/2
SERVER_BUILD_TAGS = ""
EOF
make
make V=1 BUILD_TAGS="tracer_static tracer_static_jaeger"
}
package() {
local rubydir="$pkgdir/usr/lib/bundles/gitaly-ruby"
## Go part
make install DESTDIR="$pkgdir"
make install DESTDIR="$pkgdir" PREFIX=/usr
# Not very useful for us.
rm "$pkgdir"/usr/bin/gitaly-debug
@ -116,50 +52,6 @@ package() {
install -m644 -D cmd/gitaly-blackbox/config.toml.example "$pkgdir"/etc/gitlab/gitaly-blackbox.toml
install -m755 -D "$srcdir"/gitaly.initd "$pkgdir"/etc/init.d/gitlab.gitaly
## Ruby part
mkdir -p "${rubydir%/*}"
cp -a ruby "$rubydir"
# Remove tests.
rm -R "$rubydir"/spec
cd "$rubydir"/vendor/bundle/ruby/*/gems
# Remove tests, docs and other unnecessary files.
rm -Rf \
./*/benchmark \
./*/spec \
./*/test \
./*/tests \
./*/appveyor.yml \
./*/*.md \
./*/*.rdoc \
./*/*.txt \
./*/CHANGELOG* \
./*/CHANGES* \
./*/CONTRIBUT* \
./*/*LICENSE* \
./*/Rakefile \
./*/README*
# Remove bundled pg_query sources.
rm -R pg_query-*/ext
# Remove assets, they are not used in gitaly-ruby.
rm -R gemojione-*/assets
# Remove sources and binaries of native extensions (they are installed
# in extensions directory).
find . -type d -name ext -maxdepth 2 -exec rm -frv '{}' +
find . -name '*.so' -delete
# Remove build logs and cache.
rm -R ../build_info/ ../cache/
find ../extensions/ \
-name gem_make.out -delete \
-o -name mkmf.log -delete
}
backup() {
@ -188,9 +80,7 @@ praefect() {
}
sha512sums="
a3d4f929014df6f3e7034f493be9b27dcc1e820e42198582171a43c7ddf1bc9087329f13878f139a7d6dc1e6a92a76dabf26214409abe839d8f9508429f91ba0 gitaly-v15.3.3.tar.gz
ebcb7296696b9c2b47b7770a37ae13663cb0343659d482ef45717ef5548ede69eedee707763c6dfd73c60ef303e03fbe5502967783c59c00475a1a6d0c5ee128 gemfile-use-local-grpc.patch
f767ef16fbe708e6ca873242a8a4f53bf2f924ec3a901bce24af3fde36321004555d6161c96bfad0dbdbae9c19b5e8564d41e3b2e980a40bb199480ef69144f8 gemfile-use-local-rugged.patch
8779e34b2a468a74c590ee29155e7b197eabcd323157b1e27208fa2f3100b31e1fd1ff80d7067198e66cfb1be506caedeecbfeb4e9f32aa5b8422455e1718e1a config.patch
e1277a318c534492d280524a4e6ddd1434f95ba4248054584b56dce74d3ba20fc2be5bacafee39a2dd16547d781edecf4de9bbb03c7941e38590e175f8c77856 gitaly-v16.1.0.tar.gz
7760ee96abd45103a99e3c3fff31538aeac0e10254c88ab600bfc6fed04c0c34b43a4d54295463663a9707204622cfc06d1de672fe2826d22c017850ddac24e4 config.patch
c32105d921be16eaf559cf21d6840bc346cd92b5e37974cedecdb5a2d2ca1eb5e8fbb144f5fc8a1289bf9415102b313cf2d61ee510c80f08ab33a799f5ac7122 gitaly.initd
"

View file

@ -1,4 +1,6 @@
--- a/config.toml.example
diff --git a/config.toml.example.orig b/config.toml.example
index 2ddb368..0a8a0e2 100644
--- a/config.toml.example.orig
+++ b/config.toml.example
@@ -2,15 +2,15 @@
# Documentation lives at https://docs.gitlab.com/ee/administration/gitaly/ and
@ -22,7 +24,7 @@
# # Optional: listen on a TCP socket. This is insecure (no authentication)
# listen_addr = "localhost:9999"
@@ -22,7 +22,7 @@
@@ -22,7 +22,7 @@ bin_dir = "/home/git/gitaly/_build/bin"
# # Optional: configure where the Gitaly creates the sockets for internal connections. If unset, Gitaly will create a randomly
# # named temp directory each time it boots.
# # Non Gitaly clients should never connect to these sockets.
@ -31,7 +33,7 @@
# # Optional: authenticate Gitaly requests using a shared secret
# [auth]
@@ -30,14 +30,14 @@
@@ -30,8 +30,8 @@ bin_dir = "/home/git/gitaly/_build/bin"
# transitioning = false # Set `transitioning` to true to temporarily allow unauthenticated while rolling out authentication.
# [tls]
@ -40,19 +42,9 @@
+# certificate_path = '/etc/gitlab/ssl/gitaly.crt'
+# key_path = '/etc/gitlab/ssl/gitaly.key'
-# # Git settings
-# [git]
-# bin_path = "/usr/bin/git"
+# Git settings
+[git]
+bin_path = "/usr/bin/git"
# catfile_cache_size = 100
-#
+
# # Set this setting to `true` to start ignoring gitconfig files installed in
# # the system. This includes both system-level (e.g. '/etc/gitconffig') and
# # global-level (e.g. `$HOME/.gitconfig`) files. This setting will become the
@@ -51,7 +51,7 @@
# # Git settings
# [git]
@@ -44,7 +44,7 @@ bin_dir = "/home/git/gitaly/_build/bin"
[[storage]]
name = "default"
@ -61,7 +53,7 @@
# # You can optionally configure more storages for this Gitaly instance to serve up
#
@@ -61,15 +61,15 @@
@@ -54,15 +54,15 @@ path = "/home/git/repositories"
#
# # You can optionally configure Gitaly to output JSON-formatted log messages to stdout
@ -85,17 +77,8 @@
+
# # Additionally exceptions from the Go server can be reported to Sentry
# sentry_dsn = "https://<key>:<secret>@sentry.io/<project>"
# # Exceptions from gitaly-ruby can also be reported to Sentry
@@ -81,7 +81,7 @@
[gitaly-ruby]
# The directory where gitaly-ruby is installed
-dir = "/home/git/gitaly/ruby"
+dir = "/usr/lib/bundles/gitaly-ruby"
# # Gitaly-ruby resident set size (RSS) that triggers a memory restart (bytes)
# max_rss = 200000000
@@ -101,14 +101,14 @@
@@ -72,14 +72,14 @@ dir = "/home/git/gitlab/log"
[gitlab-shell]
# The directory where gitlab-shell is installed

View file

@ -1,53 +0,0 @@
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Wed, 07 Mar 2018 17:24:00 +0200
Subject: Don't fetch grpc gem from RubyGems
Grpc gem is total shit, doesn't build from source without patching,
embeds three third-party libs including Google's very own fork of
OpenSSL and root CAs, contains a lot of bloat etc.
Therefore I install this shit from my Alpine package and
copy it into vendor/ before running bundler.
This patch also downgrades grpc and google-protobuf (reverts
https://gitlab.com/gitlab-org/gitaly/-/commit/7fbf17ddbd385b014d284b78dbaf832310e41add)
to the same version gitlab-foss uses. It's just to avoid dealing with
ruby-grpc upgrade.
--- a/ruby/Gemfile
+++ b/ruby/Gemfile
@@ -10 +10,2 @@
-gem 'grpc', '~> 1.42.0' # keep in lock-step with grpc-tools
+# This Google gem is totally messed, we handle it specially.
+gem 'grpc', path: 'vendor/grpc', require: false
--- a/ruby/Gemfile.lock
+++ b/ruby/Gemfile.lock
@@ -1,3 +1,9 @@
+PATH
+ remote: vendor/grpc
+ specs:
+ grpc (1.42.0)
+ google-protobuf (~> 3.18)
+
GEM
remote: https://rubygems.org/
specs:
@@ -84,9 +90,6 @@
google-protobuf (3.21.3)
googleapis-common-protos-types (1.3.0)
google-protobuf (~> 3.14)
- grpc (1.42.0)
- google-protobuf (~> 3.18)
- googleapis-common-protos-types (~> 1.0)
grpc-tools (1.42.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
@@ -235,7 +238,7 @@
gitlab-license_finder
gitlab-markup (~> 1.7.1)
google-protobuf (~> 3.21.0)
- grpc (~> 1.42.0)
+ grpc!
grpc-tools (~> 1.42.0)
licensee (~> 9.14.1)
pry (~> 0.12.2)

View file

@ -1,55 +0,0 @@
From: Antoine Martin (ayakael) <dev@ayakael.net)
Date: Wed, 09 Mar 2023 17:24:00 +0200
Subject: Don't fetch rugged gem from RubyGems
Rugged gem, since 1.5.0, has issues related libgit2 version checking.
Thus, install fails.
Therefore this patch sources the gem from the ruby-rugged Alpine package
and copies it into vendor/ before running bundler
diff --git a/ruby/Gemfile.orig b/ruby/Gemfile
index 5982fc4..6c339f7 100644
--- a/ruby/Gemfile.orig
+++ b/ruby/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rugged', '~> 1.2'
+gem 'rugged', path: 'vendor/rugged', require: false
gem 'github-linguist', '~> 7.20.0', require: 'linguist'
gem 'gitlab-markup', '~> 1.7.1'
gem 'activesupport', '~> 6.1.6.1'
diff --git a/ruby/Gemfile.lock.orig b/ruby/Gemfile.lock
index 5cfc90f..7cd8b85 100644
--- a/ruby/Gemfile.lock.orig
+++ b/ruby/Gemfile.lock
@@ -4,6 +4,11 @@ PATH
grpc (1.42.0)
google-protobuf (~> 3.18)
+PATH
+ remote: vendor/rugged
+ specs:
+ rugged (1.5.0.1)
+
GEM
remote: https://rubygems.org/
specs:
@@ -193,7 +198,6 @@ GEM
parser (>= 2.7.0.1)
ruby-progressbar (1.10.1)
rubyzip (2.3.2)
- rugged (1.2.0)
sanitize (6.0.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
@@ -247,7 +251,7 @@ DEPENDENCIES
rspec
rspec-parameterized
rubocop (~> 0.69)
- rugged (~> 1.2)
+ rugged!
sentry-raven (~> 3.0)
timecop

View file

@ -1,11 +0,0 @@
--- a/ruby/vendor/gitlab-shell/lib/gitlab_config.rb
+++ b/ruby/vendor/gitlab-shell/lib/gitlab_config.rb
@@ -4,7 +4,7 @@ class GitlabConfig
attr_reader :config
def initialize
- @config = YAML.load_file(File.join(ROOT_PATH, 'config.yml'))
+ @config = YAML.load_file(ENV.fetch('GITLAB_SHELL_CONFIG', '/etc/gitlab/gitlab-shell.yml'))
end
def home