Cedric Staniewski wrote:
For some packages, generally the 'any' arch ones, a build step is not
required and therefore can be skipped. In these cases, a package()
function without a build() one is sufficient.
As a side effect, this commit makes meta packages without any function
at all in the PKGBUILD possible.
Fixes FS#15147.
Signed-off-by: Cedric Staniewski <[email protected]>
---
<snip>
+# test for available PKGBUILD functions
+# The exclamation mark is required here to avoid triggering the ERR trap when
+# a tested function does not exist.
+if [[ $(! type -t build) = "function" ]]; then
+ BUILDFUNC=1
+fi
This certainly appears to work, but can you explain how? Here is my
understanding. The "!" means that when build() is not present, the
function will still return 0 (not triggering the err trap) and the
comparison then fails. When build() function is present, the type
-t... outputs "function" but returns 1. How is the err trap not set of
then? Is it because there is a value output?
Anyway, this is certainly a good catch for when applying the [[ & ((
patch. The rest of the patch looks good to me.
Allan