* [gentoo-dev] RFC: ant-tasks.eclass patch
@ 2019-09-25 18:47 Miroslav Šulc
2019-09-25 19:44 ` Michał Górny
0 siblings, 1 reply; 3+ messages in thread
From: Miroslav Šulc @ 2019-09-25 18:47 UTC (permalink / raw
To: gentoo-dev@lists.gentoo.org
[-- Attachment #1: Type: text/plain, Size: 535 bytes --]
hi,
as per bug https://bugs.gentoo.org/693022 we need to add dependency on
dev-java/gnu-jaf (or dev-java/sun-jaf) to the package. unfortunately
ant-tasks.eclass variable ANT_TASK_DEPNAME supports only single
dependency (it was sufficient till now), but we need one more in this
case. the introduced patch adds support for alternatively specifying
ANT_TASK_DEPNAME as an array and handle it correctly. i've tested the
patch and all seems to work fine.
please let me know if something can/should be improved.
thanks.
miroslav
[-- Attachment #2: ant-tasks.eclass.patch --]
[-- Type: text/x-patch, Size: 1709 bytes --]
diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
index 309df084d156..26df9de26f1a 100644
--- a/eclass/ant-tasks.eclass
+++ b/eclass/ant-tasks.eclass
@@ -54,7 +54,9 @@ ANT_TASK_NAME="${PN#ant-}"
# @DESCRIPTION:
# Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
# that this one depends on. Defaults to the name of ant task, ebuild can
-# override it before inheriting this eclass.
+# override it before inheriting this eclass. In case there is more than one
+# dependency, the variable can be specified as bash array with multiple strings,
+# one for each dependency.
ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
# @ECLASS-VARIABLE: ANT_TASK_DISABLE_VM_DEPS
@@ -105,7 +107,7 @@ S="${WORKDIR}/${MY_P}"
# base: performs the unpack, build.xml replacement and symlinks ant.jar from
# ant-core
#
-# jar-dep: symlinks the jar file(s) from dependency package
+# jar-dep: symlinks the jar file(s) from dependency package(s)
ant-tasks_src_unpack() {
[[ -z "${1}" ]] && ant-tasks_src_unpack all
@@ -129,9 +131,17 @@ ant-tasks_src_unpack() {
# ant.jar to build against
java-pkg_jar-from --build-only ant-core ant.jar;;
jar-dep)
- # get jar from the dependency package
+ # get jar from the dependency package(s)
if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
- java-pkg_jar-from ${ANT_TASK_DEPNAME}
+ local array=$(declare -p ANT_TASK_DEPNAME | grep "^declare \-a")
+
+ if [[ -n "${array}" ]]; then
+ for depname in "${ANT_TASK_DEPNAME[@]}"; do
+ java-pkg_jar-from ${depname}
+ done
+ else
+ java-pkg_jar-from ${ANT_TASK_DEPNAME}
+ fi
fi;;
all)
ant-tasks_src_unpack base jar-dep;;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] RFC: ant-tasks.eclass patch
2019-09-25 18:47 [gentoo-dev] RFC: ant-tasks.eclass patch Miroslav Šulc
@ 2019-09-25 19:44 ` Michał Górny
2019-09-26 8:05 ` Miroslav Šulc
0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2019-09-25 19:44 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2149 bytes --]
On Wed, 2019-09-25 at 20:47 +0200, Miroslav Šulc wrote:
> diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
> index 309df084d156..26df9de26f1a 100644
> --- a/eclass/ant-tasks.eclass
> +++ b/eclass/ant-tasks.eclass
> @@ -54,7 +54,9 @@ ANT_TASK_NAME="${PN#ant-}"
> # @DESCRIPTION:
> # Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
> # that this one depends on. Defaults to the name of ant task, ebuild can
> -# override it before inheriting this eclass.
> +# override it before inheriting this eclass. In case there is more than one
> +# dependency, the variable can be specified as bash array with multiple strings,
> +# one for each dependency.
> ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
>
> # @ECLASS-VARIABLE: ANT_TASK_DISABLE_VM_DEPS
> @@ -105,7 +107,7 @@ S="${WORKDIR}/${MY_P}"
> # base: performs the unpack, build.xml replacement and symlinks ant.jar from
> # ant-core
> #
> -# jar-dep: symlinks the jar file(s) from dependency package
> +# jar-dep: symlinks the jar file(s) from dependency package(s)
> ant-tasks_src_unpack() {
> [[ -z "${1}" ]] && ant-tasks_src_unpack all
>
> @@ -129,9 +131,17 @@ ant-tasks_src_unpack() {
> # ant.jar to build against
> java-pkg_jar-from --build-only ant-core ant.jar;;
> jar-dep)
> - # get jar from the dependency package
> + # get jar from the dependency package(s)
> if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
> - java-pkg_jar-from ${ANT_TASK_DEPNAME}
> + local array=$(declare -p ANT_TASK_DEPNAME | grep "^declare \-a")
> +
> + if [[ -n "${array}" ]]; then
> + for depname in "${ANT_TASK_DEPNAME[@]}"; do
> + java-pkg_jar-from ${depname}
> + done
I don't think you need two branches here. Non-array variable is
equivalent to an array with a single element for the purpose of [@], so
your 'for' loop will work correctly both for non-array and array.
> + else
> + java-pkg_jar-from ${ANT_TASK_DEPNAME}
> + fi
> fi;;
> all)
> ant-tasks_src_unpack base jar-dep;;
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] RFC: ant-tasks.eclass patch
2019-09-25 19:44 ` Michał Górny
@ 2019-09-26 8:05 ` Miroslav Šulc
0 siblings, 0 replies; 3+ messages in thread
From: Miroslav Šulc @ 2019-09-26 8:05 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 419 bytes --]
Dne 25. 09. 19 v 21:44 Michał Górny napsal(a):
> On Wed, 2019-09-25 at 20:47 +0200, Miroslav Šulc wrote:
>> ...
> I don't think you need two branches here. Non-array variable is
> equivalent to an array with a single element for the purpose of [@], so
> your 'for' loop will work correctly both for non-array and array.
thanks, you're right, i simplified the patch (attached) and all my tests
passed.
miroslav
[-- Attachment #2: ant-tasks.eclass.patch --]
[-- Type: text/x-patch, Size: 1533 bytes --]
diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
index 309df084d156..04c6fb5b7d67 100644
--- a/eclass/ant-tasks.eclass
+++ b/eclass/ant-tasks.eclass
@@ -54,7 +54,9 @@ ANT_TASK_NAME="${PN#ant-}"
# @DESCRIPTION:
# Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
# that this one depends on. Defaults to the name of ant task, ebuild can
-# override it before inheriting this eclass.
+# override it before inheriting this eclass. In case there is more than one
+# dependency, the variable can be specified as bash array with multiple strings,
+# one for each dependency.
ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
# @ECLASS-VARIABLE: ANT_TASK_DISABLE_VM_DEPS
@@ -105,7 +107,7 @@ S="${WORKDIR}/${MY_P}"
# base: performs the unpack, build.xml replacement and symlinks ant.jar from
# ant-core
#
-# jar-dep: symlinks the jar file(s) from dependency package
+# jar-dep: symlinks the jar file(s) from dependency package(s)
ant-tasks_src_unpack() {
[[ -z "${1}" ]] && ant-tasks_src_unpack all
@@ -129,9 +131,11 @@ ant-tasks_src_unpack() {
# ant.jar to build against
java-pkg_jar-from --build-only ant-core ant.jar;;
jar-dep)
- # get jar from the dependency package
+ # get jar from the dependency package(s)
if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
- java-pkg_jar-from ${ANT_TASK_DEPNAME}
+ for depname in "${ANT_TASK_DEPNAME[@]}"; do
+ java-pkg_jar-from ${depname}
+ done
fi;;
all)
ant-tasks_src_unpack base jar-dep;;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-26 8:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25 18:47 [gentoo-dev] RFC: ant-tasks.eclass patch Miroslav Šulc
2019-09-25 19:44 ` Michał Górny
2019-09-26 8:05 ` Miroslav Šulc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox