public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument
@ 2021-04-12  8:29 Florian Schmaus
  2021-04-12  8:29 ` [gentoo-dev] [PATCH 2/3] rebar.eclass: s,$1,${1}, Florian Schmaus
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Florian Schmaus @ 2021-04-12  8:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Previously "pkgcheck scan rebar.class" would complain about

EclassDocError: rebar: failed parsing eclass docs: '@RETURN:', line 61: non-inline arg

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
---
 eclass/rebar.eclass | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 7f712905c407..88c9ca74be73 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -53,9 +53,7 @@ get_erl_libs() {
 # @FUNCTION: _rebar_find_dep
 # @INTERNAL
 # @USAGE: <project_name>
-# @RETURN: full path with EPREFIX to a Erlang package/project on success,
-# code 1 when dependency is not found and code 2 if multiple versions of
-# dependency are found.
+# @RETURN: full path with EPREFIX to Erlang package/project on success, code 1 when dependency is not found and code 2 if multiple versions of dependency are found.
 # @DESCRIPTION:
 # Find a Erlang package/project by name in Erlang lib directory. Project
 # directory is usually suffixed with version. It is matched to '<project_name>'
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 2/3] rebar.eclass: s,$1,${1},
  2021-04-12  8:29 [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Florian Schmaus
@ 2021-04-12  8:29 ` Florian Schmaus
  2021-04-12  8:29 ` [gentoo-dev] [PATCH 3/3] rebar.eclass: add support for EAPI 7 Florian Schmaus
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Schmaus @ 2021-04-12  8:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

---
 eclass/rebar.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 88c9ca74be73..2ec255486463 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -59,7 +59,7 @@ get_erl_libs() {
 # directory is usually suffixed with version. It is matched to '<project_name>'
 # or '<project_name>-*'.
 _rebar_find_dep() {
-	local pn="$1"
+	local pn="${1}"
 	local p
 	local result
 
@@ -121,7 +121,7 @@ erebar() {
 rebar_fix_include_path() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local pn="$1"
+	local pn="${1}"
 	local rebar_config="${2:-rebar.config}"
 	local erl_libs="${EPREFIX}$(get_erl_libs)"
 	local p
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 3/3] rebar.eclass: add support for EAPI 7
  2021-04-12  8:29 [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Florian Schmaus
  2021-04-12  8:29 ` [gentoo-dev] [PATCH 2/3] rebar.eclass: s,$1,${1}, Florian Schmaus
@ 2021-04-12  8:29 ` Florian Schmaus
  2021-04-12 10:30 ` [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Ulrich Mueller
  2021-04-14 20:09 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Schmaus @ 2021-04-12  8:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Thanks To Sam James for reviewing this and providing feedback.

Closes: https://bugs.gentoo.org/770283
Signed-off-by: Florian Schmaus <flo@geekplace.eu>
---
 eclass/rebar.eclass | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 2ec255486463..c6781b211470 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: rebar.eclass
@@ -6,7 +6,7 @@
 # maintainer-needed@gentoo.org
 # @AUTHOR:
 # Amadeusz Żołnowski <aidecoe@gentoo.org>
-# @SUPPORTED_EAPIS: 6
+# @SUPPORTED_EAPIS: 6 7
 # @BLURB: Build Erlang/OTP projects using dev-util/rebar.
 # @DESCRIPTION:
 # An eclass providing functions to build Erlang/OTP projects using
@@ -23,7 +23,7 @@ case "${EAPI:-0}" in
 	0|1|2|3|4|5)
 		die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
 		;;
-	6)
+	6|7)
 		;;
 	*)
 		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
@@ -33,9 +33,14 @@ esac
 EXPORT_FUNCTIONS src_prepare src_compile src_test src_install
 
 RDEPEND="dev-lang/erlang:="
-DEPEND="${RDEPEND}
+DEPEND="${RDEPEND}"
+BDEPEND="
 	dev-util/rebar
-	>=sys-apps/gawk-4.1"
+	>=sys-apps/gawk-4.1
+"
+if [[ ${EAPI} == 6 ]]; then
+	DEPEND+="${BDEPEND}"
+fi
 
 # @ECLASS-VARIABLE: REBAR_APP_SRC
 # @DESCRIPTION:
