[SSSD] [PATCH] BUILD: Avoid symlinks with python modules

Lukas Slebodnik lslebodn at redhat.com
Mon Oct 5 08:56:29 UTC 2015


ehlo,

I had a discussion with debian maintainer on IRC:
04:07 < tjaalton> hmm, is adding symlinks to python modules a fedora thing? like pysss.so -> _py2sss.so
04:08 < tjaalton> looks like current debian python tools rename them, breaking the symlink
04:10 < lslebodn> it's not a fedora thing but it works on fedora
04:11 < lslebodn> It was the simplest way have to build python2 and python3 bindings in the same time
                  with automake
04:14 < tjaalton> ok
04:15 < lslebodn> _py2sssbecause there have to be the name of module in init function
04:15 < lslebodn> this is a reason why import _py2sss will fail
04:16 < lslebodn> if the debian python tool rename symbolic links then you can rename _py2sss.so after
                  installation
04:16 < lslebodn> mv _py2sss.so pysss.so
04:17 < lslebodn> instead of ln -s _py2sss.so pysss.so
04:18 < lslebodn> hmm, why I didn't do that in makefile? :-)
04:21 < lslebodn> tjaalton: If you have a probelm with symbolic links. You can try
                  http://paste.fedoraproject.org/273485/14436876
04:22 < lslebodn> but I didn't test the patch. I'm not sure if modules could be imported with such
                  change. But there shoudl not be a difference between mv and ln -s
04:24 < tjaalton> ok I'll try that, thanks

Attached is an updated version of patch from previous fpaste link.

LS
-------------- next part --------------
>From 2280a4c4fee63e2b79be57fbbecebc1344f65c4a Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 5 Oct 2015 08:06:45 +0200
Subject: [PATCH] BUILD: Avoid symlinks with python modules

We need to use different names for python{2,3} modules if we want to build
them in the same time with automake (prefix _py2 and _py3). But resulting name
need to correspond with name of module because it is used in C import function.
We used symbolic links for that purpose but it breaks debian python tools
which rename the real modules making symbolic links to point nowhere

Resolves:
https://fedorahosted.org/sssd/ticket/2814
---
 Makefile.am          | 16 ++++++++--------
 contrib/sssd.spec.in |  8 --------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ce3166716eab20c7b98005faf938f32458dbd673..b12fa86cc75cbdb9489917c2bf4281f1981fc20f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3523,10 +3523,10 @@ if BUILD_PYTHON2_BINDINGS
 			--record=$(abs_builddir)/src/config/.files2 --root=$(DESTDIR); \
 	fi
 	cd $(DESTDIR)$(py2execdir) && \
-		$(LN_S) -f _py2sss.so pysss.so ; \
-		$(LN_S) -f _py2hbac.so pyhbac.so ; \
-		$(LN_S) -f _py2sss_murmur.so pysss_murmur.so ; \
-		$(LN_S) -f _py2sss_nss_idmap.so pysss_nss_idmap.so
+		mv -f _py2sss.so pysss.so ; \
+		mv -f _py2hbac.so pyhbac.so ; \
+		mv -f _py2sss_murmur.so pysss_murmur.so ; \
+		mv -f _py2sss_nss_idmap.so pysss_nss_idmap.so
 endif
 if BUILD_PYTHON3_BINDINGS
 	if [ "$(DESTDIR)" = "" ]; then \
@@ -3541,10 +3541,10 @@ if BUILD_PYTHON3_BINDINGS
 			--record=$(abs_builddir)/src/config/.files3 --root=$(DESTDIR); \
 	fi
 	cd $(DESTDIR)$(py3execdir) && \
-		$(LN_S) -f _py3sss.so pysss.so ; \
-		$(LN_S) -f _py3hbac.so pyhbac.so ; \
-		$(LN_S) -f _py3sss_murmur.so pysss_murmur.so ; \
-		$(LN_S) -f _py3sss_nss_idmap.so pysss_nss_idmap.so
+		mv -f _py3sss.so pysss.so ; \
+		mv -f _py3hbac.so pyhbac.so ; \
+		mv -f _py3sss_murmur.so pysss_murmur.so ; \
+		mv -f _py3sss_nss_idmap.so pysss_nss_idmap.so
 endif
 	for doc in $(SSSD_DOCS); do \
 		$(MKDIR_P) $$doc $(DESTDIR)/$(docdir); \
diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in
index 63c107c1ea1eb30ffed4dc7bbecd137548dc470a..d377af4c8c7049faea02adf021c9be976ab75a22 100644
--- a/contrib/sssd.spec.in
+++ b/contrib/sssd.spec.in
@@ -867,25 +867,21 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python-sss
 %defattr(-,root,root,-)
 %{python2_sitearch}/pysss.so
-%{python2_sitearch}/_py2sss.so
 
 %if (0%{?with_python3} == 1)
 %files -n python3-sss
 %defattr(-,root,root,-)
 %{python3_sitearch}/pysss.so
-%{python3_sitearch}/_py3sss.so
 %endif
 
 %files -n python-sss-murmur
 %defattr(-,root,root,-)
 %{python2_sitearch}/pysss_murmur.so
-%{python2_sitearch}/_py2sss_murmur.so
 
 %if (0%{?with_python3} == 1)
 %files -n python3-sss-murmur
 %defattr(-,root,root,-)
 %{python3_sitearch}/pysss_murmur.so
-%{python3_sitearch}/_py3sss_murmur.so
 %endif
 
 %files -n libsss_idmap
@@ -927,25 +923,21 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python-libsss_nss_idmap
 %defattr(-,root,root,-)
 %{python2_sitearch}/pysss_nss_idmap.so
-%{python2_sitearch}/_py2sss_nss_idmap.so
 
 %if (0%{?with_python3} == 1)
 %files -n python3-libsss_nss_idmap
 %defattr(-,root,root,-)
 %{python3_sitearch}/pysss_nss_idmap.so
-%{python3_sitearch}/_py3sss_nss_idmap.so
 %endif
 
 %files -n python-libipa_hbac
 %defattr(-,root,root,-)
 %{python2_sitearch}/pyhbac.so
-%{python2_sitearch}/_py2hbac.so
 
 %if (0%{?with_python3} == 1)
 %files -n python3-libipa_hbac
 %defattr(-,root,root,-)
 %{python3_sitearch}/pyhbac.so
-%{python3_sitearch}/_py3hbac.so
 %endif
 
 %files libwbclient
-- 
2.5.0



More information about the sssd-devel mailing list