1 |
EAPI 7 specifies that nonfatal has to be implemented both as a bash |
2 |
function and a fallback executable, so that it can be used e.g. via |
3 |
find/xargs. |
4 |
|
5 |
Bug: https://bugs.gentoo.org/622894 |
6 |
--- |
7 |
bin/eapi.sh | 4 ++++ |
8 |
bin/ebuild-helpers/nonfatal | 14 ++++++++++++++ |
9 |
2 files changed, 18 insertions(+) |
10 |
create mode 100755 bin/ebuild-helpers/nonfatal |
11 |
|
12 |
diff --git a/bin/eapi.sh b/bin/eapi.sh |
13 |
index fa254485c..67563bed8 100644 |
14 |
--- a/bin/eapi.sh |
15 |
+++ b/bin/eapi.sh |
16 |
@@ -72,6 +72,10 @@ ___eapi_has_nonfatal() { |
17 |
[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] |
18 |
} |
19 |
|
20 |
+___eapi_has_nonfatal_as_executable() { |
21 |
+ [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]] |
22 |
+} |
23 |
+ |
24 |
___eapi_has_doheader() { |
25 |
[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] |
26 |
} |
27 |
diff --git a/bin/ebuild-helpers/nonfatal b/bin/ebuild-helpers/nonfatal |
28 |
new file mode 100755 |
29 |
index 000000000..4cb9ae77a |
30 |
--- /dev/null |
31 |
+++ b/bin/ebuild-helpers/nonfatal |
32 |
@@ -0,0 +1,14 @@ |
33 |
+#!/bin/bash |
34 |
+# Copyright 1999-2017 Gentoo Foundation |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 |
38 |
+ |
39 |
+if ! ___eapi_has_nonfatal_as_executable; then |
40 |
+ die "${0##*/} not supported as fallback helper in this EAPI" |
41 |
+fi |
42 |
+if [[ $# -lt 1 ]]; then |
43 |
+ die "${0##*/}: Missing argument" |
44 |
+fi |
45 |
+ |
46 |
+PORTAGE_NONFATAL=1 exec "$@" |
47 |
-- |
48 |
2.16.2 |