Distutils, bdist_XXX, rpmbuild issues

Gerry Reno greno at verizon.net
Wed Jan 7 21:09:01 EST 2009


I've been trying to use the "built distribution" distutils commands such 
as bdist_rpm to create distro-specific packages for python applications 
but I'm running into some thorny issues specifically with pre-release 
versioning of source distributions and built distributions and how to 
get a "final" release to update these pre-release distributions.

For example:

We have an application, foo-5.0.0, and we want to put out some 
pre-release candidates for testing, so we set the version to "5.0.0_rc1" 
in setup.py.

We create the source distribution with:
$ python setup.py sdist
which creates a source archive, foo-5.0.0_rc1.tar.gz.

We extract this archive and 'cd' into the foo-5.0.0_rc1 directory and 
create a built distribution with:
$ python setup.py bdist_rpm
which creates source and binary RPMS in the form:  
foo-5.0.0_rc1-1.noarch.rpm.

So we think everything is fine.  Everyone installs and tests using the 
pre-release candidate and subsequent candidates but when you eventually 
get to the final release, foo-5.0.0, and build your final release RPMS, 
foo-5.0.0-1.noarch.rpm, you find that it will not update your last 
pre-release candidate RPM, foo-5.0.0_rcX-1.noarch.rpm because it is not 
"rpm newer".

So I've been working on this for a while but have not found a good way 
to do this by setting options in a setup.cfg file.  It seems like for 
RPM purposes we have to keep the version to "5.0.0" and set "release" to 
"0_rcX" for the pre-release candidates and this will work for RPM 
purposes but then "sdist" does not generate the correct tarball names 
for each pre-release candidate.  It always generates foo-5.0.0.tar.gz.

Has anyone managed to solve this issue or is distutils in need of some 
enhancement.  We need the "sdist" command to generate distinct 
pre-release candidate tarball names.  And we need the "bdist_XXX" 
commands to generate distro-specific package naming such that the 
pre-release candidate packages can be updated by the final release package.


Regards,
Gerry




More information about the Python-list mailing list