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

Initial removal of bashisms

parent efc67921
......@@ -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
......
......@@ -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
......
......@@ -81,7 +81,7 @@ do_logging()
# Log the command output
eval $cmd
echo
} >&$fd
} > $fd 2>&1
i=$(($i + 1))
done
fi
......
......@@ -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
......
......@@ -13,7 +13,7 @@ subpackages=""
source=""
check() {
[ $UID -ne 0 ] || return 1
[ "$(id -u)" -ne 0 ] || return 1
}
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