Bug 99055

Summary: rpm rpm build fails when PYTHONPATH is set
Product: [Retired] Red Hat Linux Reporter: David Nečas <yeti>
Component: rpm-buildAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED RAWHIDE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-11-29 19:47:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Nečas 2003-07-13 10:33:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.10 (X11; Linux i686; U;) Gecko/20030314

Description of problem:
Less inscrutably: rebuild of rpm package of rpm (more precisely of rpm-python,
but the source package is simply `rpm') fails because it tries to install the
Python module according to PYTHONPATH (or PYTHONHOME, or maybe others).

This is because python/Makefile.am uses

  pylibdir = $(shell python -c 'import sys; print sys.path[1]')

to find where the python module should be installed. When the package is built
by someone who has PYTHONPATH set to his/her personal Python module tree, the
first path in PYTHONPATH becomes sys.path[1], and the module is not installed to
$RPM_BUILDROOT/lib/python..., but somewhere into the deep space, and the package
build fails.

Version-Release number of selected component (if applicable):
rpm-4.2-0.69

How reproducible:
Always

Steps to Reproduce:
1. export PYTHONPATH=$HOME
2. rpmbuild --rebuild rpm-4.2-0.69.src.rpm


Additional info:

There are several possible fixes:

1. unset all the PYTHON* environment variables in the spec file.  This works but
is ugly.

2a. use

  pylibdir = $(shell python -E -c 'import sys; print sys.path[1]')

in python/Makefile.am.  This however may break builds when one really wants to
install rpm somewhere to home.

2b. patch python/Makefile.in in the spec file to use the -E option. Normal
builds then use PYTHONPATH, PYTHONHOME, etc., but rpm package builds are not
affected by it.

Comment 1 David Nečas 2003-07-13 11:41:48 UTC
python/rpmlib/Makefile.am has the same problem. (Sorry, I forgot to mention it
in the report.)

Comment 2 Paul Nasrat 2005-11-29 19:47:13 UTC
In current rawhide:

pylibdir = ${prefix}/lib@MARK64@/python@WITH_PYTHON_VERSION@