Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 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 Owned by: mtredinnick
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.

Attachments (0)

Change History (12)

comment:1 Changed 5 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 follow-up: Changed 5 years ago by ubernostrum

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 5 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 5 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 5 years ago by ubernostrum

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 5 years ago by mtredinnick

  • Owner changed from nobody to mtredinnick
  • Status changed from new to assigned

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 5 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 5 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 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:10 Changed 5 years ago by jacob

  • milestone changed from 1.1 to 1.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 4 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from assigned to closed

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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.