Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
disable parallel xargs where not supported (i.e. on busybox)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonewest818 committed Mar 20, 2017
1 parent 29f15e0 commit c592966
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/build_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,22 @@ else
fi
p=${BUILD_JOBS:-"${p}"}

# disable parallel xargs where not supported (ie on busybox)
XARGS="xargs -P $p"
XARGSDESC="in ${p} parallel processes"
if [[ "${OS}" == "Linux" ]]; then
if [[ ! -x "$(command -v readlink)" || "$(basename $(readlink -f $(which xargs)))" == "busybox" ]]; then
XARGS="xargs"
XARGSDESC="serially"
fi
fi

if [[ "${GOARCH}" == "amd64" ]]; then
build_path="${__proj_dir}/build/${GOOS}/x86_64"
else
build_path="${__proj_dir}/build/${GOOS}/${GOARCH}"
fi

mkdir -p "${build_path}/plugins"
_info "building plugins for ${GOOS}/${GOARCH} in ${p} parallel processes"
find "${__proj_dir}/plugin/" -type d -iname "snap-*" -print0 | xargs -0 -n 1 -P $p -I{} "${__dir}/build_plugin.sh" {}
_info "building plugins for ${GOOS}/${GOARCH} ${XARGSDESC}"
find "${__proj_dir}/plugin/" -type d -iname "snap-*" -print0 | $XARGS -0 -n 1 -I{} "${__dir}/build_plugin.sh" {}

0 comments on commit c592966

Please sign in to comment.