Skip to content

Commit 4839403

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "allow for soft updating of global-requirements"
2 parents 33d079b + def1534 commit 4839403

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

functions-common

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,16 @@ function setup_develop {
16451645
setup_package_with_req_sync $project_dir -e
16461646
}
16471647

1648+
# determine if a project as specified by directory is in
1649+
# projects.txt. This will not be an exact match because we throw away
1650+
# the namespacing when we clone, but it should be good enough in all
1651+
# practical ways.
1652+
function is_in_projects_txt {
1653+
local project_dir=$1
1654+
local project_name=$(basename $project_dir)
1655+
return grep "/$project_name\$" $REQUIREMENTS_DIR/projects.txt >/dev/null
1656+
}
1657+
16481658
# ``pip install -e`` the package, which processes the dependencies
16491659
# using pip before running `setup.py develop`
16501660
#
@@ -1663,8 +1673,19 @@ function setup_package_with_req_sync {
16631673
local update_requirements=$(cd $project_dir && git diff --exit-code >/dev/null || echo "changed")
16641674

16651675
if [[ $update_requirements != "changed" ]]; then
1666-
(cd $REQUIREMENTS_DIR; \
1667-
python update.py $project_dir)
1676+
if [[ "$REQUIREMENTS_MODE" == "soft" ]]; then
1677+
if is_in_projects_txt $project_dir; then
1678+
(cd $REQUIREMENTS_DIR; \
1679+
python update.py $project_dir)
1680+
else
1681+
# soft update projects not found in requirements project.txt
1682+
(cd $REQUIREMENTS_DIR; \
1683+
python update.py -s $project_dir)
1684+
fi
1685+
else
1686+
(cd $REQUIREMENTS_DIR; \
1687+
python update.py $project_dir)
1688+
fi
16681689
fi
16691690

16701691
setup_package $project_dir $flags

stackrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ DATABASE_QUERY_LOGGING=$(trueorfalse True $DATABASE_QUERY_LOGGING)
116116
# Zero disables timeouts
117117
GIT_TIMEOUT=${GIT_TIMEOUT:-0}
118118

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+
119130
# Repositories
120131
# ------------
121132

0 commit comments

Comments
 (0)