Skip to content

Commit

Permalink
Allow to use custom Gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mirecheck committed Jan 7, 2025
1 parent 1353dfb commit d1f63c3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d1f63c3

Please sign in to comment.