classification
Title: bdist_rpm should use rpmbuild, not rpm
Type: Stage: patch review
Components: Distutils Versions: Python 3.4, Python 3.3, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: merwok Nosy List: James.Bennet, eric.smith, merwok, petere, purpleidea, tarek, westley.martinez
Priority: normal Keywords: easy, patch

Created on 2011-02-04 21:19 by purpleidea, last changed 2014-03-14 20:15 by petere.

Files
File name Uploaded Description Edit
fix-rpm-use-2.7.diff merwok, 2014-03-13 22:22
Messages (17)
msg127942 - (view) Author: James (purpleidea) Date: 2011-02-04 21:19
Hi distutils,

When I run:

./setup.py bdist --formats=rpm

on my source directory, I get the error:

rpm -ba --define _topdir /home/james/code/scantran/build/bdist.linux-x86_64/rpm --clean build/bdist.linux-x86_64/rpm/SPECS/scantran.spec
-ba: unknown option
error: command 'rpm' failed with exit status 1

It seems the problem can be fixed by installing the rpm-build package (on fedora 14 anyways) and so perhaps something should be done so that this is more obvious...

HTH,
James
msg127943 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-04 21:23
Does this mean that there is one rpm command that does not have all options, and that rpm-build overwrites that command with another one that does the right thing?
msg127944 - (view) Author: James (purpleidea) Date: 2011-02-04 21:32
In the source for distutils it seems to attempt to use 'rpmbuild' if it exists, but otherwise falls back on regular 'rpm', however in my rpm:

$ rpm --version
RPM version 4.8.1

this fails as there is no -ba option.

James
msg127945 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-04 21:37
What is your OS name and version?  Is that rpm version considered obsolete or not?
msg127948 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2011-02-04 22:45
"rpm -ba" is very old. I think it's been at least since 2002 that "-ba" was supported by rpm.

I believe bdist_rpm is calling "rpmbuild -ba", and if that doesn't exist, then "rpm -ba" is a transition strategy until all systems supported "rpmbuild". This transition period should be over. Unfortunately today it's far more likely that "rpm -ba" will not be what you want to call, but "rpm" will almost always be found, giving this error.

Most systems (certain RedHat based) ship rpmbuild as a separate command. RedHat installs it via the rpm-build package.

I'd suggest just switching bdist_rpm to always use rpmbuild. Then at least the error would be that rpmbuild isn't found.
msg127958 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-05 01:01
This is a gray area between bugfix and bahavior change forbidden by the feature freeze.  Would it be okay for you to add a note in the docs and close this report?
msg127959 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-05 01:02
> Would it be okay for you to add a note in the docs and close this report?

I meant to ask whether you would agree with that outcome, not that you should do the work (you’re welcome to provide a patch if you want to, but that’s not required).
msg128005 - (view) Author: James (purpleidea) Date: 2011-02-05 17:41
I'll write a docs and script patch for this next week...

I'm happy to do the work,

Thanks for the comments.

James
msg128052 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-06 12:02
Thanks for volunteering.  I will review and apply when the py3k branch is unfrozen.

> I'll write a docs and script patch for this next week...
Note that I proposed to patch the docs only.
msg128053 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2011-02-06 12:05
BTW, it may be useful to point people to http://pypi.python.org/pypi/pypi2rpm, which contains an updated command, bdist_rpm2.
msg153098 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2012-02-11 05:25
Given that we’ve made changes to distutils for Debian multiarch or Mac OS X compiler breakage, I now think that switching distutils to only use rpmbuild would be reasonable.
msg155120 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2012-03-07 20:54
More info on rpm vs. rpmbuild: http://bugs.python.org/issue1533164#msg82592
msg175042 - (view) Author: Peter Eisentraut (petere) * Date: 2012-11-07 04:50
I ran into a similar instance of this problem today and would like to add my support for just getting rid of the "rpm" calls and just call "rpmbuild" in all cases.  The last release where "rpm" was used for building was more than 10 years ago.
msg177241 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2012-12-09 22:02
I agree on just switching to rpmbuild, at least for 3.4.
msg193105 - (view) Author: James Bennet (James.Bennet) Date: 2013-07-15 14:28
I have observed this bug under CentOS 5.9 using the version of python-setuptools from the official CentOS repository. -ba is not a valid option for that version of RPM. I am able to get further by installing the rpm-build package.
msg213484 - (view) Author: Éric Araujo (merwok) * (Python committer) Date: 2014-03-13 22:22
Can someone test the attached patch for 2.7?  I don’t know if the second use (rpm -q --qf etc) should be converted too.
msg213588 - (view) Author: Peter Eisentraut (petere) * Date: 2014-03-14 20:15
No, the second use should not be converted.
History
Date User Action Args
2014-03-14 20:15:50peteresetmessages: + msg213588
2014-03-13 22:22:17merwoksetfiles: + fix-rpm-use-2.7.diff
versions: + Python 3.4, - Python 3.2
messages: + msg213484

keywords: + patch
stage: needs patch -> patch review
2014-02-26 20:37:32westley.martinezsetnosy: + westley.martinez
2013-07-15 14:28:44James.Bennetsetnosy: + James.Bennet
messages: + msg193105
2012-12-09 22:02:45eric.smithsetmessages: + msg177241
2012-11-07 04:50:19peteresetnosy: + petere
messages: + msg175042
2012-03-07 20:55:03merwoksettitle: bdist_rpm fails -> bdist_rpm should use rpmbuild, not rpm
2012-03-07 20:54:46merwoksetkeywords: + easy

messages: + msg155120
stage: needs patch
2012-02-11 05:25:58merwoksetmessages: + msg153098
versions: - Python 3.1
2011-02-06 12:05:29merwoksetnosy: eric.smith, tarek, merwok, purpleidea
messages: + msg128053
2011-02-06 12:02:01merwoksetassignee: tarek -> merwok
messages: + msg128052
nosy: eric.smith, tarek, merwok, purpleidea
2011-02-05 17:41:12purpleideasetnosy: eric.smith, tarek, merwok, purpleidea
messages: + msg128005
2011-02-05 01:02:30merwoksetnosy: eric.smith, tarek, merwok, purpleidea
messages: + msg127959
2011-02-05 01:01:18merwoksetnosy: eric.smith, tarek, merwok, purpleidea
messages: + msg127958
versions: + Python 3.1, Python 3.2, Python 3.3
2011-02-04 22:45:24eric.smithsetnosy: + eric.smith
messages: + msg127948
2011-02-04 21:37:33merwoksetnosy: tarek, merwok, purpleidea
messages: + msg127945
2011-02-04 21:32:13purpleideasetnosy: tarek, merwok, purpleidea
messages: + msg127944
2011-02-04 21:23:41merwoksetnosy: tarek, merwok, purpleidea
messages: + msg127943
2011-02-04 21:19:22purpleideacreate