Bug 562906

Summary: "/usr/lib/rpm/pythondeps.sh --requires" matches BUILDROOT/usr/lib/pythonMAJOR.MINOR directory, breaking rebuild of python
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: ffesti, jnovy, pmatilai
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: 2010-02-09 07:26:00 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 Dave Malcolm 2010-02-08 18:01:06 UTC
Description of problem:
I introduced a one-character error in my rewrite of /usr/lib/rpm/pythondeps.sh for bug 532118 (sorry), which first landed in rpm-4.8.0-4.fc13

This shows up in my build of python-2.6.4-14.fc13: the core python rpm gained a dep on "/builddir/build/BUILDROOT/python-2.6.4-14.fc13.i386/usr/lib/python2.6" (see http://koji.fedoraproject.org/koji/buildinfo?buildID=154675 and http://koji.fedoraproject.org/koji/rpminfo?rpmID=1803012 )

See pythondeps.sh script in https://bugzilla.redhat.com/attachment.cgi?id=366839

The --requires case in this script has this initial grep of the :
    grep "/usr/lib[^/]*/python.\../*" \

which then gets passed into a sed, which maps paths of the form /usr/lib[^/]*/python\(.\..\)/.* to python(abi)=\1

Unfortunately the grep matches slightly too much; it is matching the directory as well as the paths within it, and this directory is not getting changed within the sed, leading to the path within the BUILDROOT appearing in the reequires.

I believe the fix is to change the initial grep from:
    grep "/usr/lib[^/]*/python.\../*" \
to:
    grep "/usr/lib[^/]*/python.\../.*" \

(In my mind I was thinking of shell wildcard when I wrote that final "/*", but grep treats it as "zero or more slash characters")

Without this change, I get:
# find /root/rpmbuild/BUILDROOT/python-2.6.4-14.fc13.i386 | /usr/lib/rpm/pythondeps.sh --requires
python(abi) = 2.6
/root/rpmbuild/BUILDROOT/python-2.6.4-14.fc13.i386/usr/lib/debug/usr/lib/python2.6
/root/rpmbuild/BUILDROOT/python-2.6.4-14.fc13.i386/usr/lib/python2.6

With this change, I get:
# find /root/rpmbuild/BUILDROOT/python-2.6.4-14.fc13.i386 | /usr/lib/rpm/pythondeps.sh --requires
python(abi) = 2.6

Sorry about this.



Version-Release number of selected component (if applicable):
Seen with rpm-build-4.8.0-8.fc13.i686, but I'm fairly sure this is my fault, and due to:

* Sat Jan 30 2010 Panu Matilainen <pmatilai> - 4.8.0-4
- support parallel python versions in python dependency extractor (#532118)


How reproducible:
100%

Steps to Reproduce:
1. try to rebuild python in rawhide

Actual results:
rpm -qpR python-2.6.4-whatever has a requirement on BUILDROOT_PATH/usr/lib/python directory

Expected results:
Shouldn't have the dependency

Additional info:
I suspect it's possible to hack around this by setting %{__python_requires} in the python.spec file, but obviously that's a hack.  (However we're close to feature freeze, and I need to rebuild python)

Comment 1 Dave Malcolm 2010-02-08 18:20:22 UTC
Better test cases (echoing paths, rather than requiring a buildroot to do "find")

# echo /root/rpmbuild/BUILDROOT/python-2.6.4-14.fc13.i386/usr/lib/python2.6/foo.py \
  | /usr/lib/rpm/pythondeps.sh --requires
python(abi) = 2.6

(i.e. should contain "python(abi)=2.6")

whereas:
# echo /root/rpmbuild/BUILDROOT/python-2.6.4-14.fc13.i386/usr/lib/python2.6 \
  | /usr/lib/rpm/pythondeps.sh --requires

should be empty

Comment 2 Panu Matilainen 2010-02-09 07:26:00 UTC
Suggested fix applied in rpm-4.8.0-9.fc13.