Abuild /bin/sh compatibility
This commit is contained in:
parent
69fc8b8fc1
commit
b12fd561c8
40
abuild.in
40
abuild.in
@ -1,4 +1,4 @@
|
|||||||
#!/bin/ash -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
# abuild - build apk packages (light version of makepkg)
|
# abuild - build apk packages (light version of makepkg)
|
||||||
# Copyright (c) 2008-2015 Natanael Copa <ncopa@alpinelinux.org>
|
# Copyright (c) 2008-2015 Natanael Copa <ncopa@alpinelinux.org>
|
||||||
@ -33,7 +33,7 @@ apk_opt_wait="--wait 30"
|
|||||||
umask 022
|
umask 022
|
||||||
|
|
||||||
shell_escape() {
|
shell_escape() {
|
||||||
echo \'${1/\'/\'\\\'\'}\'
|
echo \'$(echo "$1" | sed s/\'/\'\\\'\'/)\'
|
||||||
}
|
}
|
||||||
|
|
||||||
# run optional log command for remote logging
|
# run optional log command for remote logging
|
||||||
@ -190,12 +190,12 @@ default_sanitycheck() {
|
|||||||
is_function package || die "Missing package() function in APKBUILD"
|
is_function package || die "Missing package() function in APKBUILD"
|
||||||
|
|
||||||
if [ -n "$replaces_priority" ] \
|
if [ -n "$replaces_priority" ] \
|
||||||
&& ! echo $replaces_priority | egrep -q '^[0-9]+$'; then
|
&& ! echo $replaces_priority | grep -Eq '^[0-9]+$'; then
|
||||||
die "replaces_priority must be a number"
|
die "replaces_priority must be a number"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$provider_priority" ] \
|
if [ -n "$provider_priority" ] \
|
||||||
&& ! echo $provider_priority | egrep -q '^[0-9]+$'; then
|
&& ! echo $provider_priority | grep -Eq '^[0-9]+$'; then
|
||||||
die "provider_priority must be a number"
|
die "provider_priority must be a number"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ 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=$(printf '\n')
|
||||||
endreturnval=0
|
endreturnval=0
|
||||||
for src in $sums; do
|
for src in $sums; do
|
||||||
origin=$1; shift
|
origin=$1; shift
|
||||||
@ -330,7 +330,7 @@ sumcheck() {
|
|||||||
endreturnval=1
|
endreturnval=1
|
||||||
is_remote $origin || continue
|
is_remote $origin || continue
|
||||||
|
|
||||||
local csum="${src:0:8}"
|
local csum="$(echo "$src" | cut -c1-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."
|
||||||
@ -581,7 +581,7 @@ 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"
|
rm -f "$REPODEST/$repo/$(echo "$subpkgarch" | sed s/noarch/$CARCH/)/$subpkgname-$pkgver-r$pkgrel.apk"
|
||||||
done
|
done
|
||||||
subpkg_unset
|
subpkg_unset
|
||||||
|
|
||||||
@ -940,7 +940,7 @@ check_license() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_secfixes_comment() {
|
check_secfixes_comment() {
|
||||||
local c=$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' $APKBUILD | grep '^#')
|
local c="$(sed -E -n -e '/^# secfixes:/,/(^[^#]|^$)/p' $APKBUILD | grep '^#')"
|
||||||
local invalid=$(echo "$c" \
|
local invalid=$(echo "$c" \
|
||||||
| grep -v -E '(^# secfixes:|^# +- [A-Z0-9-]+|^# [0-9]+.*:$|^#$)')
|
| grep -v -E '(^# secfixes:|^# +- [A-Z0-9-]+|^# [0-9]+.*:$|^#$)')
|
||||||
if [ -z "$invalid" ]; then
|
if [ -z "$invalid" ]; then
|
||||||
@ -948,9 +948,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
|
||||||
|
|
||||||
@ -1076,7 +1076,7 @@ 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"
|
echo "triggers = $(echo "$dirs" | sed "s/\/:/ /")" >> "$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"
|
||||||
@ -1494,7 +1494,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
|
[ "$(echo "$path" | cut -c1)" = / ] || path=$(dirname "$2")/$path
|
||||||
|
|
||||||
local oifs="$IFS" pathstr= i=
|
local oifs="$IFS" pathstr= i=
|
||||||
IFS='/'
|
IFS='/'
|
||||||
@ -1634,8 +1634,8 @@ 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}
|
mkdir -p "$REPODEST"/$repo/$(echo "$subpkgarch" | sed s/noarch/$CARCH/)
|
||||||
cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}/$apk
|
cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/$(echo "$subpkgarch" | sed s/noarch/$CARCH/)/$apk
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -1677,7 +1677,7 @@ update_abuildrepo_index() {
|
|||||||
##NOARCH: These packages are really in $CARCH and do not need their
|
##NOARCH: These packages are really in $CARCH and do not need their
|
||||||
# own repository. --rewrite-arch is used below to make sure the index
|
# own repository. --rewrite-arch is used below to make sure the index
|
||||||
# thinks they are for $CARCH and apk-tools will fetch them from
|
# thinks they are for $CARCH and apk-tools will fetch them from
|
||||||
# correct URL path. Remainder of the script uses ${subpkgarch/noarch/$CARCH}
|
# correct URL path. Remainder of the script uses $(echo "$subpkgarch" | sed s/noarch/$CARCH/)
|
||||||
# when expanding to the target repository path.
|
# when expanding to the target repository path.
|
||||||
[ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
|
[ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
|
||||||
list_has "$subpkgarch" "$allarch" || allarch="$allarch $subpkgarch"
|
list_has "$subpkgarch" "$allarch" || allarch="$allarch $subpkgarch"
|
||||||
@ -1955,7 +1955,7 @@ fishcomp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_function() {
|
is_function() {
|
||||||
type "$1" 2>&1 | head -n 1 | egrep -q "is a (shell )?function"
|
type "$1" 2>&1 | head -n 1 | grep -E "is a (shell )?function"
|
||||||
}
|
}
|
||||||
|
|
||||||
do_fakeroot() {
|
do_fakeroot() {
|
||||||
@ -2045,7 +2045,7 @@ 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
|
if [ ! -f "$REPODEST/$repo/$(echo "$subpkgarch" | sed s/noarch/$CARCH/)/$subpkgname-$pkgver-r$pkgrel.apk" ]; then
|
||||||
subpkg_unset
|
subpkg_unset
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -2060,7 +2060,7 @@ 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
|
if [ "$s" -nt "$REPODEST/$repo/$(echo "$pkgarch" | sed s/noarch/$CARCH/)/$pkgname-$pkgver-r$pkgrel.apk" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -2073,7 +2073,7 @@ 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}
|
local dir="$REPODEST"/$repo/$(echo "$subpkgarch" | sed s/noarch/$CARCH/)
|
||||||
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
|
||||||
|
|
||||||
@ -2277,7 +2277,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=$(echo "$gitref" | sed s/./-/)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -s "$repo_template" ] || die "rootbld: $repo_template does not exist"
|
[ -s "$repo_template" ] || die "rootbld: $repo_template does not exist"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user