Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: ant-tasks.eclass patch
Date: Wed, 25 Sep 2019 19:44:55
Message-Id: bbf22cdfb697213723379066aaa036f6f8fed4ed.camel@gentoo.org
In Reply to: [gentoo-dev] RFC: ant-tasks.eclass patch by "Miroslav Šulc"
1 On Wed, 2019-09-25 at 20:47 +0200, Miroslav Šulc wrote:
2 > diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass
3 > index 309df084d156..26df9de26f1a 100644
4 > --- a/eclass/ant-tasks.eclass
5 > +++ b/eclass/ant-tasks.eclass
6 > @@ -54,7 +54,9 @@ ANT_TASK_NAME="${PN#ant-}"
7 > # @DESCRIPTION:
8 > # Specifies JAVA_PKG_NAME (PN{-SLOT} used with java-pkg_jar-from) of the package
9 > # that this one depends on. Defaults to the name of ant task, ebuild can
10 > -# override it before inheriting this eclass.
11 > +# override it before inheriting this eclass. In case there is more than one
12 > +# dependency, the variable can be specified as bash array with multiple strings,
13 > +# one for each dependency.
14 > ANT_TASK_DEPNAME=${ANT_TASK_DEPNAME-${ANT_TASK_NAME}}
15 >
16 > # @ECLASS-VARIABLE: ANT_TASK_DISABLE_VM_DEPS
17 > @@ -105,7 +107,7 @@ S="${WORKDIR}/${MY_P}"
18 > # base: performs the unpack, build.xml replacement and symlinks ant.jar from
19 > # ant-core
20 > #
21 > -# jar-dep: symlinks the jar file(s) from dependency package
22 > +# jar-dep: symlinks the jar file(s) from dependency package(s)
23 > ant-tasks_src_unpack() {
24 > [[ -z "${1}" ]] && ant-tasks_src_unpack all
25 >
26 > @@ -129,9 +131,17 @@ ant-tasks_src_unpack() {
27 > # ant.jar to build against
28 > java-pkg_jar-from --build-only ant-core ant.jar;;
29 > jar-dep)
30 > - # get jar from the dependency package
31 > + # get jar from the dependency package(s)
32 > if [[ -n "${ANT_TASK_DEPNAME}" ]]; then
33 > - java-pkg_jar-from ${ANT_TASK_DEPNAME}
34 > + local array=$(declare -p ANT_TASK_DEPNAME | grep "^declare \-a")
35 > +
36 > + if [[ -n "${array}" ]]; then
37 > + for depname in "${ANT_TASK_DEPNAME[@]}"; do
38 > + java-pkg_jar-from ${depname}
39 > + done
40
41 I don't think you need two branches here. Non-array variable is
42 equivalent to an array with a single element for the purpose of [@], so
43 your 'for' loop will work correctly both for non-array and array.
44
45 > + else
46 > + java-pkg_jar-from ${ANT_TASK_DEPNAME}
47 > + fi
48 > fi;;
49 > all)
50 > ant-tasks_src_unpack base jar-dep;;
51
52 --
53 Best regards,
54 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] RFC: ant-tasks.eclass patch "Miroslav Šulc" <fordfrog@g.o>