public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
@ 2018-08-06 18:09 Mike Gilbert
  2018-08-06 19:13 ` Ulrich Mueller
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Gilbert @ 2018-08-06 18:09 UTC (permalink / raw
  To: gentoo-dev

---
 eclass/systemd.eclass | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index 72f4845efc45..b822f54f8d06 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -26,11 +26,15 @@
 inherit toolchain-funcs
 
 case ${EAPI:-0} in
-	0|1|2|3|4|5|6) ;;
+	0|1|2|3|4|5|6|7) ;;
 	*) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
 esac
 
-DEPEND="virtual/pkgconfig"
+if [[ ${EAPI} == [0123456] ]]; then
+	DEPEND="virtual/pkgconfig"
+else
+	BDEPEND="virtual/pkgconfig"
+fi
 
 # @FUNCTION: _systemd_get_dir
 # @USAGE: <variable-name> <fallback-directory>
-- 
2.18.0



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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 18:09 [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7 Mike Gilbert
@ 2018-08-06 19:13 ` Ulrich Mueller
  2018-08-06 19:35   ` Vadim A. Misbakh-Soloviov
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Mueller @ 2018-08-06 19:13 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Mon, 6 Aug 2018, Mike Gilbert wrote:
 
> -DEPEND="virtual/pkgconfig"
> +if [[ ${EAPI} == [0123456] ]]; then

This should use ${EAPI:-0} because for EAPI 0 the variable can be
empty.

> +	DEPEND="virtual/pkgconfig"
> +else
> +	BDEPEND="virtual/pkgconfig"
> +fi


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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 19:13 ` Ulrich Mueller
@ 2018-08-06 19:35   ` Vadim A. Misbakh-Soloviov
  2018-08-06 19:51     ` Mike Gilbert
  2018-08-06 19:51     ` Ulrich Mueller
  0 siblings, 2 replies; 8+ messages in thread
From: Vadim A. Misbakh-Soloviov @ 2018-08-06 19:35 UTC (permalink / raw
  To: gentoo-dev

В письме от понедельник, 6 августа 2018 г. 22:13:49 MSK пользователь Ulrich 
Mueller написал:
> >>>>> On Mon, 6 Aug 2018, Mike Gilbert wrote:
> > -DEPEND="virtual/pkgconfig"
> > +if [[ ${EAPI} == [0123456] ]]; then
> 
> This should use ${EAPI:-0} because for EAPI 0 the variable can be
> empty.
> 
> > +	DEPEND="virtual/pkgconfig"
> > +else
> > +	BDEPEND="virtual/pkgconfig"
> > +fi

And how about "-le"/"-lt"/"-ge"/"-gt"/"-eq" syntax?
Or even ((EAPI<7))?
Are they forbidden to use in eclasses?

Anyway, I think, it is possible to add something like "EAPI=${EAPI:-0}" 
somewhere at the top of eclass, to don't call "${EAPI:-0}" each time when EAPI 
variable is needed.





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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 19:35   ` Vadim A. Misbakh-Soloviov
@ 2018-08-06 19:51     ` Mike Gilbert
  2018-08-06 20:09       ` Alec Warner
  2018-08-06 19:51     ` Ulrich Mueller
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Gilbert @ 2018-08-06 19:51 UTC (permalink / raw
  To: Gentoo Dev

On Mon, Aug 6, 2018 at 3:35 PM Vadim A. Misbakh-Soloviov
<gentoo@mva.name> wrote:
>
> В письме от понедельник, 6 августа 2018 г. 22:13:49 MSK пользователь Ulrich
> Mueller написал:
> > >>>>> On Mon, 6 Aug 2018, Mike Gilbert wrote:
> > > -DEPEND="virtual/pkgconfig"
> > > +if [[ ${EAPI} == [0123456] ]]; then
> >
> > This should use ${EAPI:-0} because for EAPI 0 the variable can be
> > empty.
> >
> > > +   DEPEND="virtual/pkgconfig"
> > > +else
> > > +   BDEPEND="virtual/pkgconfig"
> > > +fi
>
> And how about "-le"/"-lt"/"-ge"/"-gt"/"-eq" syntax?
> Or even ((EAPI<7))?
> Are they forbidden to use in eclasses?

If I recall correctly, EAPI values are not required to be numeric, and
are not required to increase in any predictable manner. They only do
so by convention.

> Anyway, I think, it is possible to add something like "EAPI=${EAPI:-0}"
> somewhere at the top of eclass, to don't call "${EAPI:-0}" each time when EAPI
> variable is needed.

Re-assigning EAPI within an eclass seems like a bad idea to me.

A better solution would be to ban ebuilds with no defined EAPI, but
that's outside the scope of this patch.


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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 19:35   ` Vadim A. Misbakh-Soloviov
  2018-08-06 19:51     ` Mike Gilbert
@ 2018-08-06 19:51     ` Ulrich Mueller
  1 sibling, 0 replies; 8+ messages in thread
