4

I am building rpm on RHEL-6/64 bit server.

    # rpmbuild -bb extras/rpm/neatx.spec

    RPM build errors:
        File not found by glob: /root/rpmbuild/BUILDROOT/neatx-0.1-1.el6.x86_64/usr/lib/python2.6/site-packages/neatx/*

I do see the same files under /root/rpmbuild/BUILDROOT/neatx-0.1-1.el6.x86_64/usr/lib/python2.7/site-packages directory.

    # ls -l /root/rpmbuild/BUILDROOT/neatx-0.1-1.el6.x86_64/usr/lib/    
    drwxr-xr-x 3 root bin 4096 Apr 19 14:45 python2.7

    # ls -l  /root/rpmbuild/BUILDROOT/neatx-0.1-1.el6.x86_64/usr/lib/python2.7/site-packages
    drwxr-xr-x 3 root bin 4096 Apr 19 14:45 neatx

These are python related entries in neatx.spec file.

    # grep -i python   extras/rpm/neatx.spec
    %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
    
    BuildRequires: python-devel
    
    BuildRequires: python-docutils
    
    Requires: python >= 2.4
    
    Requires: python-simplejson
    
    %python_sitelib/%{name}/*

Will appreciate your help/suggestions for fixing this issue.

Thanks in advance. -Shashi Divekar

user1149518
  • 101
  • 6
  • 13
  • 1
    It looks like you have both python `2.6` and python `2.7` on your machine. Somehow the build system sees the `2.7` one, but the `spec` file is claiming `2.6`. I don't know offhand how to fix that tho, sorry. – Aaron D. Marasco Apr 20 '14 at 01:06
  • 1
    Aaron, Thanks. Yes, I have both python 2.6 and python 2.7. One is under /usr/local/bin and other is under /usr/bin. The default PATH is using python 2.7. I changed the PATH and made it to see python 2.6 first. After doing that "rpmbuild -bb extras/rpm/neatx.spec" worked fine. Will like to know how to make rpmbuild work using python 2.7. Thanks again! – user1149518 Apr 20 '14 at 01:32
  • You would have to package your 2.7 copy as a special RPM and then require that. Using non-system `python` is non-trivial and not for the faint of heart... – Aaron D. Marasco Apr 20 '14 at 11:31
  • Possible duplicate of [Distributing a python package along with module dependencies using RPM](https://stackoverflow.com/questions/18109409/distributing-a-python-package-along-with-module-dependencies-using-rpm) – Paul Sweatte Jun 14 '17 at 03:00

1 Answers1

1

The Command rpmbuild produces an Error because you are required to give a List of installed Files in your .spec File at:

%files
%defattr(-,root,root,-)
%python_sitelib/%{name}/*

And the Path %python_sitelib is resolved into

/usr/lib/python2.6/site-packages

But in the %install Section of your .spec the Files have been placed into another Directory which is:

/usr/lib/python2.7/site-packages

You should use in your %install Section also the same Macro %python_sitelib as in the %files Section.