Bug 99055 - rpm rpm build fails when PYTHONPATH is set
rpm rpm build fails when PYTHONPATH is set
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: rpm-build (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-07-13 06:33 EDT by David Nečas
Modified: 2007-04-18 12:55 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-29 14:47:13 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Nečas 2003-07-13 06:33:28 EDT
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 07:41:48 EDT
python/rpmlib/Makefile.am has the same problem. (Sorry, I forgot to mention it
in the report.)
Comment 2 Paul Nasrat 2005-11-29 14:47:13 EST
In current rawhide:

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

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