Bug 1577860 - /usr/bin/python: can't open file '/usr/lib/rpm/python-macro-helper': [Errno 2] No such file or directory
Summary: /usr/bin/python: can't open file '/usr/lib/rpm/python-macro-helper': [Errno 2...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1651926
TreeView+ depends on / blocked
 
Reported: 2018-05-14 09:50 UTC by Kamil Páral
Modified: 2018-11-21 08:35 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
: 1651926 (view as bug list)
Environment:
Last Closed: 2018-08-13 12:41:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1535692 0 unspecified CLOSED Missing python-macro-helper file 2021-02-22 00:41:40 UTC

Internal Links: 1535692

Description Kamil Páral 2018-05-14 09:50:39 UTC
Description of problem:

An error file is printed on every rpmlint invocation, like this:

# rpmlint ./htop-2.1.0-1.fc28.x86_64.rpm 
/usr/bin/python: can't open file '/usr/lib/rpm/python-macro-helper': [Errno 2] No such file or directory
htop.x86_64: W: only-non-binary-in-usr-lib
htop.x86_64: E: incorrect-fsf-address /usr/share/licenses/htop/COPYING
1 packages and 0 specfiles checked; 1 errors, 1 warnings.

This is only happening if rpm-build is not installed (it contains the necessary file). However, rpm-build is not a dependency for rpmlint.

Either rpmlint should require rpm-build (at least as a Recommends), or it should not print the error when not installed.

Version-Release number of selected component (if applicable):
rpmlint-1.10-5.fc27.noarch
rpm-build-4.14.1-1.fc27.x86_64

How reproducible:
always

Comment 1 Miro Hrončok 2018-05-14 10:22:04 UTC
I've been noticing this as well (on taskotron mostly). Thanks for tracking this down.

Comment 2 Jason Tibbitts 2018-05-14 15:49:33 UTC
This output does not come from rpmlint, though.  It is output by rpm when it performs certain operations  Just try running

rpm -E '%python_sitelib'

The problem is that the stock rpm macro file has changed to define %python_sitelib, %python_sitearch and %python_version (which aren't even supposed to be used in Fedora these days) in terms of this python-macro-helper script.  I objected to making that change but it was pushed anyway.

rpmlint explicitly tries to expand various macros in TagsCheck.py, including %python_sitearch.  If you happened to not have perl-interpreter installed (which is not possible because it's a direct dependency) you would see similar messages about perl.  If the python{2,3}-rpm-macros was changed to also use python-macro-helper (which I'm surprised hasn't been done already) then you would see additional very similar failures.

Anyway, I don't really object to rpm-build being a soft dependency in any cass, though rpm-build does have a more significant dependency footprint.  Alternately, it is probably reasonable to work around this bug by redirecting stderr before calling rpm.expandMacro, or to simply say that the RPM Python bindings shouldn't be spewing to stderr and reassign this to the rpm package.

Comment 3 Petr Pisar 2018-07-04 10:31:48 UTC
When I removed perl from minimal build root, I noticed the error message and asked Panu to move the macros from rpm's macros file into perl's macro file. Though he insisted that he wants to keep them there. And here it is. I'm ready to adopt the Perl macros anytime.

Comment 4 Kamil Páral 2018-07-10 14:23:35 UTC
CC Panu to move this forward.

Comment 5 Panu Matilainen 2018-08-13 11:55:34 UTC
The simple fix is to move the python-macro-helper script to the main rpm package, that's where the macros are defined so that's where the script ought to be too.

Beyond that, yes the various language-specific macros in rpm are problematic in any number of ways. 

Petr, I have no recollection of such discussion, much less "insisting" anything regarding it. I found some perl macro related discussion from my mail email archives from 2012, if that's what you're referring to then from my POV the focus was something rather different, plus it's a BIT long in the tooth. Times are different, lots of things have changed and with the Python reorg even more things are about to change. If you're willing to deal with the possible fallout from removing the perl macros from main rpm package then I'm all for it, but please open another bug to deal with it.

Comment 6 Panu Matilainen 2018-08-13 11:56:31 UTC
Reassigning to rpm, this isn't rpmlint's headache.

Comment 7 Panu Matilainen 2018-08-13 12:41:43 UTC
The helper script moved to main rpm package in rpm-4.14.2-0.rc2.2.fc29

That of course only shifts the problem elsewhere (but see https://src.fedoraproject.org/rpms/rpm/pull-request/14)


Note You need to log in before you can comment on or make changes to this bug.