@@ -63,7 +68,7 @@ _rebar_find_dep() {
 	local p
 	local result
 
-	pushd "${EPREFIX}$(get_erl_libs)" >/dev/null || return 1
+	pushd "${EPREFIX%/}/$(get_erl_libs)" >/dev/null || return 1
 	for p in ${pn} ${pn}-*; do
 		if [[ -d ${p} ]]; then
 			# Ensure there's at most one matching.
@@ -102,7 +107,7 @@ erebar() {
 
 	(( $# > 0 )) || die "erebar: at least one target is required"
 
-	local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
+	local -x ERL_LIBS="${EPREFIX%/}/$(get_erl_libs)"
 	[[ ${1} == eunit ]] && local -x ERL_LIBS="."
 
 	rebar -v skip_deps=true "$@" || die -n "rebar $@ failed"
@@ -123,7 +128,7 @@ rebar_fix_include_path() {
 
 	local pn="${1}"
 	local rebar_config="${2:-rebar.config}"
-	local erl_libs="${EPREFIX}$(get_erl_libs)"
+	local erl_libs="${EPREFIX%/}/$(get_erl_libs)"
 	local p
 
 	p="$(_rebar_find_dep "${pn}")" \
@@ -212,7 +217,7 @@ rebar_src_prepare() {
 rebar_src_configure() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
+	local -x ERL_LIBS="${EPREFIX%/}/$(get_erl_libs)"
 	default
 }
 
@@ -252,7 +257,7 @@ rebar_src_install() {
 	[[ -d bin ]] && for bin in bin/*; do dobin "$bin"; done
 
 	if [[ -d priv ]]; then
-		cp -pR priv "${ED}${dest}/" || die "failed to install priv/"
+		cp -pR priv "${ED%/}/${dest}/" || die "failed to install priv/"
 	fi
 
 	einstalldocs
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument
  2021-04-12  8:29 [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Florian Schmaus
  2021-04-12  8:29 ` [gentoo-dev] [PATCH 2/3] rebar.eclass: s,$1,${1}, Florian Schmaus
  2021-04-12  8:29 ` [gentoo-dev] [PATCH 3/3] rebar.eclass: add support for EAPI 7 Florian Schmaus
@ 2021-04-12 10:30 ` Ulrich Mueller
  2021-04-14 20:09 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
  3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Mueller @ 2021-04-12 10:30 UTC (permalink / raw
  To: Florian Schmaus; +Cc: gentoo-dev

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

>>>>> On Mon, 12 Apr 2021, Florian Schmaus wrote:

> -# @RETURN: full path with EPREFIX to a Erlang package/project on success,
> -# code 1 when dependency is not found and code 2 if multiple versions of
> -# dependency are found.
> +# @RETURN: full path with EPREFIX to Erlang package/project on success, code 1 when dependency is not found and code 2 if multiple versions of dependency are found.

I think the cure is worse than the disease here.

That @RETURN is supposed to be in one line means that it should be short
(otherwise it would be read as a paragraph). Any lenghty description
belongs in @DESCRIPTION instead.

Also, the "full path" is the function's output, not its return value.

So, suggestion:
# @RETURN: 0 success, 1 dependency not found, 2 multiple versions found

(and the rest can go into @DESCRIPTION).

Ulrich

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH v2] rebar.eclass: fix @RETURN argument
  2021-04-12  8:29 [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Florian Schmaus
                   ` (2 preceding siblings ...)
  2021-04-12 10:30 ` [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Ulrich Mueller
@ 2021-04-14 20:09 ` Florian Schmaus
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Schmaus @ 2021-04-14 20:09 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Previously "pkgcheck scan rebar.class" would complain about

EclassDocError: rebar: failed parsing eclass docs: '@RETURN:', line 61: non-inline arg

Thanks to Ulrich Müller for providing feedback.

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
---
 eclass/rebar.eclass | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 7f712905c407..f43c036b22ea 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -53,9 +53,7 @@ get_erl_libs() {
 # @FUNCTION: _rebar_find_dep
 # @INTERNAL
 # @USAGE: <project_name>
-# @RETURN: full path with EPREFIX to a Erlang package/project on success,
-# code 1 when dependency is not found and code 2 if multiple versions of
-# dependency are found.
+# @RETURN: 0 success, 1 dependency not found, 2 multiple versions found
 # @DESCRIPTION:
 # Find a Erlang package/project by name in Erlang lib directory. Project
 # directory is usually suffixed with version. It is matched to '<project_name>'
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-14 20:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-12  8:29 [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Florian Schmaus
2021-04-12  8:29 ` [gentoo-dev] [PATCH 2/3] rebar.eclass: s,$1,${1}, Florian Schmaus
2021-04-12  8:29 ` [gentoo-dev] [PATCH 3/3] rebar.eclass: add support for EAPI 7 Florian Schmaus
2021-04-12 10:30 ` [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument Ulrich Mueller
2021-04-14 20:09 ` [gentoo-dev] [PATCH v2] " Florian Schmaus

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