Verified Commit 5ecfc84b authored by Max Rees's avatar Max Rees
Browse files

Initial removal of bashisms

parent efc67921
...@@ -269,7 +269,8 @@ sumcheck() { ...@@ -269,7 +269,8 @@ sumcheck() {
fetch || return 1 fetch || return 1
msg "Checking ${algo}sums..." msg "Checking ${algo}sums..."
cd "$srcdir" || return 1 cd "$srcdir" || return 1
IFS=$'\n' IFS="
"
endreturnval=0 endreturnval=0
for src in $sums; do for src in $sums; do
origin=$1; shift origin=$1; shift
...@@ -277,7 +278,7 @@ sumcheck() { ...@@ -277,7 +278,7 @@ sumcheck() {
endreturnval=1 endreturnval=1
is_remote $origin || continue 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)" local file="$SRCDEST/$(filename_from_uri $origin)"
echo "Because the remote file above failed the ${algo}sum check it will be renamed." echo "Because the remote file above failed the ${algo}sum check it will be renamed."
...@@ -514,7 +515,8 @@ cleanpkg() { ...@@ -514,7 +515,8 @@ cleanpkg() {
rm -f "$REPODEST/$repo/src/$pkgname-$pkgver-r$pkgrel.src.tar.gz" rm -f "$REPODEST/$repo/src/$pkgname-$pkgver-r$pkgrel.src.tar.gz"
for i in $allpackages; do for i in $allpackages; do
subpkg_set "$i" 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 done
subpkg_unset subpkg_unset
...@@ -870,9 +872,9 @@ check_secfixes_comment() { ...@@ -870,9 +872,9 @@ check_secfixes_comment() {
fi fi
# check if there are tabs # 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:" error "secfixes comment must not have tabs:"
echo "$c" | grep $'\t' >&2 echo "$c" | grep "$(printf '\t')" >&2
return 1 return 1
fi fi
...@@ -998,7 +1000,8 @@ prepare_metafiles() { ...@@ -998,7 +1000,8 @@ prepare_metafiles() {
local f=${i%=*} local f=${i%=*}
local dirs=${i#*=} local dirs=${i#*=}
[ "${f%.trigger}" != "$name" ] && continue [ "${f%.trigger}" != "$name" ] && continue
echo "triggers = ${dirs//:/ }" >> "$pkginfo" dirs="$(printf '%s' "$dirs" | sed 's/:/ /g')"
echo "triggers = $dirs" >> "$pkginfo"
done done
if [ -n "$install_if" ]; then if [ -n "$install_if" ]; then
echo "install_if = $(echo $install_if)" >> "$pkginfo" echo "install_if = $(echo $install_if)" >> "$pkginfo"
...@@ -1392,7 +1395,7 @@ scan_shared_objects() { ...@@ -1392,7 +1395,7 @@ scan_shared_objects() {
# path (2nd arg). # path (2nd arg).
normalize_target_path() { normalize_target_path() {
local path=$1 local path=$1
[ "${path:0:1}" = / ] || path=$(dirname "$2")/$path (printf '%s' "$path" | grep -q '^/') || path=$(dirname "$2")/$path
local oifs="$IFS" pathstr= i= local oifs="$IFS" pathstr= i=
IFS='/' IFS='/'
...@@ -1510,8 +1513,9 @@ create_apks() { ...@@ -1510,8 +1513,9 @@ create_apks() {
abuild-sign -q control.tar.gz || exit 1 abuild-sign -q control.tar.gz || exit 1
msg "Create $apk" msg "Create $apk"
mkdir -p "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH} [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}/$apk mkdir -p "$REPODEST"/$repo/$subpkgarch
cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/$subpkgarch/$apk
) )
done done
} }
...@@ -1840,7 +1844,8 @@ apk_up2date() { ...@@ -1840,7 +1844,8 @@ apk_up2date() {
local i s local i s
for i in $allpackages; do for i in $allpackages; do
subpkg_set "$i" 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 subpkg_unset
return 1 return 1
fi fi
...@@ -1855,7 +1860,8 @@ apk_up2date() { ...@@ -1855,7 +1860,8 @@ apk_up2date() {
else else
s="$startdir/${i##*/}" s="$startdir/${i##*/}"
fi 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 return 1
fi fi
done done
...@@ -1868,7 +1874,8 @@ abuildindex_up2date() { ...@@ -1868,7 +1874,8 @@ abuildindex_up2date() {
for i in $allpackages; do for i in $allpackages; do
subpkg_set "$i" 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 idx="$dir"/APKINDEX.tar.gz
local file="$dir"/$subpkgname-$pkgver-r$pkgrel.apk local file="$dir"/$subpkgname-$pkgver-r$pkgrel.apk
...@@ -2187,7 +2194,7 @@ rootbld() { ...@@ -2187,7 +2194,7 @@ rootbld() {
local version="edge" buildhost="edge" gitref local version="edge" buildhost="edge" gitref
if gitref="$(expr "$(git symbolic-ref --short HEAD)" : '\([0-9]\+\(\.[0-9]\+\)*\)-')"; then if gitref="$(expr "$(git symbolic-ref --short HEAD)" : '\([0-9]\+\(\.[0-9]\+\)*\)-')"; then
version=v${gitref} version=v${gitref}
buildhost=${gitref/./-} buildhost="$(printf '%s' "$gitref" | sed 's/[.]/-/')"
fi fi
local repo_template=$aportsgit/$repo/.rootbld-repositories local repo_template=$aportsgit/$repo/.rootbld-repositories
......
...@@ -130,7 +130,8 @@ fi ...@@ -130,7 +130,8 @@ fi
args=$(for a; do p=$(any_buildscript "$a") || die "can't find APKBUILD for $a"; echo "$p"; done) args=$(for a; do p=$(any_buildscript "$a") || die "can't find APKBUILD for $a"; echo "$p"; done)
[ $? -eq 0 ] || exit 1 [ $? -eq 0 ] || exit 1
oldifs=$IFS oldifs=$IFS
IFS=$'\n' IFS="
"
set -- $args set -- $args
IFS=$oldifs IFS=$oldifs
......
...@@ -81,7 +81,7 @@ do_logging() ...@@ -81,7 +81,7 @@ do_logging()
# Log the command output # Log the command output
eval $cmd eval $cmd
echo echo
} >&$fd } > $fd 2>&1
i=$(($i + 1)) i=$(($i + 1))
done done
fi fi
......
...@@ -141,7 +141,7 @@ newapkbuild_simple_test() { ...@@ -141,7 +141,7 @@ newapkbuild_simple_test() {
shift shift
pattern=$1 pattern=$1
shift shift
pushd "tests/newapkbuild" 1>/dev/null cd "tests/newapkbuild"
[ -d $name ] && rm -r $name [ -d $name ] && rm -r $name
newapkbuild -n $name $@ newapkbuild -n $name $@
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
...@@ -150,7 +150,7 @@ newapkbuild_simple_test() { ...@@ -150,7 +150,7 @@ newapkbuild_simple_test() {
fi fi
grep $pattern $name/APKBUILD 1>/dev/null grep $pattern $name/APKBUILD 1>/dev/null
expect_success $name expect_success $name
popd 1>/dev/null cd "$OLDPWD"
} }
...@@ -163,10 +163,10 @@ newapkbuild_simple_test simplever 'pkgver=1.0' simplever-1.0 ...@@ -163,10 +163,10 @@ newapkbuild_simple_test simplever 'pkgver=1.0' simplever-1.0
# $1 - test name (test-autoconf-pkg, etc) # $1 - test name (test-autoconf-pkg, etc)
# $2 - the invocation expected ("./configure", "cmake", etc) # $2 - the invocation expected ("./configure", "cmake", etc)
newapkbuild_pkg_test() { newapkbuild_pkg_test() {
pushd "tests/newapkbuild" 1>/dev/null cd "tests/newapkbuild"
[ -d $1 ] && rm -r $1 [ -d $1 ] && rm -r $1
newapkbuild "https://distfiles.adelielinux.org/source/newapkbuild-tests/$1-1.0.tar.xz" 1>/dev/null 2>/dev/null 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 if [ $? -ne 0 ]; then
fail "$1: newapkbuild failed" fail "$1: newapkbuild failed"
else else
......
...@@ -13,7 +13,7 @@ subpackages="" ...@@ -13,7 +13,7 @@ subpackages=""
source="" source=""
check() { check() {
[ $UID -ne 0 ] || return 1 [ "$(id -u)" -ne 0 ] || return 1
} }
package() { package() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment