Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] ebuild.sh: Fail on command-not-found in global scope
Date: Thu, 31 Aug 2017 18:10:49
Message-Id: 1504203043.15812.3.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] ebuild.sh: Fail on command-not-found in global scope by Zac Medico
1 W dniu czw, 31.08.2017 o godzinie 10∶42 -0700, użytkownik Zac Medico
2 napisał:
3 > On 08/31/2017 07:56 AM, Michał Górny wrote:
4 > > The PMS specifies that ebuilds must not call external commands in global
5 > > scope. We can not prevent that from happening at the moment since a few
6 > > ebuilds in Gentoo are still doing that.
7 > >
8 > > Instead, start increasing strictness by explicitly failing if ebuilds
9 > > call external commands that are not found. This is not going to really
10 > > break any ebuilds that are not broken already (since command-not-found
11 > > usually indicates something is going wrong), and it will help noticing
12 > > typos and reliance on non-common external commands.
13 > >
14 > > A similar change has been tested in pkgcore, and confirmed not to cause
15 > > any failures with the current state of the Gentoo repository.
16 > >
17 > > Closes: https://github.com/gentoo/portage/pull/198
18 > > ---
19 > > bin/ebuild.sh | 4 ++++
20 > > 1 file changed, 4 insertions(+)
21 > >
22 > > diff --git a/bin/ebuild.sh b/bin/ebuild.sh
23 > > index f1ac3f278..c23561651 100755
24 > > --- a/bin/ebuild.sh
25 > > +++ b/bin/ebuild.sh
26 > > @@ -79,6 +79,10 @@ else
27 > > eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }"
28 > > done
29 > > unset funcs x
30 > > +
31 > > + command_not_found_handle() {
32 > > + die "Command not found while sourcing ebuild: ${*}"
33 > > + }
34 > > fi
35 > >
36 > > # Don't use sandbox's BASH_ENV for new shells because it does
37 > >
38 >
39 > Looks good. Please merge.
40
41 Merged.
42
43 --
44 Best regards,
45 Michał Górny