From 8084283b251f377a1153b83135a44786b1ab5ada Mon Sep 17 00:00:00 2001 From: Miroslav Lisik Date: Tue, 7 Jan 2025 16:00:21 +0100 Subject: [PATCH] Allow to use custom Gemfile --- configure.ac | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 82b328c67..1737f40e5 100644 --- a/configure.ac +++ b/configure.ac @@ -303,6 +303,10 @@ AC_ARG_WITH([snmp-mibs-dir], [SNMP_MIB_DIR="$prefix/share/snmp/mibs"]) AC_SUBST([SNMP_MIB_DIR]) +AC_ARG_WITH([custom-gemfile], + [AS_HELP_STRING([--with-custom-gemfile=PATH], [Use custom gemfile instead of autogenerated. Effective only with the local-build option. Default: empty])], + [PCS_CUSTOM_GEMFILE="$withval"]) + # python detection section PCS_BUNDLED_DIR_LOCAL="pcs_bundled" AC_SUBST([PCS_BUNDLED_DIR_LOCAL]) @@ -397,12 +401,26 @@ AC_SUBST([PCSD_BUNDLED_DIR_LOCAL]) AC_SUBST([PCSD_BUNDLED_CACHE_DIR]) rm -rf Gemfile Gemfile.lock -echo "source 'https://rubygems.org'" > Gemfile -echo "" >> Gemfile + +if test "x$local_build" = "xyes"; then + if test "x$PCS_CUSTOM_GEMFILE" != "x"; then + if ! test -e "$PCS_CUSTOM_GEMFILE"; then + AC_MSG_ERROR([custom gemfile '$PCS_CUSTOM_GEMFILE' does not exist]) + fi + cp "$PCS_CUSTOM_GEMFILE" Gemfile + else + echo "source 'https://rubygems.org'" > Gemfile + echo "" >> Gemfile + fi +fi # PCS_BUNDLE_GEM([module]) AC_DEFUN([PCS_BUNDLE_GEM], [ - echo "gem '$1'" >> Gemfile + if test "x$PCS_CUSTOM_GEMFILE" = "x"; then + echo "gem '$1'" >> Gemfile + else + grep "$1" Gemfile || AC_MSG_ERROR([custom gemfile missing required gem '$1']) + fi if test "x$cache_only" = "xyes"; then src=`ls $PCSD_BUNDLED_CACHE_DIR/$1-*` if test "x$src" = "x"; then