PBR

PEP-440 local versions not accepted

Bug #1452515 reported by Jay Lee on 2015-05-07
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
PBR
Wishlist
Greg Hellings

Bug Description

From 0.11.0 release, It can't parse version when build metadata is exist.

for example, our python-keystoneclient test branch has a tag "1.3.0+test2.0.dev479".

python-keystoneclient has a code to verify package version below.(every other openstack projects has this code)

__version__ = pbr.version.VersionInfo('python-keystoneclient').version_string()

This code cause below error, so every openstack project can't start.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pbr/version.py", line 457, in version_string
    return self.semantic_version().brief_string()
  File "pbr/version.py", line 452, in semantic_version
    self._semantic = self._get_version_from_pkg_resources()
  File "pbr/version.py", line 440, in _get_version_from_pkg_resources
    return SemanticVersion.from_pip_string(result_string)
  File "pbr/version.py", line 203, in from_pip_string
    prerelease_type, prerelease = _parse_type(remainder[0])
  File "pbr/version.py", line 181, in _parse_type
    return prerelease_type, int(prerelease)
ValueError: invalid literal for int() with base 10: ''

I think our tag is compliant with Linux/Python Compatible Semantic Versioning 3.0.0.
(http://docs.openstack.org/developer/pbr/semver.html)
In Semver no.12, It describe about build metadata and pbr can't parse version when tag contain build metadata.

Jay Lee (hyangii) on 2015-05-13
description: updated
Robert Collins (lifeless) wrote :

That is a PEP-440 compliant version, but we haven't developed or tested using those with pbr.

I think this is something moderately important to fix - but we need to design out the interactions with this with version calculation - e.g. 'none, we accept it but any change discards it', and we need to consider this with the context of vendor versions too (which + might be used for). Sorry!

Your version number is perhaps not what you think it is though:

>>> from packaging import version
>>> version.parse('1.3.0+test2.0.dev479').local
'test2.0.dev479'

I think you want 1.3.0.dev479+test2.0

Changed in pbr:
status: New → Triaged
importance: Undecided → High
status: Triaged → Confirmed
summary: - 0.11.0 doesn't support a bulid metadata.
+ PEP-440 local versions not accepted

Fix proposed to branch: master
Review: https://review.openstack.org/190818

Changed in pbr:
assignee: nobody → Kevin L. Mitchell (klmitch)
status: Confirmed → In Progress
Changed in pbr:
assignee: Kevin L. Mitchell (klmitch) → Greg Hellings (greg-hellings)
Greg Hellings (greg-hellings) wrote :

Counter-proposed changes:

https://review.openstack.org/#/c/192842/

--Greg

Robert Collins (lifeless) wrote :

I'm very glad that folk want to fix this. Please propose a spec to oslo-specs on this though - as I said, we need to do the design work before the code on this one.

David Moreau Simard (dmsimard) wrote :

FWIW we just got bit by this in RDO packaging where pbr was replacing a "+" for a "-": https://bugzilla.redhat.com/show_bug.cgi?id=1281920

Changed in pbr:
importance: High → Wishlist
status: In Progress → Triaged
Wes Turner (wes-turner) wrote :

Given tests, there could be examples of these versions in the #examples block for https://bugs.launchpad.net/pbr/+bug/1629199

- https://github.com/openstack-dev/pbr/pull/14/files

Change abandoned by ChangBo Guo(gcb) (<email address hidden>) on branch: master
Review: https://review.openstack.org/192842
Reason: please restore this if you want to continue working on this.

Change abandoned by ChangBo Guo(gcb) (<email address hidden>) on branch: master
Review: https://review.openstack.org/190818
Reason: please restore this if you want to continue working on this.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.