summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com>2019-07-20 21:18:06 -0400
committerMax Rees <maxcrees@me.com>2019-07-20 21:20:21 -0400
commitf02eb097f88d3ab89765d041a78fbcd96baf2039 (patch)
tree1ace7167e60de5cceff90c55da6b3933580e7f11
parent164e656bacd0526c41f94b670e2c6ac23da35080 (diff)
downloadabuild-f02eb097f88d3ab89765d041a78fbcd96baf2039.tar.gz
abuild-f02eb097f88d3ab89765d041a78fbcd96baf2039.tar.bz2
abuild-f02eb097f88d3ab89765d041a78fbcd96baf2039.tar.xz
abuild-f02eb097f88d3ab89765d041a78fbcd96baf2039.zip
abuild, abump: use type(1) portably
-rw-r--r--abuild.in16
-rw-r--r--abump.in9
2 files changed, 17 insertions, 8 deletions
diff --git a/abuild.in b/abuild.in
index b71578e..12c875c 100644
--- a/abuild.in
+++ b/abuild.in
@@ -134,7 +134,6 @@ default_sanitycheck() {
if [ $(echo "$pkgdesc" | wc -c) -gt 128 ]; then
die "pkgdesc is too long"
fi
- is_function package || die "Missing package() function in APKBUILD"
if [ -n "$replaces_priority" ] \
&& ! echo $replaces_priority | egrep -q '^[0-9]+$'; then
@@ -240,9 +239,11 @@ default_sanitycheck() {
makedepends_has 'g++' && ! options_has toolchain && warning "g++ should not be in makedepends"
+ is_function package || die "Missing package() function in APKBUILD"
+
if ! options_has "!check" && [ -n "$REQUIRE_CHECK" ]; then
- (unset check; . "$APKBUILD"; type check >/dev/null 2>&1) || \
- die "Testsuites (abuild check) are required or need to be explicitly disabled!"
+ is_function check \
+ || die "Testsuites (abuild check) are required or need to be explicitly disabled!"
fi
check_provides || die "provides must not contain $pkgname"
@@ -1757,9 +1758,12 @@ openrc() {
}
-is_function() {
- type "$1" 2>&1 | head -n 1 | egrep -q "is a (shell )?function"
-}
+is_function() (
+ unset -f "$1" >/dev/null 2>&1 || true
+ unalias "$1" >/dev/null 2>&1 || true
+ . "$APKBUILD"
+ PATH= type "$1" >/dev/null 2>&1
+)
do_fakeroot() {
if [ -n "$FAKEROOT" ]; then
diff --git a/abump.in b/abump.in
index efeb481..ee2df1e 100644
--- a/abump.in
+++ b/abump.in
@@ -49,8 +49,13 @@ do_bump() {
name=${name#*/}
[ "$pkgname" = "$name" ] \
|| die "APKBUILD has different \$pkgname for $name"
- type package | grep -q function \
- || die "missing package() for $name"
+
+ (
+ unset -f package || true
+ unalias package || true
+ . "$a"
+ PATH= type package >/dev/null 2>&1
+ ) || die "missing package() for $name"
cd "${a%/*}"
section=${PWD%/*}