Merge "Just use constraints everywhere"

This commit is contained in:
Jenkins 2015-08-18 23:07:53 +00:00 committed by Gerrit Code Review
commit 987dc6453e
6 changed files with 13 additions and 58 deletions

View File

@ -28,7 +28,6 @@
# - ``REQUIREMENTS_DIR`` # - ``REQUIREMENTS_DIR``
# - ``STACK_USER`` # - ``STACK_USER``
# - ``TRACK_DEPENDS`` # - ``TRACK_DEPENDS``
# - ``UNDO_REQUIREMENTS``
# - ``http_proxy``, ``https_proxy``, ``no_proxy`` # - ``http_proxy``, ``https_proxy``, ``no_proxy``
# #

View File

@ -67,7 +67,6 @@ function pip_install_gr {
# Wrapper for ``pip install`` to set cache and proxy environment variables # Wrapper for ``pip install`` to set cache and proxy environment variables
# Uses globals ``OFFLINE``, ``PIP_VIRTUAL_ENV``, # Uses globals ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``, # ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
# ``USE_CONSTRAINTS``
# pip_install package [package ...] # pip_install package [package ...]
function pip_install { function pip_install {
local xtrace=$(set +o | grep xtrace) local xtrace=$(set +o | grep xtrace)
@ -105,11 +104,8 @@ function pip_install {
fi fi
cmd_pip="$cmd_pip install" cmd_pip="$cmd_pip install"
# Always apply constraints
# Handle a constraints file, if needed. cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt"
if [[ "$USE_CONSTRAINTS" == "True" ]]; then
cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt"
fi
local pip_version=$(python -c "import pip; \ local pip_version=$(python -c "import pip; \
print(pip.__version__.strip('.')[0])") print(pip.__version__.strip('.')[0])")
@ -187,13 +183,13 @@ function setup_dev_lib {
# use this, especially *oslo* ones # use this, especially *oslo* ones
function setup_install { function setup_install {
local project_dir=$1 local project_dir=$1
setup_package_with_req_sync $project_dir setup_package_with_constraints_edit $project_dir
} }
# this should be used for projects which run services, like all services # this should be used for projects which run services, like all services
function setup_develop { function setup_develop {
local project_dir=$1 local project_dir=$1
setup_package_with_req_sync $project_dir -e setup_package_with_constraints_edit $project_dir -e
} }
# determine if a project as specified by directory is in # determine if a project as specified by directory is in
@ -209,32 +205,16 @@ function is_in_projects_txt {
# ``pip install -e`` the package, which processes the dependencies # ``pip install -e`` the package, which processes the dependencies
# using pip before running `setup.py develop` # using pip before running `setup.py develop`
# #
# Updates the dependencies in project_dir from the # Updates the constraints from REQUIREMENTS_DIR to reflect the
# openstack/requirements global list before installing anything. # future installed state of this package. This ensures when we
# install this package we get the from source version.
# #
# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS`` # Uses globals ``REQUIREMENTS_DIR``
# setup_develop directory # setup_develop directory
function setup_package_with_req_sync { function setup_package_with_constraints_edit {
local project_dir=$1 local project_dir=$1
local flags=$2 local flags=$2
# Don't update repo if local changes exist
# Don't use buggy "git diff --quiet"
# ``errexit`` requires us to trap the exit code when the repo is changed
local update_requirements=$(cd $project_dir && git diff --exit-code >/dev/null || echo "changed")
if [[ $update_requirements != "changed" && "$USE_CONSTRAINTS" == "False" ]]; then
if is_in_projects_txt $project_dir; then
(cd $REQUIREMENTS_DIR; \
./.venv/bin/python update.py $project_dir)
else
# soft update projects not found in requirements project.txt
echo "$project_dir not a constrained repository, soft enforcing requirements"
(cd $REQUIREMENTS_DIR; \
./.venv/bin/python update.py -s $project_dir)
fi
fi
if [ -n "$REQUIREMENTS_DIR" ]; then if [ -n "$REQUIREMENTS_DIR" ]; then
# Constrain this package to this project directory from here on out. # Constrain this package to this project directory from here on out.
local name=$(awk '/^name.*=/ {print $3}' $project_dir/setup.cfg) local name=$(awk '/^name.*=/ {print $3}' $project_dir/setup.cfg)
@ -245,19 +225,6 @@ function setup_package_with_req_sync {
setup_package $project_dir $flags setup_package $project_dir $flags
# We've just gone and possibly modified the user's source tree in an
# automated way, which is considered bad form if it's a development
# tree because we've screwed up their next git checkin. So undo it.
#
# However... there are some circumstances, like running in the gate
# where we really really want the overridden version to stick. So provide
# a variable that tells us whether or not we should UNDO the requirements
# changes (this will be set to False in the OpenStack ci gate)
if [ $UNDO_REQUIREMENTS = "True" ]; then
if [[ $update_requirements != "changed" ]]; then
(cd $project_dir && git reset --hard)
fi
fi
} }
# ``pip install -e`` the package, which processes the dependencies # ``pip install -e`` the package, which processes the dependencies

View File

@ -22,7 +22,6 @@ set +o xtrace
# Defaults # Defaults
# -------- # --------
GITDIR["pbr"]=$DEST/pbr GITDIR["pbr"]=$DEST/pbr
REQUIREMENTS_DIR=$DEST/requirements
# Entry Points # Entry Points
# ------------ # ------------

View File

@ -688,9 +688,6 @@ save_stackenv $LINENO
echo_summary "Installing package prerequisites" echo_summary "Installing package prerequisites"
source $TOP_DIR/tools/install_prereqs.sh source $TOP_DIR/tools/install_prereqs.sh
# Normalise USE_CONSTRAINTS
USE_CONSTRAINTS=$(trueorfalse False USE_CONSTRAINTS)
# Configure an appropriate Python environment # Configure an appropriate Python environment
if [[ "$OFFLINE" != "True" ]]; then if [[ "$OFFLINE" != "True" ]]; then
PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh

13
stackrc
View File

@ -152,13 +152,6 @@ DATABASE_QUERY_LOGGING=$(trueorfalse False DATABASE_QUERY_LOGGING)
# Zero disables timeouts # Zero disables timeouts
GIT_TIMEOUT=${GIT_TIMEOUT:-0} GIT_TIMEOUT=${GIT_TIMEOUT:-0}
# Constraints mode
# - False (default) : update git projects dependencies from global-requirements.
#
# - True : use upper-constraints.txt to constrain versions of packages intalled
# and do not edit projects at all.
USE_CONSTRAINTS=$(trueorfalse False USE_CONSTRAINTS)
# Repositories # Repositories
# ------------ # ------------
@ -166,6 +159,9 @@ USE_CONSTRAINTS=$(trueorfalse False USE_CONSTRAINTS)
# Another option is https://git.openstack.org # Another option is https://git.openstack.org
GIT_BASE=${GIT_BASE:-git://git.openstack.org} GIT_BASE=${GIT_BASE:-git://git.openstack.org}
# The location of REQUIREMENTS once cloned
REQUIREMENTS_DIR=$DEST/requirements
# Which libraries should we install from git instead of using released # Which libraries should we install from git instead of using released
# versions on pypi? # versions on pypi?
# #
@ -630,9 +626,6 @@ USE_SCREEN=${SCREEN_DEV:-$USE_SCREEN}
# Set default screen name # Set default screen name
SCREEN_NAME=${SCREEN_NAME:-stack} SCREEN_NAME=${SCREEN_NAME:-stack}
# Undo requirements changes by global requirements
UNDO_REQUIREMENTS=${UNDO_REQUIREMENTS:-True}
# Allow the use of an alternate protocol (such as https) for service endpoints # Allow the use of an alternate protocol (such as https) for service endpoints
SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http} SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}

View File

@ -20,7 +20,7 @@ TOP_DIR=`cd $TOOLS_DIR/..; pwd`
cd $TOP_DIR cd $TOP_DIR
# Import common functions # Import common functions
source $TOP_DIR/functions source $TOP_DIR/stackrc
FILES=$TOP_DIR/files FILES=$TOP_DIR/files