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