[Bug 2118836] Re: blocked migration due to wrong version parsing by python-pbr

Pragyansh Chaturvedi 2118836 at bugs.launchpad.net
Mon Jul 28 21:59:18 UTC 2025


However, python-pbr should never end up in that code branch as the
PBR_VERSION is passed to it as an env var as part of the autopkgtests.
What needs to be checked is why that version is not being chosen.

in pbr/packaging.py, line 832:

```
def get_version(package_name, pre_version=None):
    """Get the version of the project.

    First, try getting it from PKG-INFO or METADATA, if it exists. If it does,
    that means we're in a distribution tarball or that install has happened.
    Otherwise, if there is no PKG-INFO or METADATA file, pull the version
    from git.

    We do not support setup.py version sanity in git archive tarballs, nor do
    we support packagers directly sucking our git repo into theirs. We expect
    that a source tarball be made from our git repo - or that if someone wants
    to make a source tarball from a fork of our repo with additional tags in it
    that they understand and desire the results of doing that.

    :param pre_version: The version field from setup.cfg - if set then this
        version will be the next release.
    """
    version = os.environ.get(
        "PBR_VERSION",
        os.environ.get("OSLO_PACKAGE_VERSION", None))
    if version:
        return version
    version = _get_version_from_pkg_metadata(package_name)
    if version:
        return version
    version = _get_version_from_git(pre_version)
    # Handle http://bugs.python.org/issue11638
    # version will either be an empty unicode string or a valid
    # unicode version string, but either way it's unicode and needs to
    # be encoded.
    if sys.version_info[0] == 2:
        version = version.encode('utf-8')
    if version:
        return version
    raise Exception("Versioning for this project requires either an sdist"
                    " tarball, or access to an upstream git repository."
                    " It's also possible that there is a mismatch between"
                    " the package name in setup.cfg and the argument given"
                    " to pbr.version.VersionInfo. Project name {name} was"
                    " given, but was not able to be found.".format(
                        name=package_name))
```

** Bug watch added: Python Roundup #11638
   http://bugs.python.org/issue11638

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-octaviaclient in Ubuntu.
https://bugs.launchpad.net/bugs/2118836

Title:
  blocked migration due to wrong version parsing by python-pbr

Status in python-octaviaclient package in Ubuntu:
  New

Bug description:
  python-octaviaclient is unable to migrate as it causes autopkgtest
  failure in rally-openstack:
  https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842/autopkgtest-
  questing/questing/amd64/r/rally-
  openstack/20250726_173836_62e93@/log.gz

  It looks like python-pbr does not account for `+git.*` or `+dfsg.*` in
  the version strings, which causes this.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-octaviaclient/+bug/2118836/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list