summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com>2018-06-19 00:46:45 -0400
committerMax Rees <maxcrees@me.com>2019-07-20 20:29:46 -0400
commit5ecfc84bc620859a57c8364bda636cbca14c46e6 (patch)
tree7c543ecac45be3212741c7361baf3d4d8b1f91ec
parentefc6792152a1b5fba1165a0ff41ccf74541ca134 (diff)
downloadabuild-5ecfc84bc620859a57c8364bda636cbca14c46e6.tar.gz
abuild-5ecfc84bc620859a57c8364bda636cbca14c46e6.tar.bz2
abuild-5ecfc84bc620859a57c8364bda636cbca14c46e6.tar.xz
abuild-5ecfc84bc620859a57c8364bda636cbca14c46e6.zip
Initial removal of bashisms
-rw-r--r--abuild.in33
-rw-r--r--apkgrel.in3
-rwxr-xr-xbootchartd2
-rwxr-xr-xrun-tests.sh8
-rw-r--r--tests/abuild/checkroot1/APKBUILD2
5 files changed, 28 insertions, 20 deletions
diff --git a/abuild.in b/abuild.in
index d1456c9..07b872c 100644
--- a/abuild.in
+++ b/abuild.in
@@ -269,7 +269,8 @@ sumcheck() {
fetch || return 1
msg "Checking ${algo}sums..."
cd "$srcdir" || return 1
- IFS=$'\n'
+ IFS="
+"
endreturnval=0
for src in $sums; do
origin=$1; shift
@@ -277,7 +278,7 @@ sumcheck() {
endreturnval=1
is_remote $origin || continue
- local csum="${src:0:8}"
+ local csum="$(printf '%s' "$src" | awk '{ print substr($0, 1, 8) }' )"
local file="$SRCDEST/$(filename_from_uri $origin)"
echo "Because the remote file above failed the ${algo}sum check it will be renamed."
@@ -514,7 +515,8 @@ cleanpkg() {
rm -f "$REPODEST/$repo/src/$pkgname-$pkgver-r$pkgrel.src.tar.gz"
for i in $allpackages; do
subpkg_set "$i"
- rm -f "$REPODEST/$repo/${subpkgarch/noarch/$CARCH}/$subpkgname-$pkgver-r$pkgrel.apk"
+ [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
+ rm -f "$REPODEST/$repo/$subpkgarch/$subpkgname-$pkgver-r$pkgrel.apk"
done
subpkg_unset
@@ -870,9 +872,9 @@ check_secfixes_comment() {
fi
# check if there are tabs
- if echo "$invalid" | grep -q $'\t'; then
+ if echo "$invalid" | grep -q "$(printf '\t')"; then
error "secfixes comment must not have tabs:"
- echo "$c" | grep $'\t' >&2
+ echo "$c" | grep "$(printf '\t')" >&2
return 1
fi
@@ -998,7 +1000,8 @@ prepare_metafiles() {
local f=${i%=*}
local dirs=${i#*=}
[ "${f%.trigger}" != "$name" ] && continue
- echo "triggers = ${dirs//:/ }" >> "$pkginfo"
+ dirs="$(printf '%s' "$dirs" | sed 's/:/ /g')"
+ echo "triggers = $dirs" >> "$pkginfo"
done
if [ -n "$install_if" ]; then
echo "install_if = $(echo $install_if)" >> "$pkginfo"
@@ -1392,7 +1395,7 @@ scan_shared_objects() {
# path (2nd arg).
normalize_target_path() {
local path=$1
- [ "${path:0:1}" = / ] || path=$(dirname "$2")/$path
+ (printf '%s' "$path" | grep -q '^/') || path=$(dirname "$2")/$path
local oifs="$IFS" pathstr= i=
IFS='/'
@@ -1510,8 +1513,9 @@ create_apks() {
abuild-sign -q control.tar.gz || exit 1
msg "Create $apk"
- mkdir -p "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}
- cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}/$apk
+ [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
+ mkdir -p "$REPODEST"/$repo/$subpkgarch
+ cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/$subpkgarch/$apk
)
done
}
@@ -1840,7 +1844,8 @@ apk_up2date() {
local i s
for i in $allpackages; do
subpkg_set "$i"
- if [ ! -f "$REPODEST/$repo/${subpkgarch/noarch/$CARCH}/$subpkgname-$pkgver-r$pkgrel.apk" ]; then
+ [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
+ if [ ! -f "$REPODEST/$repo/$subpkgarch/$subpkgname-$pkgver-r$pkgrel.apk" ]; then
subpkg_unset
return 1
fi
@@ -1855,7 +1860,8 @@ apk_up2date() {
else
s="$startdir/${i##*/}"
fi
- if [ "$s" -nt "$REPODEST/$repo/${pkgarch/noarch/$CARCH}/$pkgname-$pkgver-r$pkgrel.apk" ]; then
+ [ "$pkgarch" = "noarch" ] && pkgarch="$CARCH"
+ if [ "$s" -nt "$REPODEST/$repo/$pkgarch/$pkgname-$pkgver-r$pkgrel.apk" ]; then
return 1
fi
done
@@ -1868,7 +1874,8 @@ abuildindex_up2date() {
for i in $allpackages; do
subpkg_set "$i"
- local dir="$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}
+ [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
+ local dir="$REPODEST"/$repo/$subpkgarch
local idx="$dir"/APKINDEX.tar.gz
local file="$dir"/$subpkgname-$pkgver-r$pkgrel.apk
@@ -2187,7 +2194,7 @@ rootbld() {
local version="edge" buildhost="edge" gitref
if gitref="$(expr "$(git symbolic-ref --short HEAD)" : '\([0-9]\+\(\.[0-9]\+\)*\)-')"; then
version=v${gitref}
- buildhost=${gitref/./-}
+ buildhost="$(printf '%s' "$gitref" | sed 's/[.]/-/')"
fi
local repo_template=$aportsgit/$repo/.rootbld-repositories
diff --git a/apkgrel.in b/apkgrel.in
index 1250136..fd63271 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -130,7 +130,8 @@ fi
args=$(for a; do p=$(any_buildscript "$a") || die "can't find APKBUILD for $a"; echo "$p"; done)
[ $? -eq 0 ] || exit 1
oldifs=$IFS
-IFS=$'\n'
+IFS="
+"
set -- $args
IFS=$oldifs
diff --git a/bootchartd b/bootchartd
index e265582..25fc899 100755
--- a/bootchartd
+++ b/bootchartd
@@ -81,7 +81,7 @@ do_logging()
# Log the command output
eval $cmd
echo
- } >&$fd
+ } > $fd 2>&1
i=$(($i + 1))
done
fi
diff --git a/run-tests.sh b/run-tests.sh
index ff99a49..9e757e8 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -141,7 +141,7 @@ newapkbuild_simple_test() {
shift
pattern=$1
shift
- pushd "tests/newapkbuild" 1>/dev/null
+ cd "tests/newapkbuild"
[ -d $name ] && rm -r $name
newapkbuild -n $name $@
if [ $? -ne 0 ]; then
@@ -150,7 +150,7 @@ newapkbuild_simple_test() {
fi
grep $pattern $name/APKBUILD 1>/dev/null
expect_success $name
- popd 1>/dev/null
+ cd "$OLDPWD"
}
@@ -163,10 +163,10 @@ newapkbuild_simple_test simplever 'pkgver=1.0' simplever-1.0
# $1 - test name (test-autoconf-pkg, etc)
# $2 - the invocation expected ("./configure", "cmake", etc)
newapkbuild_pkg_test() {
- pushd "tests/newapkbuild" 1>/dev/null
+ cd "tests/newapkbuild"
[ -d $1 ] && rm -r $1
newapkbuild "https://distfiles.adelielinux.org/source/newapkbuild-tests/$1-1.0.tar.xz" 1>/dev/null 2>/dev/null
- popd 1>/dev/null
+ cd "$OLDPWD"
if [ $? -ne 0 ]; then
fail "$1: newapkbuild failed"
else
diff --git a/tests/abuild/checkroot1/APKBUILD b/tests/abuild/checkroot1/APKBUILD
index 6165c55..e0c2532 100644
--- a/tests/abuild/checkroot1/APKBUILD
+++ b/tests/abuild/checkroot1/APKBUILD
@@ -13,7 +13,7 @@ subpackages=""
source=""
check() {
- [ $UID -ne 0 ] || return 1
+ [ "$(id -u)" -ne 0 ] || return 1
}
package() {