git: 3e88d545dd0a - main - www/gitlab: fix regression from dbc3f874de613640cbc2151dcc4fa39ce6433461

From: Matthias Fechner <mfechner_at_FreeBSD.org>
Date: Thu, 30 May 2024 08:53:16 UTC
The branch main has been updated by mfechner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3e88d545dd0adef68f06173cc0a6f9c6e52c15ae

commit 3e88d545dd0adef68f06173cc0a6f9c6e52c15ae
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2024-05-30 08:42:13 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2024-05-30 08:42:13 +0000

    www/gitlab: fix regression from dbc3f874de613640cbc2151dcc4fa39ce6433461
    
    bundler: failed to load command: puma (/usr/local/bin/puma)
    /usr/local/www/gitlab/config/initializers/redis_client_patch.rb:8:in `<top (required)>': New version of redis-client detected, please remove this file (RuntimeError)
---
 www/gitlab/Makefile                                |  1 +
 ...tch-config_initializers_redis__client__patch.rb | 78 ++++++++++++++++++++++
 2 files changed, 79 insertions(+)

diff --git a/www/gitlab/Makefile b/www/gitlab/Makefile
index 68f27acf8e10..164144f9a535 100644
--- a/www/gitlab/Makefile
+++ b/www/gitlab/Makefile
@@ -4,6 +4,7 @@ DISTVERSIONPREFIX=	v
 .if ${FLAVOR:U} == ee
 DISTVERSIONSUFFIX=	-ee
 .endif
+PORTREVISION=	1
 
 CATEGORIES=	www devel
 
diff --git a/www/gitlab/files/patch-config_initializers_redis__client__patch.rb b/www/gitlab/files/patch-config_initializers_redis__client__patch.rb
new file mode 100644
index 000000000000..6d90e4c483b1
--- /dev/null
+++ b/www/gitlab/files/patch-config_initializers_redis__client__patch.rb
@@ -0,0 +1,78 @@
+--- config/initializers/redis_client_patch.rb.orig	2024-05-30 08:36:06 UTC
++++ config/initializers/redis_client_patch.rb
+@@ -1,75 +1,3 @@
+ # frozen_string_literal: true
+-
+-require 'redis-client'
+-
+-# This patch can be dropped once https://github.com/redis-rb/redis-client/pull/197
+-# is released and merged.
+-if Gem::Version.new(RedisClient::VERSION) > Gem::Version.new('0.22.1') # rubocop:disable Style/GuardClause -- This is easier to read
+-  raise 'New version of redis-client detected, please remove this file'
+-end
+-
+-# rubocop:disable Gitlab/ModuleWithInstanceVariables -- This is an upstream gem
+-# rubocop:disable Style/GuardClause -- This is an upstream gem
+-class RedisClient
+-  module ConnectionMixin
+-    def call(command, timeout)
+-      @pending_reads += 1
+-      write(command)
+-      result = read(connection_timeout(timeout))
+-      @pending_reads -= 1
+-      if result.is_a?(Error)
+-        result._set_command(command)
+-        result._set_config(config)
+-        raise result
+-      else
+-        result
+-      end
+-    end
+-
+-    def call_pipelined(commands, timeouts, exception: true)
+-      first_exception = nil
+-
+-      size = commands.size
+-      results = Array.new(commands.size)
+-      @pending_reads += size
+-      write_multi(commands)
+-
+-      size.times do |index|
+-        timeout = timeouts && timeouts[index]
+-        result = read(connection_timeout(timeout))
+-        @pending_reads -= 1
+-
+-        # A multi/exec command can return an array of results.
+-        # An error from a multi/exec command is handled in Multi#_coerce!.
+-        if result.is_a?(Array)
+-          result.each do |res|
+-            res._set_config(config) if res.is_a?(Error)
+-          end
+-        elsif result.is_a?(Error)
+-          result._set_command(commands[index])
+-          result._set_config(config)
+-          first_exception ||= result
+-        end
+-
+-        results[index] = result
+-      end
+-
+-      if first_exception && exception
+-        raise first_exception
+-      else
+-        results
+-      end
+-    end
+-
+-    def connection_timeout(timeout)
+-      return timeout unless timeout && timeout > 0
+-
+-      # Can't use the command timeout argument as the connection timeout
+-      # otherwise it would be very racy. So we add the regular read_timeout on top
+-      # to account for the network delay.
+-      timeout + config.read_timeout
+-    end
+-  end
+-end
+ # rubocop:enable Gitlab/ModuleWithInstanceVariables
+ # rubocop:enable Style/GuardClause