Verified Commit 0a84eaef authored by Max Rees's avatar Max Rees
Browse files

dash is my god now. and it hungers for quotes around local var= expansions.

parent 91988824
......@@ -17,7 +17,7 @@ fi
do_sign() {
local f i keyname repo
local openssl=$(command -v openssl || echo libressl)
local openssl="$(command -v openssl || echo libressl)"
# we are actually only interested in the name, not the file itself
keyname=${pubkey##*/}
......
......@@ -153,8 +153,8 @@ default_sanitycheck() {
done
for i in $install; do
local n=${i%.*}
local suff=${i##*.}
local n="${i%.*}"
local suff="${i##*.}"
case "$suff" in
pre-install|post-install|pre-upgrade|post-upgrade|pre-deinstall|post-deinstall);;
*) die "$i: unknown install script suffix"
......@@ -172,8 +172,8 @@ default_sanitycheck() {
done
for i in $triggers; do
local f=${i%=*}
local p=${f%.trigger}
local f="${i%=*}"
local p="${f%.trigger}"
[ "$f" = "$i" ] && die "$f: triggers must contain '='"
[ "$p" = "$f" ] && die "$f: triggers scripts must have .trigger suffix"
if ! subpackages_has "$p" && [ "$p" != "$pkgname" ]; then
......@@ -261,7 +261,7 @@ sumcheck() {
# get number of checksums
set -- $sums
local numsums=$(( $# / 2 ))
local numsums="$(( $# / 2 ))"
set -- $source
if [ $# -ne $numsums ]; then
......@@ -428,7 +428,7 @@ default_unpack() {
verify || return 1
initdcheck || return 1
mkdir -p "$srcdir"
local gunzip=$(command -v pigz || echo gunzip)
local gunzip="$(command -v pigz || echo gunzip)"
[ $gunzip = "/usr/bin/pigz" ] && gunzip="$gunzip -d"
for u in $source; do
local s
......@@ -494,7 +494,7 @@ subpkg_unset() {
subpkg_set() {
subpkgname=${1%%:*}
local _splitarch=${1#*:}
local _splitarch="${1#*:}"
[ "$_splitarch" = "$1" ] && _splitarch=""
subpkgsplit=${_splitarch%%:*}
......@@ -590,7 +590,7 @@ update_config_guess() {
}
runpart() {
local part=$1
local part="$1"
[ -n "$DEBUG" ] && msg "$part"
trap "die '$part failed'" EXIT
if [ -d "$builddir" ]; then
......@@ -865,9 +865,9 @@ check_license() {
}
check_secfixes_comment() {
local c=$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' $APKBUILD | grep '^#')
local invalid=$(echo "$c" \
| grep -v -E '(^# secfixes:|^# +- [A-Z0-9-]+|^# [0-9]+.*:$|^#$)')
local c="$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' $APKBUILD | grep '^#')"
local invalid="$(echo "$c" \
| grep -v -E '(^# secfixes:|^# +- [A-Z0-9-]+|^# [0-9]+.*:$|^#$)')"
if [ -z "$invalid" ]; then
return 0
fi
......@@ -909,9 +909,9 @@ check_provides() {
prepare_metafiles() {
getpkgver || return 1
local name=${subpkgname:-$pkgname}
local name="${subpkgname:-$pkgname}"
[ -z "${name##* *}" ] && die "package name contains spaces"
local dir=${subpkgdir:-$pkgdir}
local dir="${subpkgdir:-$pkgdir}"
local pkg="$name-$pkgver-r$pkgrel.apk"
local pkginfo="$controldir"/.PKGINFO
local sub
......@@ -919,7 +919,7 @@ prepare_metafiles() {
[ ! -d "$dir" ] && die "Missing $dir"
cd "$dir"
mkdir -p "$controldir"
local builddate=$(date -u "+%s")
local builddate="$(date -u "+%s")"
# Fix package size on several filesystems
case "$(df -PT . | awk 'END {print $2}')" in
......@@ -927,7 +927,7 @@ prepare_metafiles() {
sync;;
esac
local size=$(du -sk | awk '{print $1 * 1024}')
local size="$(du -sk | awk '{print $1 * 1024}')"
if [ "$arch" != "$apkbuild_arch" ]; then
local msg="Split function set arch=\"$arch\" for $name, use subpackages=pkg:split:arch format instead"
......@@ -956,7 +956,7 @@ prepare_metafiles() {
deps="$depends"
if ! depends_has /bin/sh; then
for i in $install $triggers; do
local s=${i%=*}
local s="${i%=*}"
[ "$name" != "${s%.*}" ] && continue
if head -n 1 "$startdir/$s" | grep '^#!/bin/sh' >/dev/null ; then
msg "Script found. /bin/sh added as a dependency for $pkg"
......@@ -998,8 +998,8 @@ prepare_metafiles() {
echo "provides = $i" >> "$pkginfo"
done
for i in $triggers; do
local f=${i%=*}
local dirs=${i#*=}
local f="${i%=*}"
local dirs="${i#*=}"
[ "${f%.trigger}" != "$name" ] && continue
dirs="$(printf '%s' "$dirs" | sed 's/:/ /g')"
echo "triggers = $dirs" >> "$pkginfo"
......@@ -1010,8 +1010,8 @@ prepare_metafiles() {
local metafiles=".PKGINFO"
for i in $install $triggers; do
local f=${i%=*}
local n=${f%.*}
local f="${i%=*}"
local n="${f%.*}"
if [ "$n" != "$name" ]; then
continue
fi
......@@ -1025,7 +1025,7 @@ prepare_metafiles() {
}
prepare_trace_rpaths() {
local dir=${subpkgdir:-$pkgdir}
local dir="${subpkgdir:-$pkgdir}"
local etype= soname= file= sover=
[ "${subpkgarch:-$pkgarch}" = "noarch" ] && return 0
options_has "!tracedeps" && return 0
......@@ -1064,9 +1064,9 @@ prepare_pkgconfig_provides() {
if ! [ -e "$i" ]; then
continue
fi
local f=${i##*/}
local v=$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \
--modversion ${f%.pc})
local f="${i##*/}"
local v="$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \
--modversion ${f%.pc})"
echo "$pcprefix${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc
done
}
......@@ -1079,7 +1079,7 @@ prepare_command_provides() {
if ! [ -x "$i" ]; then
continue
fi
local f=${i##*/}
local f="${i##*/}"
echo $f >> "$controldir"/.provides-command
done
}
......@@ -1157,7 +1157,7 @@ real_so_path() {
# search rpaths and /usr/lib /lib for given so files
find_so_files() {
local rpaths=$(cat "$1")
local rpaths="$(cat "$1")"
shift
while [ $# -gt 0 ]; do
real_so_path "$1" /usr/lib /lib $rpaths || return 1
......@@ -1228,7 +1228,7 @@ trace_apk_deps() {
# find all packages that holds the so files
if [ -f "$dir"/.rpaths ]; then
local so_files=$(find_so_files "$dir"/.rpaths $missing) \
local so_files="$(find_so_files "$dir"/.rpaths $missing)" \
|| return 1
deppkgs=$($APK $apkroot info --quiet --who-owns $so_files) || return 1
fi
......@@ -1255,7 +1255,7 @@ trace_apk_deps() {
autodeps="$autodeps pc:$pcprefix$i"
elif subpkg_provides_pc "$i" \
|| $APK $apkroot info --quiet --installed "pc:$i"; then
local provider=$(apk $apkroot search --quiet "pc:$i")
local provider="$(apk $apkroot search --quiet "pc:$i")"
if list_has "$provider" $depends_dev; then
warning "$provider should be removed from depends_dev"
fi
......@@ -1264,7 +1264,7 @@ trace_apk_deps() {
warning "Could not find any provider for pc:$i"
local pcfile=/usr/lib/pkgconfig/"${i%%[<>=]*}".pc
if [ -e "$pcfile" ]; then
local owner=$($APK $apkroot info --quiet --who-owns $pcfile)
local owner="$($APK $apkroot info --quiet --who-owns $pcfile)"
warning "${owner:-package providing $pcfile} needs to be rebuilt"
fi
fi
......@@ -1395,7 +1395,7 @@ scan_shared_objects() {
# Converts a relative path to absolute with respect to the symlink
# path (2nd arg).
normalize_target_path() {
local path=$1
local path="$1"
case "$path" in
/*) ;;
*) path="$(dirname "$2")/$path";;
......@@ -1466,7 +1466,7 @@ human_size() {
create_apks() {
local file= dir= name= ver= apk= datadir= size=
local gzip=$(command -v pigz || echo gzip)
local gzip="$(command -v pigz || echo gzip)"
getpkgver || return 1
if ! options_has "!tracedeps"; then
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
......@@ -1484,13 +1484,13 @@ create_apks() {
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
local dir="${file%/.PKGINFO}"
local name=$(pkginfo_val pkgname $file)
local ver=$(pkginfo_val pkgver $file)
local size=$(pkginfo_val size $file | human_size)
local apk=$name-$ver.apk
local name="$(pkginfo_val pkgname $file)"
local ver="$(pkginfo_val pkgver $file)"
local size="$(pkginfo_val size $file | human_size)"
local apk="$name-$ver.apk"
local datadir="$pkgbasedir"/$name
local subpkgname=$name
local subpkgarch=$(pkginfo_val arch $file)
local subpkgname="$name"
local subpkgarch="$(pkginfo_val arch $file)"
trace_apk_deps "$name" "$dir" "$subpkgarch" || return 1
msg "Package size: ${size}"
......@@ -1507,7 +1507,7 @@ create_apks() {
msg "Create checksum..."
# append the hash for data.tar.gz
local sha256=$(sha256sum "$dir"/data.tar.gz | cut -f1 -d' ')
local sha256="$(sha256sum "$dir"/data.tar.gz | cut -f1 -d' ')"
echo "datahash = $sha256" >> "$dir"/.PKGINFO
# control.tar.gz
......@@ -1536,14 +1536,14 @@ build_abuildrepo() {
# check early if we have abuild key
abuild-sign --installed
logcmd "building $repo/$pkgname-$pkgver-r$pkgrel"
local _starttime=$(date --utc +%s)
local _starttime="$(date --utc +%s)"
msg "Building $repo/$pkgname $pkgver-r$pkgrel (using $program $program_version) started $(date -R)"
for part in sanitycheck builddeps clean fetch unpack prepare mkusers build \
$_check rootpkg; do
runpart $part
done
local _endtime=$(date --utc +%s)
local _difftime=$((_endtime - _starttime))
local _endtime="$(date --utc +%s)"
local _difftime="$((_endtime - _starttime))"
msg "Build complete at $(date -R) elapsed time $((_difftime/3600))h $((_difftime/60%60))m $((_difftime%60))s"
cleanup $CLEANUP
fi
......@@ -1570,7 +1570,7 @@ update_abuildrepo_index() {
for i in $allarch; do
cd "$REPODEST/$repo/$i"
local index=$i/APKINDEX.tar.gz
local index="$i/APKINDEX.tar.gz"
msg "Updating the $repo/$i repository index..."
local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}"
......@@ -1599,7 +1599,7 @@ check() {
# predefined splitfunc doc
default_doc() {
local gzip=$(command -v pigz || echo gzip)
local gzip="$(command -v pigz || echo gzip)"
depends="$depends_doc"
pkgdesc="$pkgdesc (documentation)"
install_if="docs $pkgname=$pkgver-r$pkgrel"
......@@ -1670,7 +1670,7 @@ default_dbg() {
mkdir -p $dstdir
fi
cd $srcdir
local XATTR=$(getfattr --match="" --dump "${srcfile}")
local XATTR="$(getfattr --match="" --dump "${srcfile}")"
${CROSS_COMPILE}objcopy --only-keep-debug $srcfile $dstfile
${CROSS_COMPILE}objcopy --add-gnu-debuglink=$dstfile $srcdir/$srcfile
mv $dstfile $dstdir
......@@ -1815,7 +1815,7 @@ srcpkg() {
done
for i in $triggers; do
local f=${i%=*}
local f="${i%=*}"
echo "Packaging trigger file: $f"
files="$files $prefix/$f"
done
......@@ -2023,7 +2023,7 @@ get_missing_deps() {
shift
while [ "$1" ]; do
local cp=${1#\!}
local cp="${1#\!}"
if [ $cp != $1 ]; then
if $cmd $cp; then
error "Conflicting package installed: $cp"
......@@ -2083,7 +2083,7 @@ builddeps() {
# find dependencies that are installed but missing in repo.
for i in $builddeps; do
local m=$($APK search --repository "$REPODEST/$repo" ${i%%[<>=]*})
local m="$($APK search --repository "$REPODEST/$repo" ${i%%[<>=]*})"
if [ -z "$m" ]; then
missing="$missing $i"
fi
......@@ -2091,8 +2091,8 @@ builddeps() {
for i in $(trace_makedepends $missing); do
# i = pkg:dir
local dir=${i#*:}
local pkg=${i%:*}
local dir="${i#*:}"
local pkg="${i%:*}"
# ignore if dependency is in other repo
[ -d "$dir" ] || continue
......@@ -2182,7 +2182,7 @@ rootbld() {
mkusers
BUILD_ROOT=$(mktemp -d /var/tmp/abuild.XXXXXXXXXX)
local aportsgit=${APORTSDIR:-${startdir}}
local aportsgit="${APORTSDIR:-${startdir}}"
mkdir -p "$BUILD_ROOT/proc" "$BUILD_ROOT/etc/apk/keys" \
"$BUILD_ROOT/$HOME/.abuild" "$BUILD_ROOT/$aportsgit" \
......@@ -2204,7 +2204,7 @@ rootbld() {
buildhost="$(printf '%s' "$gitref" | sed 's/[.]/-/')"
fi
local repo_template=$aportsgit/$repo/.rootbld-repositories
local repo_template="$aportsgit/$repo/.rootbld-repositories"
[ -s "$repo_template" ] || die "rootbld: $repo_template does not exist"
(
for key in $(git config --list --name-only); do
......@@ -2268,7 +2268,7 @@ stripbin() {
[ -e "$filename" ] || continue
[ "$osabi" != "STANDALONE" ] || continue
local XATTR=$(getfattr --match="" --dump "${filename}")
local XATTR="$(getfattr --match="" --dump "${filename}")"
"${stripcmd}" "${filename}"
if [ -n "$XATTR" ]; then
echo "$XATTR" | setfattr --restore=-
......@@ -2414,14 +2414,14 @@ snapshot() {
[ -z "$disturl" ] && warning "Missing disturl in APKBUILD, auto uploading disabled."
[ -z "$svnurl" ] && [ -z "$giturl" ] && die "Missing repository url in APKBUILD!"
[ -n "$svnurl" ] && [ -n "$giturl" ] && die "You can only use a single repository!"
local _date=$(date +%Y%m%d)
local _date="$(date +%Y%m%d)"
local _format="tar.gz"
# remove any repositories left in srcdir
abuild clean
mkdir -p "$srcdir" && cd "$srcdir"
# clone git repo and archive
if [ -n "$giturl" ]; then
local _version=${verbase:-0}_git${_date}
local _version="${verbase:-0}_git${_date}"
[ "$git" = "true" ] && die "Missing git! Install git to support git clone."
local _rev="${reporev:-HEAD}"
[ "$_rev" = "HEAD" ] && local _depth="--depth=1"
......@@ -2435,7 +2435,7 @@ snapshot() {
fi
# export svn repo and archive
if [ -n "$svnurl" ]; then
local _version=${verbase:-0}_svn${_date}
local _version="${verbase:-0}_svn${_date}"
command -v svn >/dev/null || \
die "Missing svn! Install subverion to support svn export."
[ -n "$reporev" ] && local _rev="-r $reporev"
......
......@@ -49,7 +49,7 @@ die() {
}
runpart() {
local part=$1
local part="$1"
msg "Running part $part"
$part || die "$part failed"
}
......
......@@ -154,7 +154,7 @@ __EOF__
# Create new aport from templates
newaport() {
local newname="${1##*/}"
local pn=${newname%-[0-9]*}
local pn="${newname%-[0-9]*}"
local pv
local source=
is_url "$1" && source="$1"
......
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