# Maintainer: Antoine Martin (ayakael) # Contributor: Antoine Martin (ayakael) # Contributor: Jakub Jirutka pkgname=gitaly pkgver=15.3.3 pkgrel=4 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 " 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 $pkgname-blackbox $pkgname-praefect $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 } package() { local rubydir="$pkgdir/usr/lib/bundles/gitaly-ruby" ## Go part make install DESTDIR="$pkgdir" # Not very useful for us. rm "$pkgdir"/usr/bin/gitaly-debug rm "$pkgdir"/usr/bin/gitaly-wrapper install -m644 -D config.toml.example "$pkgdir"/etc/gitlab/gitaly.toml install -m644 -D config.praefect.toml.example "$pkgdir"/etc/gitlab/praefect.toml 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() { pkgdesc="Utility used by the backup Rake task to create/restore repository backups from Gitaly" depends="" amove usr/bin/gitaly-backup } # TODO: Add init script. blackbox() { pkgdesc="Prometheus exporter that measures GitLab server performance by performing a Git HTTP clone" depends="" amove etc/gitlab/gitaly-blackbox.toml amove usr/bin/gitaly-blackbox } # TODO: Add init script. praefect() { pkgdesc="A reverse-proxy for Gitaly to manage a cluster of Gitaly nodes for HA" depends="" amove etc/gitlab/praefect.toml amove usr/bin/praefect } sha512sums=" a3d4f929014df6f3e7034f493be9b27dcc1e820e42198582171a43c7ddf1bc9087329f13878f139a7d6dc1e6a92a76dabf26214409abe839d8f9508429f91ba0 gitaly-v15.3.3.tar.gz ebcb7296696b9c2b47b7770a37ae13663cb0343659d482ef45717ef5548ede69eedee707763c6dfd73c60ef303e03fbe5502967783c59c00475a1a6d0c5ee128 gemfile-use-local-grpc.patch f767ef16fbe708e6ca873242a8a4f53bf2f924ec3a901bce24af3fde36321004555d6161c96bfad0dbdbae9c19b5e8564d41e3b2e980a40bb199480ef69144f8 gemfile-use-local-rugged.patch 8779e34b2a468a74c590ee29155e7b197eabcd323157b1e27208fa2f3100b31e1fd1ff80d7067198e66cfb1be506caedeecbfeb4e9f32aa5b8422455e1718e1a config.patch c32105d921be16eaf559cf21d6840bc346cd92b5e37974cedecdb5a2d2ca1eb5e8fbb144f5fc8a1289bf9415102b313cf2d61ee510c80f08ab33a799f5ac7122 gitaly.initd "