public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] ruby-fakegem.eclass: Support other than standard bindir
@ 2015-12-21 20:16 Hans de Graaff
  0 siblings, 0 replies; only message in thread
From: Hans de Graaff @ 2015-12-21 20:16 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 3086 bytes --]

From a1162d3453b7aaef0294a427785e38da687fd547 Mon Sep 17 00:00:00 2001
From: Hans de Graaff <graaff@gentoo.org>
Date: Mon, 21 Dec 2015 21:08:13 +0100
Subject: [PATCH] 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
-- 
2.4.10

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-21 20:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-21 20:16 [gentoo-dev] [PATCH] ruby-fakegem.eclass: Support other than standard bindir Hans de Graaff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox