From 5097bd10bf7b09ac0fe46ef9c5c207c458ba2b47 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Sun, 25 Jun 2023 10:48:17 -0400
Subject: [PATCH] user/gitlab-foss: upgrade to 16.1.0

---
 user/gitlab-foss/APKBUILD              | 17 +++++-----
 user/gitlab-foss/database-config.patch | 41 ++++++++++++-----------
 user/gitlab-foss/openssl3-compat.patch | 45 --------------------------
 3 files changed, 32 insertions(+), 71 deletions(-)
 delete mode 100644 user/gitlab-foss/openssl3-compat.patch

diff --git a/user/gitlab-foss/APKBUILD b/user/gitlab-foss/APKBUILD
index 941e5c0..38a7d06 100644
--- a/user/gitlab-foss/APKBUILD
+++ b/user/gitlab-foss/APKBUILD
@@ -3,7 +3,7 @@
 # Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
 pkgname=gitlab-foss
 _pkgname=${pkgname%-foss}
-pkgver=15.11.2
+pkgver=16.1.0
 _gittag=v$pkgver
 pkgrel=0
 pkgdesc="A version control for your server"
@@ -16,9 +16,9 @@ depends="
 	ca-certificates
 	cmd:dpkg-deb
 	exiftool
-	git>=2.18.0
-	gitaly~=15.3
-	gitlab-shell~=14.19
+	git>=2.40.0
+	gitaly~=16.1
+	gitlab-shell~=14.23
 	graphicsmagick
 	http-parser
 	procps
@@ -65,7 +65,6 @@ install="$pkgname.pre-install $pkgname.post-install $pkgname.post-upgrade"
 subpackages="$pkgname-assets::noarch $pkgname-openrc"
 source="https://gitlab.com/gitlab-org/gitlab-foss/-/archive/$_gittag/gitlab-foss-$_gittag.tar.gz
 	database-config.patch
-	openssl3-compat.patch
 	$_pkgname.initd
 	$_pkgname.mailroom.initd
 	$_pkgname.rails.initd
