Commit d0e15dd5 authored by Natanael Copa's avatar Natanael Copa

buildrepo: parse APKBUILDs in subshell

so we dont leak functions like 'build' and other variables.
parent 447974ea
...@@ -47,8 +47,8 @@ all_exist() { ...@@ -47,8 +47,8 @@ all_exist() {
return 0 return 0
} }
build() { list_needbuild() {
local repo="$1" i needbuild local repo="$1" i=
cd "$aportsdir/$repo" || return 0 cd "$aportsdir/$repo" || return 0
...@@ -78,14 +78,20 @@ build() { ...@@ -78,14 +78,20 @@ build() {
# try link or copy the files if they are in the ports dir # try link or copy the files if they are in the ports dir
if all_exist $pkgs; then if all_exist $pkgs; then
echo ">>> Copying " $pkgs echo ">>> Copying " $pkgs >&2
cp -p -l $pkgs "$repodir/$repo/$CARCH"/ 2>/dev/null \ cp -p -l $pkgs "$repodir/$repo/$CARCH"/ 2>/dev/null \
|| cp -p $pkgs "$repodir/$repo/$CARCH"/ \ || cp -p $pkgs "$repodir/$repo/$CARCH"/ \
|| needbuild="$needbuild $i" || echo "$i"
else else
needbuild="$needbuild $i" echo "$i"
fi fi
done done
}
do_build() {
local repo="$1" i=
cd "$aportsdir/$repo" || return 0
local needbuild="$(list_needbuild $repo)"
# build the postponed packages if any # build the postponed packages if any
if [ -n "$needbuild" ]; then if [ -n "$needbuild" ]; then
...@@ -146,9 +152,9 @@ shift $(($OPTIND - 1)) ...@@ -146,9 +152,9 @@ shift $(($OPTIND - 1))
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
if [ -n "$logprefix" ]; then if [ -n "$logprefix" ]; then
build $1 >$logprefix.$1.log 2>&1 || exit 1 do_build $1 >$logprefix.$1.log 2>&1 || exit 1
else else
build $1 || exit 1 do_build $1 || exit 1
fi fi
deprepo="$deprepo $1" deprepo="$deprepo $1"
shift shift
......
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