Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problems with tag detection and PBR version setting #19

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion rpm/build-rpms
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,21 @@ if [ ${pkg} = networking-calico ]; then
# --exclude-vcs) from the source tarball that we pass to rpmbuild,
# so we calculate PBR_VERSION now and then add that to the
# environment for rpmbuild.
export PBR_VERSION=`python - <<'EOF'
if [ "$FORCE_VERSION" ]; then
# When FORCE_VERSION is specified, that is also the PBR version
# that we should set. Note: this is relevant in particular when
# there are multiple version tags on the same networking-calico
# commit (which is quite common as networking-calico doesn't
# change much). The alternative, automated method, just below,
# is currently broken when there are multiple tags on the same
# commit; see https://bugs.launchpad.net/pbr/+bug/1453996.
export PBR_VERSION=$FORCE_VERSION
else
export PBR_VERSION=`python - <<'EOF'
import pbr.version
print pbr.version.VersionInfo('networking-calico').release_string()
EOF`
fi
fi

mkdir -p /tmp/rpmbuild/BUILD \
Expand Down
7 changes: 7 additions & 0 deletions utils/create-update-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ function do_net_cal {
NETWORKING_CALICO_REPO=${NETWORKING_CALICO_REPO:-https://opendev.org/openstack/networking-calico.git}
git clone $NETWORKING_CALICO_REPO -b $NETWORKING_CALICO_CHECKOUT
cd networking-calico
# When NETWORKING_CALICO_CHECKOUT is a Git tag, set FORCE_VERSION
# to ensure that we build packages with version equal to _that_
# tag. Otherwise, if there are other tags on the checkout commit,
# we might pick up one of those by mistake.
if [ "`git tag -l $NETWORKING_CALICO_CHECKOUT --points-at`" = $NETWORKING_CALICO_CHECKOUT ]; then
export FORCE_VERSION=$NETWORKING_CALICO_CHECKOUT
fi
PKG_NAME=networking-calico \
NAME=networking-calico \
DEB_EPOCH=1: \
Expand Down
14 changes: 13 additions & 1 deletion utils/make-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,21 @@ EOF
} > debian/changelog

if [ ${PKG_NAME} = networking-calico ]; then
pbr_version=`${DOCKER_RUN_RM} -i calico-build/${series} python - <<'EOF'
if [ "$FORCE_VERSION" ]; then
# When FORCE_VERSION is specified, that is also the PBR version
# that we should set. Note: this is relevant in particular when
# there are multiple version tags on the same networking-calico
# commit (which is quite common as networking-calico doesn't
# change much). The alternative, automated method, just below,
# is currently broken when there are multiple tags on the same
# commit; see https://bugs.launchpad.net/pbr/+bug/1453996.
pbr_version=$FORCE_VERSION
else
pbr_version=`${DOCKER_RUN_RM} -i calico-build/${series} python - <<'EOF'
import pbr.version
print pbr.version.VersionInfo('networking-calico').release_string()
EOF`
fi
# Update PBR_VERSION setting in debian/rules.
sed -i "s/^export PBR_VERSION=.*$/export PBR_VERSION=${pbr_version}/" debian/rules
fi
Expand Down Expand Up @@ -134,6 +145,7 @@ EOF
# Skip the rpm build if we are missing the matching build image.
imageid=$(docker images -q calico-build/centos${elversion}:latest)
[ -n "$imageid" ] && ${DOCKER_RUN_RM} -e EL_VERSION=el${elversion} \
-e FORCE_VERSION=${FORCE_VERSION} \
$imageid ../rpm/build-rpms
done

Expand Down