[openstack-dev] How do I calculate the semantic version prior to a release?

Robert Collins robertc at robertcollins.net
Fri Feb 26 19:01:54 UTC 2016


On 27 February 2016 at 00:52, Doug Hellmann <doug at doughellmann.com> wrote:
> Excerpts from Neil Jerram's message of 2016-02-26 11:27:05 +0000:
>> On 26/02/16 11:16, Neil Jerram wrote:
>> > I understand the semantic versioning algorithm for calculating a new
>> > version.  But what do I run, in a git repository, to do that calculation
>> > for me, and output:
>> >
>> > - the new semantic version that would be used if I asked for a formal
>> > release to PyPI
>> >
>> > - the corresponding Debian version
>> >
>> > - the corresponding RPM version.
>> >
>> > Thanks,
>> >     Neil
>>
>> The following seems to work, but is it the best way?
>>
>> from pbr import version
>>
>> v = version.VersionInfo('networking-calico').semantic_version()
>> print v.release_string()
>> print v.brief_string()
>> print v.debian_string()
>> print v.rpm_string()
>
> Those do work. I found that there's also an rpm_version command
> available like this:
>
>   python setup.py rpm_version
>
> I don't see a similar command for getting the deb version.
>
> I threw together https://review.openstack.org/#/c/285250/ with some
> additions to pbr's "info" command to expose these formats.

I'll review in detail on gerrit, but we probably want an option to get
a *released* versions of debian and rpm versions too - not just the
current version - thats basically
v= SemanticVersion(orig_v.brief_string())
v.debian_string()
v.rpm_string()

-Rob




-- 
Robert Collins <rbtcollins at hpe.com>
Distinguished Technologist
HP Converged Cloud



More information about the OpenStack-dev mailing list