summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-13 03:54:58 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-13 03:54:58 (EDT)
commit8173bcbcc3a05333979b0da0a765b4dedde7448e (patch)
tree09eda12b33c4b81b202a21f1a869cd2f47b67314
parente59f223d3376b94a31131d1c5b72ea37fda47a00 (diff)
Don't let libopkbuild errors cause exit with -e
-rw-r--r--lib/changelog.sh4
-rw-r--r--lib/metadata.sh24
-rw-r--r--lib/metadata/proteanos.sh9
-rw-r--r--lib/package.sh16
-rw-r--r--src/ob-checkbuilddeps.sh5
-rw-r--r--src/ob-installdocs.sh3
-rw-r--r--src/opkbuild.sh18
7 files changed, 38 insertions, 41 deletions
diff --git a/lib/changelog.sh b/lib/changelog.sh
index 3216f94..83f4ca1 100644
--- a/lib/changelog.sh
+++ b/lib/changelog.sh
@@ -151,10 +151,8 @@ ob_parse_changelog()
elif [ -n "${source}" ]; then
"${entry_cb}" "${source}" "${version}" \
"${distribution}" "${changes}" \
- "${maintainer}" "${date}"
- if [ ${?} -ne 0 ]; then
+ "${maintainer}" "${date}" || \
return 0
- fi
fi
expect='next_or_eof'
blank_lines=''
diff --git a/lib/metadata.sh b/lib/metadata.sh
index c6f5a16..e22a6e7 100644
--- a/lib/metadata.sh
+++ b/lib/metadata.sh
@@ -22,9 +22,9 @@ _ob_metadata_do()
local func="${1}"
shift 1 || _ob_abort
- "_ob_${func}" "${@}"
+ "_ob_${func}" "${@}" || return ${?}
- return ${?}
+ return 0
}
## @brief Validate a source package name
@@ -39,9 +39,9 @@ ob_validate_source_name()
local name="${1}"
shift 1 || _ob_abort
- _ob_metadata_do 'validate_source_name' "${name}"
+ _ob_metadata_do 'validate_source_name' "${name}" || return ${?}
- return ${?}
+ return 0
}
## @brief Validate a binary package name
@@ -56,9 +56,9 @@ ob_validate_binary_name()
local name="${1}"
shift 1 || _ob_abort
- _ob_metadata_do 'validate_binary_name' "${name}"
+ _ob_metadata_do 'validate_binary_name' "${name}" || return ${?}
- return ${?}
+ return 0
}
## @brief Parse a source package version
@@ -136,9 +136,9 @@ ob_parse_version()
## @pure yes This function has no side effects.
ob_get_system_arch()
{
- _ob_metadata_do 'get_system_arch'
+ _ob_metadata_do 'get_system_arch' || return ${?}
- return ${?}
+ return 0
}
## @brief Get the running system's platform
@@ -151,9 +151,9 @@ ob_get_system_arch()
## @pure yes This function has no side effects.
ob_get_system_plat()
{
- _ob_metadata_do 'get_system_plat'
+ _ob_metadata_do 'get_system_plat' || return ${?}
- return ${?}
+ return 0
}
ob_match_arch()
@@ -328,7 +328,7 @@ ob_get_system_path()
local path_id="${1}"
shift 1 || _ob_abort
- _ob_metadata_do 'get_system_path' "${path_id}" "${@}"
+ _ob_metadata_do 'get_system_path' "${path_id}" "${@}" || return ${?}
- return ${?}
+ return 0
}
diff --git a/lib/metadata/proteanos.sh b/lib/metadata/proteanos.sh
index 4152847..6368668 100644
--- a/lib/metadata/proteanos.sh
+++ b/lib/metadata/proteanos.sh
@@ -72,11 +72,14 @@ _ob_validate_version()
local version="${1}"
shift 1 || _ob_abort
- grep -E "${_OB_VERSION_RE_PROTEANOS}" >/dev/null 2>&1 <<-EOF
+ if grep -E "${_OB_VERSION_RE_PROTEANOS}" >/dev/null 2>&1 <<-EOF
${version}
EOF
-
- return ${?}
+ then
+ return 0
+ else
+ return 1
+ fi
}
_ob_get_upstreamver()
diff --git a/lib/package.sh b/lib/package.sh
index c2ffae2..aa1a9a3 100644
--- a/lib/package.sh
+++ b/lib/package.sh
@@ -53,9 +53,9 @@ _ob_package_do()
local func="${1}"
shift 1 || _ob_abort
- "_ob_${func}_${_OB_PACKAGE_FORMAT}" "${@}"
+ "_ob_${func}_${_OB_PACKAGE_FORMAT}" "${@}" || return ${?}
- return ${?}
+ return 0
}
ob_parse_package_metadata()
@@ -252,9 +252,9 @@ ob_get_binary_parameter()
ob_get_doc_package()
{
- _ob_package_do 'get_doc_package'
+ _ob_package_do 'get_doc_package' || return ${?}
- return ${?}
+ return 0
}
ob_get_doc_files()
@@ -263,9 +263,9 @@ ob_get_doc_files()
local plat="${2}"
shift 2 || _ob_abort
- _ob_package_do 'get_doc_files' "${arch}" "${plat}"
+ _ob_package_do 'get_doc_files' "${arch}" "${plat}" || return ${?}
- return ${?}
+ return 0
}
ob_summarize_package_arch()
@@ -287,9 +287,9 @@ ob_set_package_substvars()
local pkg="${1}"
shift 1 || _ob_abort
- _ob_package_do 'set_package_substvars' "${pkg}"
+ _ob_package_do 'set_package_substvars' "${pkg}" || return ${?}
- return ${?}
+ return 0
}
_ob_set_binary_packages()
diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh
index fd1f10b..c342666 100644
--- a/src/ob-checkbuilddeps.sh
+++ b/src/ob-checkbuilddeps.sh
@@ -86,8 +86,9 @@ main()
ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
ob_set_package_substvars ''
- check_build_deps
- return ${?}
+ check_build_deps || return ${?}
+
+ return 0
}
main "${@}"
diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh
index f48f97d..9516636 100644
--- a/src/ob-installdocs.sh
+++ b/src/ob-installdocs.sh
@@ -51,8 +51,7 @@ main()
ob_init_package '..' || exit 1
ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
- doc_pkg="$(ob_get_doc_package)"
- if [ ${?} -ne 0 ]; then
+ if ! doc_pkg="$(ob_get_doc_package)"; then
ob_error "$(ob_get_msg 'cant_get_doc_pkg')"
fi
doc_pkg_doc_dir="$(ob_get_system_path 'package-docs' \
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 9f3de2c..50cd26e 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -158,9 +158,7 @@ get_options()
test_uid0_cmd()
{
# Verify that the UID 0 command works.
- test_uid=$("${opt_uid0_cmd}" -- id -u)
-
- if [ ${?} -ne 0 ]; then
+ if ! test_uid=$("${opt_uid0_cmd}" -- id -u); then
ob_error "$(ob_get_msg 'uid0_cmd_not_found')" "${opt_uid0_cmd}"
fi
@@ -311,15 +309,13 @@ build()
{
case "${opt_target}" in
'')
- ../build build && \
- ${opt_uid0_cmd} -- ../build install && \
- ${opt_uid0_cmd} -- '${BINDIR}/ob-installdocs' && \
- ${opt_uid0_cmd} -- '${BINDIR}/ob-gencontrol' && \
- ${opt_uid0_cmd} -- '${BINDIR}/ob-buildopk' && \
- ${opt_uid0_cmd} -- '${BINDIR}/ob-genchanges'
- if [ ${?} -ne 0 ]; then
+ ../build build &&
+ ${opt_uid0_cmd} -- ../build install &&
+ ${opt_uid0_cmd} -- '${BINDIR}/ob-installdocs' &&
+ ${opt_uid0_cmd} -- '${BINDIR}/ob-gencontrol' &&
+ ${opt_uid0_cmd} -- '${BINDIR}/ob-buildopk' &&
+ ${opt_uid0_cmd} -- '${BINDIR}/ob-genchanges' ||
exit 1
- fi
;;
'install'|'install-'*)
if ! ${opt_uid0_cmd} -- ../build "${opt_target}"; then