Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom gemfile #889

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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