From: Ulrich Mueller @ 2018-08-06 19:51 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Mon, 06 Aug 2018, Vadim A Misbakh-Soloviov wrote:

> Anyway, I think, it is possible to add something like
> "EAPI=${EAPI:-0}" somewhere at the top of eclass, to don't call
> "${EAPI:-0}" each time when EAPI variable is needed.

No, that is not possible. Changing EAPI in an eclass would make the
inheriting ebuild invalid. See PMS section 7.3.1.

Ulrich


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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 19:51     ` Mike Gilbert
@ 2018-08-06 20:09       ` Alec Warner
  2018-08-06 20:23         ` Toralf Förster
  0 siblings, 1 reply; 8+ messages in thread
From: Alec Warner @ 2018-08-06 20:09 UTC (permalink / raw
  To: Gentoo Dev

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

On Mon, Aug 6, 2018 at 3:51 PM, Mike Gilbert <floppym@gentoo.org> wrote:

> On Mon, Aug 6, 2018 at 3:35 PM Vadim A. Misbakh-Soloviov
> <gentoo@mva.name> wrote:
> >
> > В письме от понедельник, 6 августа 2018 г. 22:13:49 MSK пользователь
> Ulrich
> > Mueller написал:
> > > >>>>> On Mon, 6 Aug 2018, Mike Gilbert wrote:
> > > > -DEPEND="virtual/pkgconfig"
> > > > +if [[ ${EAPI} == [0123456] ]]; then
> > >
> > > This should use ${EAPI:-0} because for EAPI 0 the variable can be
> > > empty.
> > >
> > > > +   DEPEND="virtual/pkgconfig"
> > > > +else
> > > > +   BDEPEND="virtual/pkgconfig"
> > > > +fi
> >
> > And how about "-le"/"-lt"/"-ge"/"-gt"/"-eq" syntax?
> > Or even ((EAPI<7))?
> > Are they forbidden to use in eclasses?
>
> If I recall correctly, EAPI values are not required to be numeric, and
> are not required to increase in any predictable manner. They only do
> so by convention.
>

They do not even do so by convention; there are numerous EAPIs in the wild
that are non-numeric.

-A


>
> > Anyway, I think, it is possible to add something like "EAPI=${EAPI:-0}"
> > somewhere at the top of eclass, to don't call "${EAPI:-0}" each time
> when EAPI
> > variable is needed.
>
> Re-assigning EAPI within an eclass seems like a bad idea to me.
>
> A better solution would be to ban ebuilds with no defined EAPI, but
> that's outside the scope of this patch.
>
>

[-- Attachment #2: Type: text/html, Size: 2324 bytes --]

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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 20:09       ` Alec Warner
@ 2018-08-06 20:23         ` Toralf Förster
  2018-08-09 12:22           ` Michael Orlitzky
  0 siblings, 1 reply; 8+ messages in thread
From: Toralf Förster @ 2018-08-06 20:23 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 286 bytes --]

On 08/06/2018 10:09 PM, Alec Warner wrote:
> 
> They do not even do so by convention; there are numerous EAPIs in the
> wild that are non-numeric.

Then this line

	 if [[ ${EAPI} == [0123456] ]]; then

is a short-term solution, right?

-- 
Toralf
PGP 23217DA7 9B888F45


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7
  2018-08-06 20:23         ` Toralf Förster
@ 2018-08-09 12:22           ` Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2018-08-09 12:22 UTC (permalink / raw
  To: gentoo-dev

On 08/06/2018 04:23 PM, Toralf Förster wrote:
> On 08/06/2018 10:09 PM, Alec Warner wrote:
>>
>> They do not even do so by convention; there are numerous EAPIs in the
>> wild that are non-numeric.
> 
> Then this line
> 
> 	 if [[ ${EAPI} == [0123456] ]]; then
> 
> is a short-term solution, right?

Presumably any new EAPIs will want BDEPEND rather than DEPEND, and
there's a complete whitelist,

  case ${EAPI:-0} in
    0|1|2|3|4|5|6|7) ;;

of supported EAPIs at the top of the eclass. So it will probably do the
right thing for a new EAPI, but somebody's going to have to read the
code and think about it when the time comes anyway.


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

end of thread, other threads:[~2018-08-09 12:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-06 18:09 [gentoo-dev] [PATCH] systemd.eclass: set BDEPEND for EAPI 7 Mike Gilbert
2018-08-06 19:13 ` Ulrich Mueller
2018-08-06 19:35   ` Vadim A. Misbakh-Soloviov
2018-08-06 19:51     ` Mike Gilbert
2018-08-06 20:09       ` Alec Warner
2018-08-06 20:23         ` Toralf Förster
2018-08-09 12:22           ` Michael Orlitzky
2018-08-06 19:51     ` Ulrich Mueller

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