1 |
commit: d0d66933b9a8e7ad8bc3c75e03795f7db2399e71 |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 21 20:08:13 2015 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 30 08:10:07 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0d66933 |
7 |
|
8 |
eclass/ruby-fakegem.eclass: support non-default bindir |
9 |
|
10 |
By default gems can provide binaries to be bin-wrapped in /usr/bin in a |
11 |
directory called "bin" in the gem. This is only a default, and it is |
12 |
possible for the gem to indicate that another directory contains the |
13 |
binaries to be bin-wrapped using the gemspec bindir option. |
14 |
dev-ruby/rspec-core and dev-ruby/bundler are gems where the |
15 |
binaries are placed in an "exe" directory. |
16 |
|
17 |
This change introduces RUBY_FAKEGEM_BINDIR, defaulting to "bin" for |
18 |
backward compatibility, allowing this directory to be specified. |
19 |
|
20 |
eclass/ruby-fakegem.eclass | 13 ++++++++++--- |
21 |
1 file changed, 10 insertions(+), 3 deletions(-) |
22 |
|
23 |
diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass |
24 |
index 7f2b075..977c68f 100644 |
25 |
--- a/eclass/ruby-fakegem.eclass |
26 |
+++ b/eclass/ruby-fakegem.eclass |
27 |
@@ -82,6 +82,12 @@ inherit ruby-ng |
28 |
# Binaries to wrap around (relative to the bin/ directory) |
29 |
# RUBY_FAKEGEM_BINWRAP="*" |
30 |
|
31 |
+# @ECLASS-VARIABLE: RUBY_FAKEGEM_BINDIR |
32 |
+# @DESCRIPTION: |
33 |
+# Path that contains binaries to be binwrapped. Equivalent to the |
34 |
+# gemspec bindir option. |
35 |
+# RUBY_FAKEGEM_BINDIR="bin" |
36 |
+ |
37 |
# @ECLASS-VARIABLE: RUBY_FAKEGEM_REQUIRE_PATHS |
38 |
# @DESCRIPTION: |
39 |
# Extra require paths (beside lib) to add to the specification |
40 |
@@ -111,6 +117,7 @@ RUBY_FAKEGEM_RECIPE_TEST="${RUBY_FAKEGEM_RECIPE_TEST-rake}" |
41 |
RUBY_FAKEGEM_TASK_TEST="${RUBY_FAKEGEM_TASK_TEST-test}" |
42 |
|
43 |
RUBY_FAKEGEM_BINWRAP="${RUBY_FAKEGEM_BINWRAP-*}" |
44 |
+RUBY_FAKEGEM_BINDIR="${RUBY_FAKEGEM_BINDIR-bin}" |
45 |
|
46 |
[[ ${RUBY_FAKEGEM_TASK_DOC} == "" ]] && RUBY_FAKEGEM_RECIPE_DOC="none" |
47 |
|
48 |
@@ -319,7 +326,7 @@ ruby_fakegem_binwrapper() { |
49 |
local gembinary=$1 |
50 |
local newbinary=${2:-/usr/bin/$gembinary} |
51 |
local content=$3 |
52 |
- local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin/${gembinary} |
53 |
+ local relativegembinary=${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/${RUBY_FAKEGEM_BINDIR}/${gembinary} |
54 |
local binpath=$(dirname $newbinary) |
55 |
[[ ${binpath} = . ]] && binpath=/usr/bin |
56 |
|
57 |
@@ -475,7 +482,7 @@ each_fakegem_install() { |
58 |
ruby_fakegem_install_gemspec |
59 |
|
60 |
local _gemlibdirs="${RUBY_FAKEGEM_EXTRAINSTALL}" |
61 |
- for directory in bin lib; do |
62 |
+ for directory in "${RUBY_FAKEGEM_BINDIR}" lib; do |
63 |
[[ -d ${directory} ]] && _gemlibdirs="${_gemlibdirs} ${directory}" |
64 |
done |
65 |
|
66 |
@@ -511,7 +518,7 @@ all_fakegem_install() { |
67 |
# binary wrappers; we assume that all the implementations get the |
68 |
# same binaries, or something is wrong anyway, so... |
69 |
if [[ -n ${RUBY_FAKEGEM_BINWRAP} ]]; then |
70 |
- local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/bin" -print -quit) |
71 |
+ local bindir=$(find "${D}" -type d -path "*/gems/${RUBY_FAKEGEM_NAME}-${RUBY_FAKEGEM_VERSION}/${RUBY_FAKEGEM_BINDIR}" -print -quit) |
72 |
|
73 |
if [[ -d "${bindir}" ]]; then |
74 |
pushd "${bindir}" &>/dev/null || die |