PBR

Comment 0 for bug 1356784

Revision history for this message
Bence Romsics (rubasov+launchpad) wrote : Introduction of semantic versioning support breaks devstack if repository contains free-format tags

I started noticing yesterday (2014-08-14) that my previously working devstack environment was not able to start up nova-api any more. nova-api could not start with the following error message:

stack.sh failed with the following error message:
[ERROR] /home/ebenrom/src/github.com/openstack-dev/devstack/lib/nova:610 nova-api did not start

While nova-api itself failed to start with the error message:

$ cd /opt/stack/nova && /usr/local/bin/nova-api & echo $! >/opt/stack/status/stack/n-api.pid; fg || echo "n-api failed to start" | tee "/opt/stack/status/stack/n-api.failure"
[1] 20962
cd /opt/stack/nova && /usr/local/bin/nova-api
Traceback (most recent call last):
  File "/usr/local/bin/nova-api", line 10, in <module>
    sys.exit(main())
  File "/opt/stack/nova/nova/cmd/api.py", line 40, in main
    config.parse_args(sys.argv)
  File "/opt/stack/nova/nova/config.py", line 36, in parse_args
    version=version.version_string(),
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 433, in version_string
    return self.semantic_version().brief_string()
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 428, in semantic_version
    self._semantic = self._get_version_from_pkg_resources()
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 416, in _get_version_from_pkg_resources
    return SemanticVersion.from_pip_string(result_string)
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 155, in from_pip_string
    major = int(components[0])
ValueError: invalid literal for int() with base 10: 'cee-trunkport'
n-api failed to start

After some investigation I believe pbr generates python package version numbers based on git tags (probably based on something like git describe). And my nova repository actually contains tags like 'cee/trunkport-rc2'. (Which may not be a good version number, but that's not my point here.)

I am using the following version of pbr:

$ pip freeze | grep -w pbr
pbr==0.10.0.6.g07fe2e0

Now I have found a commit which is the likely cause of the changed behavior:

https://github.com/openstack-dev/pbr/commit/5957364887da51d1133370b82d1d7d137ce85631

Which aims to implement the 'pbr-semver' blueprint:

http://git.openstack.org/cgit/openstack/oslo-specs/plain/specs/juno/pbr-semver.rst

So my question is: Is this behavior a feature or a bug?

I understand that the blueprint aims at using version numbers compatible with semantic versioning. On the other hand it practically forces everybody in the world having a clone of the nova repository (or actually any repository using pbr) to use git tags compatible with semantic versioning. And prohibits people using free-format tags. Those clones may have local modifications, they may have local, company standard rules of tagging, etc. So I'm not sure if it's a good idea to break when pbr encounters a tag name which is not a valid version number according to the semantic version spec.

What do you think?