summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-08-31 16:31:11 +0200
committerMichał Górny <mgorny@gentoo.org>2017-08-31 20:10:05 +0200
commit40da7ee19c4c195da35083bf2d2fcbd852ad3846 (patch)
tree067dc4a644871e85e23bc320f7110fc40fcfc1dd
parentebuild.sh: Explicitly ban get_libdir in global scope (diff)
downloadportage-40da7ee19c4c195da35083bf2d2fcbd852ad3846.tar.gz
portage-40da7ee19c4c195da35083bf2d2fcbd852ad3846.tar.bz2
portage-40da7ee19c4c195da35083bf2d2fcbd852ad3846.zip
ebuild.sh: Fail on command-not-found in global scope
The PMS specifies that ebuilds must not call external commands in global scope. We can not prevent that from happening at the moment since a few ebuilds in Gentoo are still doing that. Instead, start increasing strictness by explicitly failing if ebuilds call external commands that are not found. This is not going to really break any ebuilds that are not broken already (since command-not-found usually indicates something is going wrong), and it will help noticing typos and reliance on non-common external commands. A similar change has been tested in pkgcore, and confirmed not to cause any failures with the current state of the Gentoo repository. Closes: https://github.com/gentoo/portage/pull/198 Reviewed-by: Zac Medico <zmedico@gentoo.org>
-rwxr-xr-xbin/ebuild.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index f1ac3f278..c23561651 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -79,6 +79,10 @@ else
eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }"
done
unset funcs x
+
+ command_not_found_handle() {
+ die "Command not found while sourcing ebuild: ${*}"
+ }
fi
# Don't use sandbox's BASH_ENV for new shells because it does