summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-13 15:29:43 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-13 15:29:43 (EDT)
commit548d1b7add98f011d6204ebd0b4493350a12518a (patch)
tree291b6465b20c595927e3c3432408b229d5f88348
parentfdd86a394fe5c6a2dbd49d3033f4a78380d62ea3 (diff)
opkbuild: Add more return statements
-rw-r--r--src/opkbuild.sh58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 136743b..d76c568 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -207,27 +207,33 @@ setup_arch_plat()
<<-EOF
${OPK_HOST_ARCH}
EOF
+
+ return 0
}
make_work_area()
{
ob_info "$(ob_get_msg 'make_work_area')"
- mkdir -p 'tmp'
- cd 'tmp'
+ mkdir -p 'tmp' || return 1
+ cd 'tmp' || return 1
+
+ return 0
}
setup_package()
{
ob_info "$(ob_get_msg 'parse_package_metadata')"
- ob_init_package '..' || exit 1
- ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
+ ob_init_package '..' || return 1
+ ob_parse_package_metadata -c '.opkbuild.cache' || return 1
OPK_SOURCE="$(ob_get_source_parameter 'Source')"
OPK_SOURCE_VERSION="$(ob_get_source_parameter 'Version')"
ob_parse_version -u 'OPK_SOURCE_VERSION_UPSTREAM' "${OPK_SOURCE_VERSION}"
OPK_BINARY_VERSION="$(ob_get_source_parameter 'Version')"
+
+ return 0
}
build_source()
@@ -259,13 +265,13 @@ build_source()
done
if ! OB_DO_SOURCE='true' "${BINDIR}/ob-gencontrol"; then
- exit 1
+ return 1
fi
if ! OB_DO_SOURCE='true' "${BINDIR}/ob-buildopk"; then
- exit 1
+ return 1
fi
if ! OB_DO_SOURCE='true' "${BINDIR}/ob-genchanges"; then
- exit 1
+ return 1
fi
if ! rm -Rf "src-${src}.data"; then
@@ -316,15 +322,17 @@ setup_build()
eval "$("${BINDIR}/ob-buildenv" | sed 's/^/export /')"
if ! "${BINDIR}/ob-unpacksource"; then
- exit 1
+ return 1
fi
if ! "${BINDIR}/ob-applypatches"; then
# TODO: Remove the ":" after fixing ob-applypatches.
- : exit 1
+ : return 1
fi
if ! "${BINDIR}/ob-installplatconf"; then
- exit 1
+ return 1
fi
+
+ return 0
}
build()
@@ -337,27 +345,31 @@ build()
${opt_uid0_cmd} -- '${BINDIR}/ob-gencontrol' &&
${opt_uid0_cmd} -- '${BINDIR}/ob-buildopk' &&
${opt_uid0_cmd} -- '${BINDIR}/ob-genchanges' ||
- exit 1
+ return 1
;;
'install'|'install-'*)
if ! ${opt_uid0_cmd} -- ../build "${opt_target}"; then
- exit 1
+ return 1
fi
;;
*)
if ! ../build "${opt_target}"; then
- exit 1
+ return 1
fi
;;
esac
+
+ return 0
}
clean()
{
if "${opt_clean}"; then
- cd ..
- rm -Rf 'tmp'
+ cd .. || return 1
+ rm -Rf 'tmp' || return 1
fi
+
+ return 0
}
main()
@@ -368,16 +380,16 @@ main()
shift $(($OPTIND - 1))
if [ ${#} -ne 0 ]; then
usage
- exit 1
+ return 1
fi
test_uid0_cmd || return 1
- setup_arch_plat
+ setup_arch_plat || return 1
- make_work_area
+ make_work_area || return 1
- setup_package
+ setup_package || return 1
if [ "${opt_build}" = 'source' -o "${opt_build}" = 'full' ]; then
build_source || return 1
@@ -387,12 +399,12 @@ main()
print_arch_stats
if "${opt_check_build_deps}"; then
if ! "${BINDIR}/ob-checkbuilddeps"; then
- exit 1
+ return 1
fi
fi
- setup_build
- build
- clean
+ setup_build || return 1
+ build || return 1
+ clean || return 1
fi
return 0