[packages/python] Prevent pyconfig.h conflicts on multiarch systems

jajcus jajcus at pld-linux.org
Tue Dec 1 18:49:06 CET 2015


commit 538a779a0e99cb53d7deb373f6b5ccbb991ecba7
Author: Jacek Konieczny <jajcus at jajcus.net>
Date:   Tue Dec 1 18:40:37 2015 +0100

    Prevent pyconfig.h conflicts on multiarch systems
    
    pyconfig.h is included in python-libs, as it is used on runtime.
    The problem is pyconfig.h contains some platform-specific code and
    it differs between platforms.
    
    python-libs-*.x86_64  would conflict with python-libs-*.i686 and if they
    are forced to coexist, wrong pyconfig.h may be used. This causes e.g.
    rpm build to fail in a non obvious way.
    
    The hack is to have architecture-specific pyconfig-*.h files and a ghost
    symlink updated with python-devel install. I hope this works.

 python.spec | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/python.spec b/python.spec
index fdd521b..bcb0542 100644
--- a/python.spec
+++ b/python.spec
@@ -44,7 +44,7 @@ Summary(tr.UTF-8):	X arayüzlü, yüksek düzeyli, kabuk yorumlayıcı dili
 Summary(uk.UTF-8):	Мова програмування дуже високого рівня з X-інтерфейсом
 Name:		python
 Version:	%{py_ver}.10
-Release:	5.2
+Release:	5.3
 Epoch:		1
 License:	PSF
 Group:		Development/Languages/Python
@@ -692,12 +692,21 @@ find $RPM_BUILD_ROOT%{py_libdir} -name \*.bat -exec rm {} \;
 find $RPM_BUILD_ROOT%{py_libdir} -name \*.txt -exec rm {} \;
 find $RPM_BUILD_ROOT%{py_libdir} -name README\* -exec rm {} \;
 
+mv $RPM_BUILD_ROOT%{py_incdir}/{pyconfig.h,pyconfig-%{_target_cpu}.h}
+ln -s pyconfig-%{_target_cpu}.h $RPM_BUILD_ROOT%{py_incdir}/pyconfig.h
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post	libs -p /sbin/ldconfig
+%post	libs
+/sbin/ldconfig || :
+[ -e %{py_incdir}/pyconfig.h ] || ln -s pyconfig-%{_target_cpu}.h %{py_incdir}/pyconfig.h || :
+
 %postun	libs -p /sbin/ldconfig
 
+%post devel
+ln -sf pyconfig-%{_target_cpu}.h %{py_incdir}/pyconfig.h || :
+
 %post	doc-info -p /sbin/postshell
 -/usr/sbin/fix-info-dir -c %{_infodir}
 
@@ -935,7 +944,8 @@ rm -rf $RPM_BUILD_ROOT
 %dir %{py_libdir}/config
 %{py_libdir}/config/Makefile
 %dir %{py_incdir}
-%{py_incdir}/pyconfig.h
+%ghost %{py_incdir}/pyconfig.h
+%{py_incdir}/pyconfig-%{_target_cpu}.h
 
 %files -n pydoc
 %defattr(644,root,root,755)
@@ -962,6 +972,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_libdir}/libpython.so
 %{py_incdir}/*.h
 %exclude %{py_incdir}/pyconfig.h
+%exclude %{py_incdir}/pyconfig-%{_target_cpu}.h
 %{_pkgconfigdir}/python.pc
 %{_pkgconfigdir}/python2.pc
 %{_pkgconfigdir}/python-%{py_ver}.pc
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python.git/commitdiff/3bb0fa245609b091ff20c55eab617d16cc260fd3



More information about the pld-cvs-commit mailing list