@@ -100,6 +99,9 @@ prepare() {
 	# Remove all locale files except en.
 	find locale -type d -mindepth 1 ! -name en -exec rm -rf {} +
 
+	# Allow use of any bundler
+	sed -i -e '/BUNDLED/,+1d' Gemfile.lock
+
 	# Some gems are broken, so we copy our fixed version
 	# instead of installing it from RubyGems using Bundler.
 	for i in grpc rugged; do
@@ -372,9 +374,8 @@ assets() {
 }
 
 sha512sums="
-6e88209455d6e7cbb9473088aa7749e96de8cb5bfa68ec304acaf3f06d2086944139617ba59e0e49a1e76a95ad49ba5f8d372f186a156ae6e7c757cd215abea6  gitlab-foss-v15.11.2.tar.gz
-f8b6855445e4086b4a4059a6359fafe7ca78ccf9ed6953a5b2a606d02add9519bb98ccf5f4a3bb750b94cfc44e660e70186813f7c7296fac343377e922e8a54a  database-config.patch
-43e660c5ed7efea41c6dbeb68cd00bcefe628b2b9154e2362b29bdfc51cc97fde2cbe7e9f01bb3be067cd511373a5cf8a7a8a2199b6efe96375638550f0b08ae  openssl3-compat.patch
+0cf2960380fcd397dfad611bbfc565aab2245eef0c42f0260502d199238ffab1c293b0827ac7b2b80bac5984a4ec2e553c83f0a12ac53aca912d57027ad5bdc1  gitlab-foss-v16.1.0.tar.gz
+cdba615287c0a024c6589b5142543856393c8e5df3d21d2158908b34857d3d56581fe0bd66fa31cd3ff756c60f9f65f235c8ec7615a0970f7a87bbeb41be93ed  database-config.patch
 55b0667d3969113ffd6860652ee8bdb9a534c25f413f33b2739e922c886988e7cea72c1c00c7eecf29fcff3682b1324156365605ffc6aae45d1e0ccddf96288b  gitlab.initd
 1f451b67a5d5e58650b0fe862a2b65cfb8bff5502b37d94ae90619c1ff9affbecf24428303a2849bebce5f94bef37078f0e5710e344bbab616134e910938384a  gitlab.mailroom.initd
 b6a6d9ba20557e61efa24f2d5a489873fefbb981f7d4465794a857b2971263c08ec29cc001c372522cdc0d48245e59751307c9f44f6ef4d87bf2e3ec5c23fb1c  gitlab.rails.initd
diff --git a/user/gitlab-foss/database-config.patch b/user/gitlab-foss/database-config.patch
index 1d5a717..6ed3592 100644
--- a/user/gitlab-foss/database-config.patch
+++ b/user/gitlab-foss/database-config.patch
@@ -1,11 +1,11 @@
 diff --git a/config/database.yml.postgresql.orig b/config/database.yml.postgresql
-index c1b1247..dbe5b77 100644
+index b210b9c..9006120 100644
 --- a/config/database.yml.postgresql.orig
 +++ b/config/database.yml.postgresql
-@@ -26,14 +26,7 @@ production:
-   #   username: git
-   #   password: "secure password"
-   #   host: localhost
+@@ -26,13 +26,6 @@ production:
+     username: git
+     password: "secure password"
+     host: localhost
 -  geo:
 -    adapter: postgresql
 -    encoding: unicode
@@ -13,15 +13,13 @@ index c1b1247..dbe5b77 100644
 -    username: git
 -    password: "secure password"
 -    host: localhost
--
-+ 
+ 
  #
  # Development specific
- #
 @@ -57,13 +50,6 @@ development:
-   #   host: localhost
-   #   variables:
-   #     statement_timeout: 15s
+     host: localhost
+     variables:
+       statement_timeout: 15s
 -  geo:
 -    adapter: postgresql
 -    encoding: unicode
@@ -33,9 +31,9 @@ index c1b1247..dbe5b77 100644
  #
  # Staging specific
 @@ -84,13 +70,6 @@ staging:
-   #   username: git
-   #   password: "secure password"
-   #   host: localhost
+     username: git
+     password: "secure password"
+     host: localhost
 -  geo:
 -    adapter: postgresql
 -    encoding: unicode
@@ -46,10 +44,10 @@ index c1b1247..dbe5b77 100644
  
  # Warning: The database defined as "test" will be erased and
  # re-generated from your development database when you run "rake".
-@@ -117,10 +96,3 @@ test: &test
-   #   prepared_statements: false
-   #   variables:
-   #     statement_timeout: 15s
+@@ -117,17 +96,3 @@ test: &test
+     prepared_statements: false
+     variables:
+       statement_timeout: 15s
 -  geo:
 -    adapter: postgresql
 -    encoding: unicode
@@ -57,3 +55,10 @@ index c1b1247..dbe5b77 100644
 -    username: postgres
 -    password:
 -    host: localhost
+-  embedding:
+-    adapter: postgresql
+-    encoding: unicode
+-    database: gitlabhq_embedding_test
+-    username: postgres
+-    password:
+-    host: localhost
diff --git a/user/gitlab-foss/openssl3-compat.patch b/user/gitlab-foss/openssl3-compat.patch
deleted file mode 100644
index b1b726d..0000000
--- a/user/gitlab-foss/openssl3-compat.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-diff --git a/Gemfile.lock.orig b/Gemfile.lock
-index 2940d61..ee81009 100644
---- a/Gemfile.lock.orig
-+++ b/Gemfile.lock
-@@ -1093,8 +1093,7 @@ GEM
-       validate_email
-       validate_url
-       webfinger (>= 1.0.1)
--    openssl (2.2.2)
--      ipaddr
-+    openssl (3.1.0)
-     openssl-signature_algorithm (1.3.0)
-       openssl (> 2.0)
-     opentracing (0.5.0)
-@@ -1855,7 +1854,7 @@ DEPENDENCIES
-   omniauth_crowd (~> 2.4.0)!
-   omniauth_openid_connect (~> 0.6.1)
-   openid_connect (= 1.3.0)
--  openssl (= 2.2.2)
-+  openssl (~> 3.0)
-   org-ruby (~> 0.9.12)
-   pact (~> 1.63)
-   parallel (~> 1.19)
-@@ -1967,4 +1966,4 @@ DEPENDENCIES
-   yajl-ruby (~> 1.4.3)
- 
- BUNDLED WITH
--   2.4.12
-+   2.3.26
-diff --git a/Gemfile.orig b/Gemfile
-index 5c2d39a..c0688f9 100644
---- a/Gemfile.orig
-+++ b/Gemfile
-@@ -17,9 +17,8 @@ gem 'rails', '~> 6.1.7.2'
- 
- gem 'bootsnap', '~> 1.16.0', require: false
- 
--# Pin openssl to match the version bundled with our supported Rubies.
--# See https://stdgems.org/openssl/#gem-version.
--gem 'openssl', '2.2.2'
-+gem 'openssl', '~> 3.0'
-+
- gem 'ipaddr', '~> 1.2.5'
- 
- # Responders respond_to and respond_with