Preserve result returned by apt-get and pip
Change I855ffe9c7a75e9943106af0f70cf715c34ae25c5 and
I368fec44858bd97fc6a314fb20eed2b10932cbb1 added timing
infrastructure which hides the return value of
the main commands. Restore the prior behaviour.
Change-Id: I4a536abefa7824ac6d42e7bbbf1079d9cc055984
Closes-Bug: #1518545
diff --git a/functions-common b/functions-common
index 4a9db34..486dcc5 100644
--- a/functions-common
+++ b/functions-common
@@ -1045,7 +1045,7 @@
# Uses globals ``OFFLINE``, ``*_proxy``
# apt_get operation package [package ...]
function apt_get {
- local xtrace
+ local xtrace result
xtrace=$(set +o | grep xtrace)
set +o xtrace
@@ -1062,9 +1062,11 @@
http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
no_proxy=${no_proxy:-} \
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
+ result=$?
# stop the clock
time_stop "apt-get"
+ return $result
}
function _parse_package_files {
diff --git a/inc/python b/inc/python
index c157604..f4f65fd 100644
--- a/inc/python
+++ b/inc/python
@@ -81,7 +81,7 @@
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
# pip_install package [package ...]
function pip_install {
- local xtrace
+ local xtrace result
xtrace=$(set +o | grep xtrace)
set +o xtrace
local upgrade=""
@@ -155,10 +155,11 @@
PIP_FIND_LINKS=$PIP_FIND_LINKS \
$cmd_pip $upgrade \
$@
+ result=$?
# Also install test requirements
local test_req="${!#}/test-requirements.txt"
- if [[ -e "$test_req" ]]; then
+ if [[ $result == 0 ]] && [[ -e "$test_req" ]]; then
echo "Installing test-requirements for $test_req"
$sudo_pip \
http_proxy=${http_proxy:-} \
@@ -167,9 +168,11 @@
PIP_FIND_LINKS=$PIP_FIND_LINKS \
$cmd_pip $upgrade \
-r $test_req
+ result=$?
fi
time_stop "pip_install"
+ return $result
}
# get version of a package from global requirements file