[Openstack] [oslo] Issues with pbr when building custom packages

Sam Morrison sorrison at gmail.com
Thu Jun 9 00:15:38 UTC 2016


> On 9 Jun 2016, at 10:06 AM, Doug Hellmann <doug at doughellmann.com> wrote:
> 
> Excerpts from Sam Morrison's message of 2016-06-09 08:16:11 +1000:
>> 
>>> On 8 Jun 2016, at 10:51 PM, Doug Hellmann <doug at doughellmann.com> wrote:
>>> 
>>> Excerpts from Sam Morrison's message of 2016-06-08 16:59:37 +1000:
>>>> We have been building our own packages for a few years now and I’ve just started to build packages for liberty.
>>>> 
>>>> I got an error from pbr telling me my version was incompatible. An example version we were producing was 12.0.3+a74~gea340da+trusty
>>>> 
>>>> So had a read of http://docs.openstack.org/developer/pbr/semver.html <http://docs.openstack.org/developer/pbr/semver.html> and have fixed it to be this format however I’m still getting an error:
>>>> 
>>>> Exception occurred:
>>>> File "/usr/lib/python2.7/dist-packages/pbr/version.py", line 215, in from_pip_string
>>>>   % (remainder, version_string))
>>>> ValueError: Unknown remainder ['gea340da'] in '12.0.3.a74.gea340da'
>>>> 
>>>> From the website mentioned above this seems like it should be valid. I’ve had a look in the code and it looks like this type of version isn’t supported.
>>>> 
>>>> So is this a bug in pbr or am I doing something wrong? We build packages based on git versions so I want to keep the hash in there.
>>>> 
>>>> Thanks,
>>>> Sam
>>> 
>>> This is working as designed. pbr follows PEP-440 [1] versioning,
>>> which IIRC doesn't include version control references like git SHAs.
>>> 
>>> The version you describe appears to be the 74th alpha pre-release of
>>> 12.0.3. Is that what you intend? That's a lot of pre-releases.
>>> 
>>> pbr will automatically append a numbered dev suffix to versions,
>>> so the 74th commit after 12.0.3 would be something like 12.0.4.dev74,
>>> indicating that it is a development version leading to 12.0.4.
>>> 
>>> Which project are you packaging, and in what context?
>> 
>> Thanks Doug,
>> 
>> So is that openstack document wrong?
> 
>> I'm packaging nova, we have a bunch of custom commits and extra back ports in our version. Having the git hash in there is extremely helpful and I also don't want to conflict with the official openstack release. 
>> I don't care really what the version number is as long as when I add a new commit the version number increases. 
>> 
>> Having a look at that document I think I should do something like 
>> 
>> 12.0.3.post74+gea340da
> 
> According to the comments in pbr/version.py it looks like you want
> 
>  12.0.3.74.gea340da

OK great, yes that works, although that looks like it is invalid according to PEP440?

From my understanding of that PEP I should do 12.0.3.post74+gea340da no?

> I've added a patch with a test that shows that works, as well as a fix
> for the syntax including the "post" in https://review.openstack.org/327424
> 
> If you're doing your own packaging, how are you feeding the version
> number into pbr? Via the environment variable?
> 

We’re building it based on the output of `git describe`

We use 

GIT_DESCRIBE_VERSION_REGEX = re.compile(
    r"""
    ^v?(?P<major>\d+)\.
    (?P<minor>\d+)
    (?:\.(?P<patch>\d+(\.\d+){0,1})){0,1}
    (?:-(?P<commits>\d+)
    -g(?P<revision>[0-9a-f]+)){0,1}$""",
    re.VERBOSE)


We should also update http://docs.openstack.org/developer/pbr/semver.html  as that isn’t correct.

Thanks for your help.

Cheer,
Sam




> Doug
> 
>> 
>> Any ideas? 
>> 
>> Thanks,
>> Sam
>> 
>>> 
>>> Doug
>>> 
>>> [1] https://www.python.org/dev/peps/pep-0440/
>>> 
>>> _______________________________________________
>>> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>> Post to     : openstack at lists.openstack.org
>>> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack





More information about the Openstack mailing list