commit: d0d66933b9a8e7ad8bc3c75e03795f7db2399e71
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 21 20:08:13 2015 +0000
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Wed Dec 30 08:10:07 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0d66933
eclass/ruby-fakegem.eclass: support non-default bindir
By default gems can provide binaries to be bin-wrapped in /usr/bin in a
directory called "bin" in the gem. This is only a default, and it is
possible for the gem to indicate that another directory contains the
binaries to be bin-wrapped using the gemspec bindir option.
dev-ruby/rspec-core and dev-ruby/bundler are gems where the
binaries are placed in an "exe" directory.
This change introduces RUBY_FAKEGEM_BINDIR, defaulting to "bin" for
backward compatibility, allowing this directory to be specified.
eclass/ruby-fakegem.eclass | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index 7f2b075..977c68f 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -82,6 +82,12 @@ inherit ruby-ng
# Binaries to wrap around (relative to the bin/ directory)
# RUBY_FAKEGEM_BINWRAP="*"
+# @ECLASS-VARIABLE: RUBY_FAKEGEM_BINDIR
+# @DESCRIPTION:
+# Path that contains binaries to be binwrapped. Equivalent to the
+# gemspec bindir option.
+# RUBY_FAKEGEM_BINDIR="bin"
+
# @ECLASS-VARIABLE: RUBY_FAKEGEM_REQUIRE_PATHS
# @DESCRIPTION:
# Extra require paths (beside lib) to add to the specification
@@ -111,6 +117,7 @@ RUBY_FAKEGEM_RECIPE_TEST="${RUBY_FAKEGEM_RECIPE_TEST-rake}"
RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}"
RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}"
+RUBY_FAKEGEM_BINDIR="${RUBY_FAKEGEM_BINDIR-bin}"
[[ ${RUBY_FAKEGEM_TASK_DOC} == "" ]] && RUBY_FAKEGEM_RECIPE_DOC="none"
@@ -319,7 +326,7 @@ ruby_fakegem_binwrapper() {
local gembinary=$1
local newbinary=${2:-/usr/bin/$gembinary}
local content=$3
- local
relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary}
+ local
relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/${RUBY_FAKEGEM_BINDIR}/${gembinary}
local binpath=$(dirname $newbinary)
[[ ${binpath} = . ]] && binpath=/usr/bin
@@ -475,7 +482,7 @@ each_fakegem_install() {
ruby_fakegem_install_gemspec
local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}"
- for directory in bin lib; do
+ for directory in "${RUBY_FAKEGEM_BINDIR}" lib; do
[[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs}
${directory}"
done
@@ -511,7 +518,7 @@ all_fakegem_install() {
# binary wrappers; we assume that all the implementations get the
# same binaries, or something is wrong anyway, so...
if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then
- local bindir=$(find "${D}" -type d -path
"*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit)
+ local bindir=$(find "${D}" -type d -path
"*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/${RUBY_FAKEGEM_BINDIR}"
-print -quit)
if [[ -d "${bindir}" ]]; then
pushd "${bindir}" &>/dev/null || die