From 6ff303ee104bbee32f1912eb012ae02c4a92ea99 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Fri, 12 Jan 2018 16:06:48 +0100 Subject: [PATCH] Fix the compilation of the nis module. The headers required to build the nis module were removed from glibc and they are now provided by the libtirpc and libnsl2 packages, thus adding their respective -devel subpackages as BuildRequires and the upstream fix to search for the headers and the shared libraries at the appropriate locations. --- 00289-fix-nis-compilation.patch | 83 +++++++++++++++++++++++++++++++++ python3.spec | 17 ++++++- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 00289-fix-nis-compilation.patch diff --git a/00289-fix-nis-compilation.patch b/00289-fix-nis-compilation.patch new file mode 100644 index 0000000..4d4e3dc --- /dev/null +++ b/00289-fix-nis-compilation.patch @@ -0,0 +1,83 @@ +diff --git a/setup.py b/setup.py +index 3eb6ad1..3437e48 100644 +--- a/setup.py ++++ b/setup.py +@@ -1331,20 +1331,14 @@ class PyBuildExt(build_ext): + exts.append( Extension('termios', ['termios.c']) ) + # Jeremy Hylton's rlimit interface + exts.append( Extension('resource', ['resource.c']) ) ++ else: ++ missing.extend(['resource', 'termios']) + +- # Sun yellow pages. Some systems have the functions in libc. +- if (host_platform not in ['cygwin', 'qnx6'] and +- find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): +- if (self.compiler.find_library_file(lib_dirs, 'nsl')): +- libs = ['nsl'] +- else: +- libs = [] +- exts.append( Extension('nis', ['nismodule.c'], +- libraries = libs) ) +- else: +- missing.append('nis') ++ nis = self._detect_nis(inc_dirs, lib_dirs) ++ if nis is not None: ++ exts.append(nis) + else: +- missing.extend(['nis', 'resource', 'termios']) ++ missing.append('nis') + + # Curses support, requiring the System V version of curses, often + # provided by the ncurses library. +@@ -2179,6 +2173,51 @@ class PyBuildExt(build_ext): + ) + return ext + ++ def _detect_nis(self, inc_dirs, lib_dirs): ++ if host_platform in {'win32', 'cygwin', 'qnx6'}: ++ return None ++ ++ libs = [] ++ library_dirs = [] ++ includes_dirs = [] ++ ++ # Latest glibc has moved Sun RPC headers into tircp and nsl sub ++ # directories. rpc code has been moved to libtirpc. ++ rpcsvc_inc = find_file( ++ 'rpcsvc/yp_prot.h', inc_dirs, ++ ['/usr/local/include/nsl', '/usr/include/nsl'] ++ ) ++ rpc_inc = find_file( ++ 'rpc/rpc.h', inc_dirs, ++ ['/usr/local/include/tirpc', '/usr/include/tirpc'] ++ ) ++ if rpcsvc_inc is None or rpc_inc is None: ++ # not found ++ return None ++ includes_dirs.extend(rpcsvc_inc) ++ includes_dirs.extend(rpc_inc) ++ ++ if self.compiler.find_library_file(lib_dirs, 'nsl'): ++ libs.append('nsl') ++ else: ++ # libnsl-devel: check for libnsl in nsl/ subdirectory ++ nsl_dirs = [os.path.join(lib_dir, 'nsl') for lib_dir in lib_dirs] ++ libnsl = self.compiler.find_library_file(nsl_dirs, 'nsl') ++ if libnsl is not None: ++ library_dirs.append(os.path.dirname(libnsl)) ++ libs.append('nsl') ++ ++ if self.compiler.find_library_file(lib_dirs, 'tirpc'): ++ libs.append('tirpc') ++ ++ return Extension( ++ 'nis', ['nismodule.c'], ++ libraries=libs, ++ library_dirs=library_dirs, ++ include_dirs=includes_dirs ++ ) ++ ++ + class PyBuildInstall(install): + # Suppress the warning about installation into the lib_dynload + # directory, which is not in sys.path when running Python during diff --git a/python3.spec b/python3.spec index 8bb01e0..7495259 100644 --- a/python3.spec +++ b/python3.spec @@ -14,7 +14,7 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.3 -Release: 4%{?dist} +Release: 5%{?dist} License: Python @@ -179,6 +179,8 @@ BuildRequires: glibc-devel BuildRequires: gmp-devel BuildRequires: libappstream-glib BuildRequires: libffi-devel +BuildRequires: libnsl2-devel +BuildRequires: libtirpc-devel BuildRequires: libGL-devel BuildRequires: libX11-devel BuildRequires: ncurses-devel @@ -361,6 +363,15 @@ Patch277: 00277-fix-test-subprocess-hanging-tests.patch # Fixed upstream: https://bugs.python.org/issue31532 Patch279: 00279-fix-memory-corruption-due-to-allocator-mix.patch +# 00289 # +# Fix the compilation of the nis module, as glibc removed the +# interfaces related to Sun RPC and they are now provided +# by libtirpc and libnsl2. +# See: https://fedoraproject.org/wiki/Changes/SunRPCRemoval +# and https://fedoraproject.org/wiki/Changes/NISIPv6 +# Fixed upstream: https://bugs.python.org/issue32521 +Patch289: 00289-fix-nis-compilation.patch + # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -623,6 +634,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en %patch274 -p1 %patch277 -p1 %patch279 -p1 +%patch289 -p1 # Remove files that should be generated by the build @@ -1487,6 +1499,9 @@ fi # ====================================================== %changelog +* Fri Jan 12 2018 Charalampos Stratakis - 3.6.3-5 +- Fix the compilation of the nis module. + * Tue Nov 21 2017 Miro HronĨok - 3.6.3-4 - Raise the release of platform-python obsoletes for better maintainability