commit:     2f902a36a4952856f4b7737c3ec94159be772d2d
Author:     Tomas Mozes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Thu Nov 30 06:55:54 2017 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Tue Dec 12 20:34:53 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f902a36

app-emulation/vagrant: improve ruby version discovery.

Package-Manager: Portage-2.3.16, Repoman-2.3.6
Closes: https://github.com/gentoo/gentoo/pull/6352

 app-emulation/vagrant/files/vagrant.in-r1                 | 15 +++++++++++++--
 .../{vagrant-2.0.1.ebuild => vagrant-2.0.1-r1.ebuild}     |  0
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/app-emulation/vagrant/files/vagrant.in-r1 
b/app-emulation/vagrant/files/vagrant.in-r1
index 7c0405e8a83..134cb31f299 100644
--- a/app-emulation/vagrant/files/vagrant.in-r1
+++ b/app-emulation/vagrant/files/vagrant.in-r1
@@ -5,16 +5,27 @@
 # so that everything loads and compiles to proper directories.
 
 for r in ruby24 ruby23 ruby22; do
+  # not all ruby versions are guaranteed to be installed
+  if ! command -v "${r}" >/dev/null 2>&1; then
+    continue
+  fi
+
   VAGRANT_DIR="$( "${r}" -e 'print Gem::default_path[-1] + 
"/gems/vagrant-@VAGRANT_VERSION@"' )"
+
   # Export the VAGRANT_EXECUTABLE so that pre-rubygems can optimize a bit
   export VAGRANT_EXECUTABLE="${VAGRANT_DIR}/bin/vagrant"
-  "${r}" "${VAGRANT_EXECUTABLE}" "version" &> /dev/null
-  if [ $? -eq 0 ]; then
+
+  if [ -f ${VAGRANT_EXECUTABLE} ] ;then
     ruby="${r}"
     break
   fi
 done
 
+if [ -z ${ruby} ]; then
+  echo "Error: failed to find any usable ruby"
+  exit 1
+fi
+
 # Export GEM_HOME based on VAGRANT_HOME
 #
 # This needs to be set because Bundler includes gem paths

diff --git a/app-emulation/vagrant/vagrant-2.0.1.ebuild 
b/app-emulation/vagrant/vagrant-2.0.1-r1.ebuild
similarity index 100%
rename from app-emulation/vagrant/vagrant-2.0.1.ebuild
rename to app-emulation/vagrant/vagrant-2.0.1-r1.ebuild

Reply via email to