user/gitaly: use ruby-rugged aport

This commit is contained in:
Antoine Martin 2023-03-10 00:39:07 -05:00 committed by Antoine Martin
parent 5aa6cb6ec0
commit 7afb21f089
3 changed files with 73 additions and 23 deletions

View file

@ -1,8 +1,9 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=gitaly
pkgver=15.3.3
pkgrel=2
pkgrel=3
pkgdesc="A Git RPC service for handling all the git calls made by GitLab"
url="https://gitlab.com/gitlab-org/gitaly/"
arch="all"
@ -22,12 +23,12 @@ makedepends="
go
icu-dev
libffi-dev
libgit2-dev
libssh2-dev
libxml2-dev
libxslt-dev
ruby-dev
ruby-grpc=~1.42.0
ruby-rugged=~1.5.0.1
zlib-dev
"
subpackages="
@ -35,11 +36,10 @@ subpackages="
$pkgname-blackbox
$pkgname-praefect
"
# FIXME: Makefile clones libgit2 and git repositories.
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
libgit-1.5-compat.patch
$pkgname.initd
"
builddir="$srcdir/$pkgname-v$pkgver"
@ -56,14 +56,16 @@ prepare() {
default_prepare
# This Google gem is totally messed, so we copy our fixed version
# Some gems are broken, so we copy our fixed version
# instead of installing it from RubyGems using Bundler.
mkdir -p ruby/vendor/grpc
cp -r "$sysgemdir"/gems/grpc-*/* ruby/vendor/grpc/
cp "$sysgemdir"/specifications/grpc-*.gemspec \
ruby/vendor/grpc/grpc.gemspec
cp "$sysgemdir"/extensions/*/*/grpc-*/grpc/*.so \
ruby/vendor/grpc/src/ruby/lib/grpc/
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() {
@ -73,12 +75,11 @@ build() {
bundle config --local build.nokogiri --use-system-libraries \
--with-xml2-include=/usr/include/libxml2 \
--with-xslt-include=/usr/include/libxslt
# can't use system-library for some reason on 1.5.0 and 1.5.1
# bundle config --local build.rugged --use-system-libraries
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 "development test"
bundle config --local without "$BUNDLE_WITHOUT"
bundle install --no-cache
@ -142,8 +143,7 @@ package() {
./*/Rakefile \
./*/README*
# Remove bundled libgit2 and pg_query sources.
rm -R rugged-*/vendor/libgit2
# Remove bundled pg_query sources.
rm -R pg_query-*/ext
# Remove assets, they are not used in gitaly-ruby.
@ -189,7 +189,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
c0c0fb03baefae34e117750c8b27ee67b18f8202161cbc202371d2f916ca419b82e5df0d5c3db23d9e2bb12d205e03dab51f61cd9e4ede2d0abe96de47c76e3f libgit-1.5-compat.patch
c32105d921be16eaf559cf21d6840bc346cd92b5e37974cedecdb5a2d2ca1eb5e8fbb144f5fc8a1289bf9415102b313cf2d61ee510c80f08ab33a799f5ac7122 gitaly.initd
"

View file

@ -0,0 +1,55 @@
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,5 +0,0 @@
--- a/ruby/Gemfile.lock
+++ b/ruby/Gemfile.lock
@@ -196 +196 @@
- rugged (1.2.0)
+ rugged (1.5.1)