Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1937765

Summary: rpmbuild specifically excludes /usr/local/ from the python path
Product: Red Hat Enterprise Linux 8 Reporter: Pat Riehecky <riehecky>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED DUPLICATE QA Contact: swm-qe
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, carl, jwboyer, mhroncok, pmatilai
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-16 08:54:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pat Riehecky 2021-03-11 14:19:23 UTC
Description of problem:

When building RPMs for interdependent python modules, the exclusion of /usr/local/ from the PYTHONPATH is problematic.  

In my instance, my module also requires newer versions of some modules that are packaged already within EL8.  To avoid polluting my packages, I've installed my dependencies in /usr/local/ on my build host.

When I run the package self tests, it fails due to missing modules and incorrect dependency versions.

There doesn't appear to be a macro or a switch to disable the exclude.

Version-Release number of selected component (if applicable):rpm-4.14.3-4.el8.x86_64


How reproducible: 100%


Steps to Reproduce:
1. Install some package self-test dependencies into /usr/local/ via pip
2. rpmbuild the package
3.

Actual results:

The /usr/local/ python directories are not available to python within rpmbuild

Expected results:

A way to tell rpmbuild "I do actually want to use those in this build, please leave /usr/local/ in sys.path"

If this switch exists, I'm confident the doc to describe it is not in an obvious place....

Additional info:

I believe the existing behavior is a good default that should remain the default.

Comment 1 Panu Matilainen 2021-03-11 14:48:14 UTC
Mm, which part of the build process you're talking about, specifically? rpmbuild itself doesn't know anything about python or PYTHONPATH, these would be external helpers scattered over a few different packages, and I haven't kept up with all the details. Do you mean dependencies are not generated for things in /usr/local, or something else?

Comment 2 Pat Riehecky 2021-03-11 15:17:36 UTC
In my specific case, my packages runtime deps are all satisfied by RPMs in /usr/.  However, I've got a number of deps for the self tests (%check) that are not packaged in RPMs.  I don't need the selftest support in systems using the RPM package.  

I was chatting with Miro Hrončok who mentioned

> Note that /usr/local/... is not in sys.path when RPM_BUILD_ROOT is set.

In an ideal world, I'd package up all dozen or so of these and do everything through the package set, but alas the world is not ideal...

Comment 3 Pat Riehecky 2021-03-11 21:01:37 UTC
With https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe uncovered by a few helpful folks (thanks!)

I'd say I'm probably too far off in the weeds here for RPM as I'm really trying to live a bit in and a bit outside the RPMDB.

I'm comfortable closing this out as NOTABUG or WONTFIX.

Comment 4 Miro Hrončok 2021-03-16 09:00:48 UTC

*** This bug has been marked as a duplicate of bug 1937494 ***