Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Thu, 31 Aug 2017 18:10:40
Message-Id: 1504203005.40da7ee19c4c195da35083bf2d2fcbd852ad3846.mgorny@gentoo
1 commit: 40da7ee19c4c195da35083bf2d2fcbd852ad3846
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 31 14:31:11 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 31 18:10:05 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=40da7ee1
7
8 ebuild.sh: Fail on command-not-found in global scope
9
10 The PMS specifies that ebuilds must not call external commands in global
11 scope. We can not prevent that from happening at the moment since a few
12 ebuilds in Gentoo are still doing that.
13
14 Instead, start increasing strictness by explicitly failing if ebuilds
15 call external commands that are not found. This is not going to really
16 break any ebuilds that are not broken already (since command-not-found
17 usually indicates something is going wrong), and it will help noticing
18 typos and reliance on non-common external commands.
19
20 A similar change has been tested in pkgcore, and confirmed not to cause
21 any failures with the current state of the Gentoo repository.
22
23 Closes: https://github.com/gentoo/portage/pull/198
24 Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
25
26 bin/ebuild.sh | 4 ++++
27 1 file changed, 4 insertions(+)
28
29 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
30 index f1ac3f278..c23561651 100755
31 --- a/bin/ebuild.sh
32 +++ b/bin/ebuild.sh
33 @@ -79,6 +79,10 @@ else
34 eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }"
35 done
36 unset funcs x
37 +
38 + command_not_found_handle() {
39 + die "Command not found while sourcing ebuild: ${*}"
40 + }
41 fi
42
43 # Don't use sandbox's BASH_ENV for new shells because it does