This creates a devstack REQUIREMENTS_MODE which is how we handle
syncing of global requirements. The default is 'strict', which is
current behavior. There is a new 'soft' mode which does a
--soft-update for projects *not* found in projects.txt, which lets
them specify additional requirements.
Change-Id: I4aa606514131b5dde67d87f5c8db5a3f3e50fc03
Depends-On: I1f195ef9ff1509659848e14ec9936ff6f66a6496
| ... | ... |
@@ -1606,6 +1606,16 @@ function setup_develop {
|
| 1606 | 1606 |
setup_package_with_req_sync $project_dir -e |
| 1607 | 1607 |
} |
| 1608 | 1608 |
|
| 1609 |
+# determine if a project as specified by directory is in |
|
| 1610 |
+# projects.txt. This will not be an exact match because we throw away |
|
| 1611 |
+# the namespacing when we clone, but it should be good enough in all |
|
| 1612 |
+# practical ways. |
|
| 1613 |
+function is_in_projects_txt {
|
|
| 1614 |
+ local project_dir=$1 |
|
| 1615 |
+ local project_name=$(basename $project_dir) |
|
| 1616 |
+ return grep "/$project_name\$" $REQUIREMENTS_DIR/projects.txt >/dev/null |
|
| 1617 |
+} |
|
| 1618 |
+ |
|
| 1609 | 1619 |
# ``pip install -e`` the package, which processes the dependencies |
| 1610 | 1620 |
# using pip before running `setup.py develop` |
| 1611 | 1621 |
# |
| ... | ... |
@@ -1624,8 +1634,19 @@ function setup_package_with_req_sync {
|
| 1624 | 1624 |
local update_requirements=$(cd $project_dir && git diff --exit-code >/dev/null || echo "changed") |
| 1625 | 1625 |
|
| 1626 | 1626 |
if [[ $update_requirements != "changed" ]]; then |
| 1627 |
- (cd $REQUIREMENTS_DIR; \ |
|
| 1628 |
- python update.py $project_dir) |
|
| 1627 |
+ if [[ "$REQUIREMENTS_MODE" == "soft" ]]; then |
|
| 1628 |
+ if is_in_projects_txt $project_dir; then |
|
| 1629 |
+ (cd $REQUIREMENTS_DIR; \ |
|
| 1630 |
+ python update.py $project_dir) |
|
| 1631 |
+ else |
|
| 1632 |
+ # soft update projects not found in requirements project.txt |
|
| 1633 |
+ (cd $REQUIREMENTS_DIR; \ |
|
| 1634 |
+ python update.py -s $project_dir) |
|
| 1635 |
+ fi |
|
| 1636 |
+ else |
|
| 1637 |
+ (cd $REQUIREMENTS_DIR; \ |
|
| 1638 |
+ python update.py $project_dir) |
|
| 1639 |
+ fi |
|
| 1629 | 1640 |
fi |
| 1630 | 1641 |
|
| 1631 | 1642 |
setup_package $project_dir $flags |
| ... | ... |
@@ -116,6 +116,17 @@ DATABASE_QUERY_LOGGING=$(trueorfalse True $DATABASE_QUERY_LOGGING) |
| 116 | 116 |
# Zero disables timeouts |
| 117 | 117 |
GIT_TIMEOUT=${GIT_TIMEOUT:-0}
|
| 118 | 118 |
|
| 119 |
+# Requirements enforcing mode |
|
| 120 |
+# |
|
| 121 |
+# - strict (default) : ensure all project requirements files match |
|
| 122 |
+# what's in global requirements. |
|
| 123 |
+# |
|
| 124 |
+# - soft : enforce requirements on everything in |
|
| 125 |
+# requirements/projects.txt, but do soft updates on all other |
|
| 126 |
+# repositories (i.e. sync versions for requirements that are in g-r, |
|
| 127 |
+# but pass through any extras) |
|
| 128 |
+REQUIREMENTS_MODE=${REQUIREMENTS_MODE:-strict}
|
|
| 129 |
+ |
|
| 119 | 130 |
# Repositories |
| 120 | 131 |
# ------------ |
| 121 | 132 |
|