Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#9616 closed (wontfix)

bdist_rpm fails in 1.0.1 - version names with hyphens are not compatible with rpm specs

Reported by: Tome Cvitan Owned by: Malcolm Tredinnick
Component: Uncategorized Version: 1.0
Severity: Keywords: rpm, bdist_rpm, setup
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The rpm spec does not allow for version names with hyphens. When running setup.py bdist_rpm the setuptools modify the 1.0.1-final version in setup.py to 1.0.1_final in the specs file. This leads to the script searching for a non existing file when trying to run rpmbuild.

The workaround is to change setup.py to replace spaces in the version string with underscore instead of hyphen, or just '1.0.1', but that is hardly a permanent solution.

Change History (12)

comment:1 Changed 8 years ago by robinbowes

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

I created #9630 before seeing this!

I ran into the same problem, and came up with the same fix.

comment:2 Changed 8 years ago by James Bennett

If distutils can't remember the name of the file it just generated, then in my book that's a bug in distutils.

comment:3 in reply to:  2 Changed 8 years ago by greno

Replying to ubernostrum:

If distutils can't remember the name of the file it just generated, then in my book that's a bug in distutils.

It's not a bug in distutils. It has nothing to do with remembering anything, it is an RPM spec requirement. You cannot have hyphens in the version string or 'bdist_rpm' will fail.

comment:4 Changed 8 years ago by greno

For RPM spec, in addition to underscore you can also use a period as a separator in the version string.

comment:5 Changed 8 years ago by James Bennett

In that case...

Since AFAIK none of the RPM-based distros use bdist_rpm to build their packages anyway (or I'd have heard about this sooner), and since "fixing" this to work around RPM's limitations would require changing something that needs to stay stable across releases (viz., the format of the version string), I'm going to wontfix this.

comment:6 Changed 8 years ago by Malcolm Tredinnick

Owner: changed from nobody to Malcolm Tredinnick
Status: newassigned

So, a key factor in this ticket is the Python version involved, which hasn't been mentioned. Over the years, bdist_rpm has been made more and more robust as people have used it, making it operate in line with rpm's requirements, whilst still accepting normal-looking input (for example, versions containing hyphens, which are pretty common in practice).

Thus, python 2.5 has no problems with Django's version string, since it puts both version_info (with hyphens replaced by underscores) and unmangled_version_info (the original string, used to construct the Source0 line in the spec file). Python 2.4 and earlier didn't do this. So I'd have to guess that the two people seeing this problem are using earlier versions of Python.

I'll have a think about whether there's something we can do for those versions when bdist_rpm is running, since I'd like this to work. Restricting our version strings just to avoid this one particular, relative edge-case (building rpms on older versions of Python) isn't a solution, but we might be able to do something in setup.py.

comment:7 Changed 8 years ago by greno

I do not think this is an edge-case. I see this problem crop up from time to time especially when applications put out release candidates and name the version string like '1.0.1-rc1'. I've had 'bdist_rpm' fail even on python 2.5 with such strings.

Also, the reason that some distros don't use 'bdist_rpm' is because the packagers don't understand python or distutils or just plain want to muck around with a lot of things that they really don't understand. 'bdist_rpm' is what they should be using to build packages.

comment:8 Changed 8 years ago by greno

Just a tip:
Make sure you don't have any .rpmmacros files in effect when running 'bdist_rpm' target. These can interfere with the RPM build in distutils and cause the build to fail.

comment:9 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:10 Changed 7 years ago by Jacob

milestone: 1.11.2

Kicking out of 1.1 since this is a bug in old versions of bdist_rpm. It's something we should be able to work around, but let's not have it block 1.1.

comment:11 Changed 7 years ago by James Bennett

Resolution: wontfix
Status: assignedclosed

I'm going to make a release-manager pronouncement here and say we're not going to fix this. Changing our version info to work around one specific packaging system's limitations, especially when those limitations only exist in older versions of Python that we'll be deprecating anyway, is not a productive use of our time; people who are interested in using bdist_rpm to build Django packages can correct this manually as needed.

comment:12 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top