try harder to update constraint when a library is released

Some of the libraries are listed in the constraints file using the name
found in setup.cfg and some are listed using their canonical name. There
doesn't seem to be any pattern to which is which, so just try to update
both names under the assumption that only one will be present or if for
some unforeseen reason both are there that we want them to be the same
anyway.

Change-Id: Ia02a4c4365f1e0eb60f186c12a0c16849030c8a5
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-08-09 10:12:40 -04:00
parent 11e0a1043a
commit 1776bff1a1

View File

@ -105,10 +105,20 @@ else
$BUGS $BUGS
fi fi
# Apply the PEP 503 rules to turn the dist name into a canonical form,
# in case that's the version that appears in upper-constraints.txt. We
# have to try substituting both versions because we have a mix in that
# file and if we rename projects we'll end up with bad references to
# existing build artifacts.
function pep503 {
echo $1 | sed -e 's/[-_.]\+/-/g' | tr '[:upper:]' '[:lower:]'
}
# Try to propose a constraints update for libraries. # Try to propose a constraints update for libraries.
if [[ $INCLUDE_PYPI == "yes" ]]; then if [[ $INCLUDE_PYPI == "yes" ]]; then
echo "Proposing constraints update" echo "Proposing constraints update"
dist_name=$(python setup.py --name) dist_name=$(python setup.py --name)
canonical_name=$(pep503 $dist_name)
if [[ -z "$dist_name" ]]; then if [[ -z "$dist_name" ]]; then
echo "Could not determine the name of the constraint to update" echo "Could not determine the name of the constraint to update"
else else
@ -117,6 +127,7 @@ if [[ $INCLUDE_PYPI == "yes" ]]; then
cd openstack/requirements cd openstack/requirements
git checkout -b "$dist_name-$VERSION" git checkout -b "$dist_name-$VERSION"
sed -e "s/^${dist_name}=.*/$dist_name===$VERSION/" --in-place upper-constraints.txt sed -e "s/^${dist_name}=.*/$dist_name===$VERSION/" --in-place upper-constraints.txt
sed -e "s/^${canonical_name}=.*/$canonical_name===$VERSION/" --in-place upper-constraints.txt
git commit -a -m "update constraint for $dist_name to new release $VERSION git commit -a -m "update constraint for $dist_name to new release $VERSION
$TAGMSG $TAGMSG