From efdf6e38bcd85d4f62310a3e33a2e3e144f0a8ee Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 01:37:23 -0400 Subject: ob-buildopk: Declare local variables and wrap long lines --- (limited to 'src') diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh index f0758fb..56c10b3 100644 --- a/src/ob-buildopk.sh +++ b/src/ob-buildopk.sh @@ -17,14 +17,15 @@ # You should have received a copy of the GNU General Public License # along with opkbuild. If not, see . -set -e +set -eu build_opk() { - binary="${1}" - version="${2}" - arch="${3}" - plat="${4}" + local binary="${1}" + local version="${2}" + local arch="${3}" + local plat="${4}" + shift 4 (cd -- "${binary}.data" && tar -czf '../data.tar.gz' '.') (cd -- "${binary}.control" && tar -czf '../control.tar.gz' '.') @@ -38,6 +39,9 @@ build_opk() main() { + local arch= + local plat= + if ! ob_set_text_domain 'opkbuild'; then printf '%s: Error: Failed to load locale messages\n' \ "${0##*/}" >&2 @@ -48,14 +52,17 @@ main() printf '2.0\n' >'debian-binary' if [ x"${OB_DO_SOURCE:+set}" = x'set' ]; then - build_opk "src-${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" 'src' 'all' + build_opk "src-${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" \ + 'src' 'all' else for pkg in ${OPK_PACKAGES_REDUCED}; do - arch="$(ob_get_binary_parameter "${pkg}" 'Architecture')" + arch="$(ob_get_binary_parameter "${pkg}" \ + 'Architecture')" [ x"${arch}" != x'all' ] && arch="${OPK_HOST_ARCH}" plat="$(ob_get_binary_parameter "${pkg}" 'Platform')" [ x"${plat}" != x'all' ] && plat="${OPK_HOST_PLAT}" - build_opk "${pkg}" "${OPK_BINARY_VERSION}" "${arch}" "${plat}" + build_opk "${pkg}" "${OPK_BINARY_VERSION}" \ + "${arch}" "${plat}" done fi rm 'debian-binary' -- cgit v0.9.1