Just use constraints everywhere
Having behavior on your laptop diverge from behavior in the gate is
confusing. Just use constraints on every devstack run to be consistent.
Users of devstack can edit the requirements repo in order to change
these constraints locally if necessary.
Change-Id: I843208e2e982eb04931b76f5cb4bd219fbcd70de
diff --git a/functions-common b/functions-common
index 60cf04c..749ca2b 100644
--- a/functions-common
+++ b/functions-common
@@ -28,7 +28,6 @@
# - ``REQUIREMENTS_DIR``
# - ``STACK_USER``
# - ``TRACK_DEPENDS``
-# - ``UNDO_REQUIREMENTS``
# - ``http_proxy``, ``https_proxy``, ``no_proxy``
#
diff --git a/inc/python b/inc/python
index 54e19a7..5c9dc5c 100644
--- a/inc/python
+++ b/inc/python
@@ -67,7 +67,6 @@
# Wrapper for ``pip install`` to set cache and proxy environment variables
# Uses globals ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``,
-# ``USE_CONSTRAINTS``
# pip_install package [package ...]
function pip_install {
local xtrace=$(set +o | grep xtrace)
@@ -105,11 +104,8 @@
fi
cmd_pip="$cmd_pip install"
-
- # Handle a constraints file, if needed.
- if [[ "$USE_CONSTRAINTS" == "True" ]]; then
- cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt"
- fi
+ # Always apply constraints
+ cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt"
local pip_version=$(python -c "import pip; \
print(pip.__version__.strip('.')[0])")
@@ -187,13 +183,13 @@
# use this, especially *oslo* ones
function setup_install {
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
function setup_develop {
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
@@ -209,32 +205,16 @@
# ``pip install -e`` the package, which processes the dependencies
# using pip before running `setup.py develop`
#
-# Updates the dependencies in project_dir from the
-# openstack/requirements global list before installing anything.
+# Updates the constraints from REQUIREMENTS_DIR to reflect the
+# 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
-function setup_package_with_req_sync {
+function setup_package_with_constraints_edit {
local project_dir=$1
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
# Constrain this package to this project directory from here on out.
local name=$(awk '/^name.*=/ {print $3}' $project_dir/setup.cfg)
@@ -245,19 +225,6 @@
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
diff --git a/lib/infra b/lib/infra
index eb8000e..89397de 100644
--- a/lib/infra
+++ b/lib/infra
@@ -22,7 +22,6 @@
# Defaults
# --------
GITDIR["pbr"]=$DEST/pbr
-REQUIREMENTS_DIR=$DEST/requirements
# Entry Points
# ------------
diff --git a/stack.sh b/stack.sh
index 2288af5..ba935be 100755
--- a/stack.sh
+++ b/stack.sh
@@ -688,9 +688,6 @@
echo_summary "Installing package prerequisites"
source $TOP_DIR/tools/install_prereqs.sh
-# Normalise USE_CONSTRAINTS
-USE_CONSTRAINTS=$(trueorfalse False USE_CONSTRAINTS)
-
# Configure an appropriate Python environment
if [[ "$OFFLINE" != "True" ]]; then
PYPI_ALTERNATIVE_URL=${PYPI_ALTERNATIVE_URL:-""} $TOP_DIR/tools/install_pip.sh
diff --git a/stackrc b/stackrc
index 8beef96..f67afd9 100644
--- a/stackrc
+++ b/stackrc
@@ -149,13 +149,6 @@
# Zero disables timeouts
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
# ------------
@@ -163,6 +156,9 @@
# Another option is https://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
# versions on pypi?
#
@@ -627,9 +623,6 @@
# Set default screen name
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
SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index 0f7c962..7b42c8c 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -20,7 +20,7 @@
cd $TOP_DIR
# Import common functions
-source $TOP_DIR/functions
+source $TOP_DIR/stackrc
FILES=$TOP_DIR/files