classification
Title: bdist_rpm fails due to wrong hardcoded assumption about RPM filename format
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.6, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dpward, dstufft, eric.araujo, steve.dower
Priority: normal Keywords: patch

Created on 2015-09-20 02:12 by dpward, last changed 2021-02-03 18:26 by steve.dower. This issue is now closed.

Files
File name Uploaded Description Edit
python-bdist_rpm-evaluate-_rpmfilename.patch dpward, 2015-09-20 02:12 Patch for bdist_rpm to evaluate %{_rpmfilename} review
python-bdist_rpm-evaluate-_rpmfilename.patch dpward, 2016-04-11 16:13 Patch for bdist_rpm to evaluate %{_rpmfilename} (revision 2) review
python-bdist_rpm-evaluate-_rpmfilename.patch dpward, 2016-04-12 00:59 Patch for bdist_rpm to evaluate %{_rpmfilename} (revision 3) review
Messages (5)
msg251136 - (view) Author: David Ward (dpward) * Date: 2015-09-20 02:12
bdist_rpm wrongly assumes a hard-coded format for the filename of the non-source RPM which is generated when it calls rpmbuild, specifically:
"%{arch}/%{name}-%{version}-%{release}.%{arch}.rpm"

The format used by rpmbuild is actually specified by the RPM macro %{_rpmfilename}. With the /usr/lib/rpm/macros file that is shipped with official releases of RPM (at http://rpm.org), %{_rpmfilename} evaluates to the value above. However this value cannot be assumed: the directory "%{arch}/" is dropped under the Mock chroot environment (https://fedoraproject.org/wiki/Mock). Mock is used to build all official Fedora Project packages (by Koji) as well as unofficial packages (by Copr). These two build systems also target Extra Packages for Enterprise Linux (EPEL) in addition to Fedora releases.

As a result, bdist_rpm fails when trying to move the non-source RPM to the 'dist' folder after it is built by rpmbuild.

The attached patch causes bdist_rpm to evaluate "%{_rpmfilename}" instead of relying on the hard-coded value.
msg263162 - (view) Author: David Ward (dpward) * Date: 2016-04-11 03:34
Ping to review patch please...
msg263188 - (view) Author: David Ward (dpward) * Date: 2016-04-11 16:13
Please review this revised patch. Thank you.
msg263214 - (view) Author: David Ward (dpward) * Date: 2016-04-12 00:59
Thanks again for your feedback. I revised this patch as requested to conform to changes also being made in issue 25627. Please review this new patch.

I tested this successfully under both Python 3.4.3 and Python 2.7.11 on Fedora 23. Note that "import subprocess" must additionally be added to this file for Python 2.7, after applying this patch and/or the one in issue 25627. (I also tested this successfully with the latest patch from both issues applied at the same time.)
msg386374 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:26
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:26:17steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386374

resolution: out of date
stage: resolved
2016-04-12 00:59:07dpwardsetfiles: + python-bdist_rpm-evaluate-_rpmfilename.patch

messages: + msg263214
2016-04-11 16:13:24dpwardsetfiles: + python-bdist_rpm-evaluate-_rpmfilename.patch

messages: + msg263188
2016-04-11 03:34:05dpwardsetmessages: + msg263162
2015-09-20 02:12:35dpwardcreate