Merge "Preserve result returned by apt-get and pip"

This commit is contained in:
Jenkins 2016-01-05 18:56:26 +00:00 committed by Gerrit Code Review
commit 8ba3cf0132
2 changed files with 8 additions and 3 deletions

View File

@ -1045,7 +1045,7 @@ function apt_get_update {
# Uses globals ``OFFLINE``, ``*_proxy`` # Uses globals ``OFFLINE``, ``*_proxy``
# apt_get operation package [package ...] # apt_get operation package [package ...]
function apt_get { function apt_get {
local xtrace local xtrace result
xtrace=$(set +o | grep xtrace) xtrace=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
@ -1062,9 +1062,11 @@ function apt_get {
http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \ http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
no_proxy=${no_proxy:-} \ no_proxy=${no_proxy:-} \
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@" apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
result=$?
# stop the clock # stop the clock
time_stop "apt-get" time_stop "apt-get"
return $result
} }
function _parse_package_files { function _parse_package_files {

View File

@ -81,7 +81,7 @@ function get_python_versions_for_package {
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``, # ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
# pip_install package [package ...] # pip_install package [package ...]
function pip_install { function pip_install {
local xtrace local xtrace result
xtrace=$(set +o | grep xtrace) xtrace=$(set +o | grep xtrace)
set +o xtrace set +o xtrace
local upgrade="" local upgrade=""
@ -155,10 +155,11 @@ function pip_install {
PIP_FIND_LINKS=$PIP_FIND_LINKS \ PIP_FIND_LINKS=$PIP_FIND_LINKS \
$cmd_pip $upgrade \ $cmd_pip $upgrade \
$@ $@
result=$?
# Also install test requirements # Also install test requirements
local test_req="${!#}/test-requirements.txt" 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" echo "Installing test-requirements for $test_req"
$sudo_pip \ $sudo_pip \
http_proxy=${http_proxy:-} \ http_proxy=${http_proxy:-} \
@ -167,9 +168,11 @@ function pip_install {
PIP_FIND_LINKS=$PIP_FIND_LINKS \ PIP_FIND_LINKS=$PIP_FIND_LINKS \
$cmd_pip $upgrade \ $cmd_pip $upgrade \
-r $test_req -r $test_req
result=$?
fi fi
time_stop "pip_install" time_stop "pip_install"
return $result
} }
# get version of a package from global requirements file # get version of a package from global requirements file