PBR

OSLO_PACKAGE_VERSION affects pbr's own egg version

Bug #1256138 reported by Kieran Spear
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
PBR
Triaged
Low
Unassigned

Bug Description

We build packages with OSLO_PACKAGE_VERSION set in the environment. Not sure if this is a recent change, but now when pbr is automatically installed via setuptools when "python setup.py x" is run in a dependent package, it takes it's own version from that environment variable.

This causes the version check on the dependent package to fail because the version is wrong:

Installed /home/kspear/packaging/havana/swift/pbr-1.10.0.a3_g2e0ebfb_3-py2.7.egg
Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    pbr=True)
  File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 221, in __init__
    self.fetch_build_eggs(attrs.pop('setup_requires'))
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 245, in fetch_build_eggs
    parse_requirements(requires), installer=self.fetch_build_egg
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 594, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pbr>=0.5.21,<1.0

Revision history for this message
Monty Taylor (mordred) wrote :

This is the most exciting bug I've ever gotten.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

It sounds like this can be worked around by installing pbr directly before packaging something else, but we should still fix this.

I see in pbr/packaging.py the function get_version() looks at the environment variables PBR_VERSION and OSLO_PACKAGE_VERSION without regard for the package_name being checked. I suppose we should check for package_name == 'pbr' and skip that step, or check yet another variable first in that case.

Changed in pbr:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

I have the issue with the python-gear package. Thomas "zigo" Goirand converted it to be more in line with the other OpenStack packages.

Source repo: git.debian.org/git/python-modules/packages/python-gear.git

Abstract from a build with Debian/sid and a fresh cowbuilder env:

***********************
dpkg-buildpackage: source package python-gear
dpkg-buildpackage: source version 0.5.7-1

dpkg-checkbuilddeps: Unmet build dependencies: python-all python-pbr
dpkg-checkbuilddeps: Unmet build dependencies: python-all python-pbr

dh clean --with python2,python3
   dh_testdir
   dh_auto_clean
pyversions: missing X(S)-Python-Version in control file, fall back to debian/pyversions
pyversions: missing debian/pyversions file, fall back to supported versions
        python setup.py clean -a

Installed /home/hashar/projects/debian/build-area/python-gear-0.5.7/pbr-0.5.7-py2.7.egg
running clean

***********************

debian/rules has

  UPSTREAM_GIT = git://github.com/openstack-infra/gear.git
  export OSLO_PACKAGE_VERSION=$(VERSION)

If I drop the OSLO_PACKAGE_VERSION, pbr.packaging yields:

 Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?

I am not familiar at all with the openstack-package-tool though.

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

Apparently the PBR version can be overridden. https://bugs.launchpad.net/pbr/+bug/1379579/comments/4 mentions:

   PBR_VERSION=X.Y.Z python setup.py build

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

I have poked Thomas Goirand by email since he overhauled the python-gear package.

Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

Hi,

Using OSLO_PACKAGE_VERSION is, as much as I understand, the same as using PBR_VERSION.

Thomas

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

Other bug subscribers

Remote bug watches

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