From e11ee702eaa2c66843aee2a54c72bdfa82022775 Mon Sep 17 00:00:00 2001 From: Denis Silakov Date: Wed, 25 Jun 2014 19:24:49 +0400 Subject: [PATCH] Bootstrap build --- .abf.yml | 5 +- 00153-fix-test_gdb-noise.patch | 12 - 00156-gdb-autoload-safepath.patch | 51 -- ...-workaround-ENOPROTOOPT-in-bind_port.patch | 13 - ...on-gdb-corrupted-frames-in-backtrace.patch | 48 -- bdist_rpm5.py | 235 ------- python-3.3.0b1-test-posix_fadvise.patch | 13 - ...3.4.0-add-rpmbuild-hooks-to-unittest.patch | 68 ++ ...d-build-with-libffi-multilib-wrapper.patch | 12 + ...le-parts-of-test_socket-in-rpm-build.patch | 11 + ...0-disable-test_fs_holes-in-rpm-build.patch | 11 + python3-3.4.0-disable-tests-in-test_io.patch | 11 + ...sable-tests-in-test_urllib2_localnet.patch | 13 + ...d-Werror-declaration-after-statement.patch | 86 +++ ....0-dont-duplicate-flags-in-sysconfig.patch | 30 + ...on3-3.4.0-dont-raise-from-py_compile.patch | 14 + ...3.4.0-fdr-lib64-fix-for-test_install.patch | 0 python3-3.4.0-fdr-lib64.patch | 192 ++++++ python3-3.4.0-fix-test_gdb-noise.patch | 31 + python3-3.4.0-hashlib-fips.patch | 637 ++++++++++++++++++ python3-3.4.0-more-configuration-flags.patch | 50 ++ python3-3.4.0-no-static-lib.patch | 59 ++ ...istutils-tests-that-fail-in-rpmbuild.patch | 12 + python3-3.4.0-uid-gid-overflows.patch | 62 ++ python3.spec | 416 ++++++------ 25 files changed, 1505 insertions(+), 587 deletions(-) delete mode 100644 00153-fix-test_gdb-noise.patch delete mode 100644 00156-gdb-autoload-safepath.patch delete mode 100644 00173-workaround-ENOPROTOOPT-in-bind_port.patch delete mode 100644 00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch delete mode 100644 bdist_rpm5.py delete mode 100644 python-3.3.0b1-test-posix_fadvise.patch create mode 100644 python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch create mode 100644 python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch create mode 100644 python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch create mode 100644 python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch create mode 100644 python3-3.4.0-disable-tests-in-test_io.patch create mode 100644 python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch create mode 100644 python3-3.4.0-dont-add-Werror-declaration-after-statement.patch create mode 100644 python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch create mode 100644 python3-3.4.0-dont-raise-from-py_compile.patch rename python3-3.2.3-fdr-lib64-fix-for-test_install.patch => python3-3.4.0-fdr-lib64-fix-for-test_install.patch (100%) create mode 100644 python3-3.4.0-fdr-lib64.patch create mode 100644 python3-3.4.0-fix-test_gdb-noise.patch create mode 100644 python3-3.4.0-hashlib-fips.patch create mode 100644 python3-3.4.0-more-configuration-flags.patch create mode 100644 python3-3.4.0-no-static-lib.patch create mode 100644 python3-3.4.0-skip-distutils-tests-that-fail-in-rpmbuild.patch create mode 100644 python3-3.4.0-uid-gid-overflows.patch diff --git a/.abf.yml b/.abf.yml index 255870a..66af254 100644 --- a/.abf.yml +++ b/.abf.yml @@ -8,7 +8,8 @@ removed_sources: python-3.3.1-docs-html.tar.bz2: 55c3b3f3453346835b0df2b3b0ad7fe20833a7f7 python-3.3.2-docs-html.tar.bz2: 514e1a0810fa9e6433f4bc64bdc0ad407d49ebc5 python-3.3.3-docs-html.tar.bz2: bcd1f17d3d32f59288eda50aa6432135394b5ab5 -sources: - Python-3.4.1.tar.xz: 143e098efe7ee7bec8a4904ec4b322f28a067a03 python-3.3.4-docs-html.tar.bz2: 6d54aa11f2aa51339c09358d4a10217ee905dae3 python-3.4.0-docs-html.tar.bz2: d6e8f45219353b128f002f3a7311ec4e08c0ca49 +sources: + Python-3.4.1.tar.xz: 143e098efe7ee7bec8a4904ec4b322f28a067a03 + python-3.4.1-docs-html.tar.bz2: acc5911f0e41774788121064e004941e6090542a diff --git a/00153-fix-test_gdb-noise.patch b/00153-fix-test_gdb-noise.patch deleted file mode 100644 index 539d9ae..0000000 --- a/00153-fix-test_gdb-noise.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- Python-3.4.1/Lib/test/test_gdb.py.153~ 2014-06-12 16:33:44.342930073 +0200 -+++ Python-3.4.1/Lib/test/test_gdb.py 2014-06-12 16:36:53.556564577 +0200 -@@ -182,6 +182,9 @@ class DebuggerTests(unittest.TestCase): - # Issue #19753: missing symbols on System Z - 'Missing separate debuginfo for ', - 'Try: zypper install -C ', -+ 'warning: Unable to open', -+ 'Try: urpmi.update --ignore ', -+ 'Undefined set print command' - ) - for line in errlines: - if not line.startswith(ignore_patterns): diff --git a/00156-gdb-autoload-safepath.patch b/00156-gdb-autoload-safepath.patch deleted file mode 100644 index febafbe..0000000 --- a/00156-gdb-autoload-safepath.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- Python-3.4.1/Lib/test/test_gdb.py.p156~ 2014-06-12 16:38:31.472340461 +0200 -+++ Python-3.4.1/Lib/test/test_gdb.py 2014-06-12 16:40:45.333666965 +0200 -@@ -86,6 +86,19 @@ def gdb_has_frame_select(): - - HAS_PYUP_PYDOWN = gdb_has_frame_select() - -+def gdb_has_autoload_safepath(): -+ # Recent GDBs will only auto-load scripts from certain safe -+ # locations, so we will need to turn off this protection. -+ # However, if the GDB doesn't have it, then the following -+ # command will generate noise on stderr (rhbz#817072): -+ cmd = "--eval-command=set auto-load safe-path /" -+ p = subprocess.Popen(["gdb", "--batch", cmd], -+ stderr=subprocess.PIPE) -+ _, stderr = p.communicate() -+ return b'"on" or "off" expected.' not in stderr -+ -+HAS_AUTOLOAD_SAFEPATH = gdb_has_autoload_safepath() -+ - BREAKPOINT_FN='builtin_id' - - class DebuggerTests(unittest.TestCase): -@@ -122,15 +135,28 @@ class DebuggerTests(unittest.TestCase): - commands = ['set breakpoint pending yes', - 'break %s' % breakpoint, - 'run'] -+ -+ if HAS_AUTOLOAD_SAFEPATH: -+ # Recent GDBs will only auto-load scripts from certain safe -+ # locations. -+ # Where necessary, turn off this protection to ensure that -+ # our -gdb.py script can be loaded - but not on earlier gdb builds -+ # as this would generate noise on stderr (rhbz#817072): -+ init_commands = ['set auto-load safe-path /'] -+ else: -+ init_commands = [] -+ - if cmds_after_breakpoint: - commands += cmds_after_breakpoint - else: - commands += ['backtrace'] - -+ # print init_commands - # print commands - - # Use "commands" to generate the arguments with which to invoke "gdb": - args = ["gdb", "--batch"] -+ args += ['--init-eval-command=%s' % cmd for cmd in init_commands] - args += ['--eval-command=%s' % cmd for cmd in commands] - args += ["--args", - sys.executable] diff --git a/00173-workaround-ENOPROTOOPT-in-bind_port.patch b/00173-workaround-ENOPROTOOPT-in-bind_port.patch deleted file mode 100644 index 55d6104..0000000 --- a/00173-workaround-ENOPROTOOPT-in-bind_port.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up Python-3.3.0/Lib/test/suppor/__init__.py.rhbz913732 Python-3.3.0/Lib/test/support/__init__.py ---- Python-3.3.0/Lib/test/support/__init__.py.rhbz913732 2013-03-04 16:25:53.885258476 -0500 -+++ Python-3.3.0/Lib/test/support/__init__.py 2013-03-04 16:25:58.499258157 -0500 -@@ -570,6 +570,7 @@ - raise TestFailed("tests should never set the SO_REUSEADDR " \ - "socket option on TCP/IP sockets!") -- if hasattr(socket, 'SO_REUSEPORT'): -+ if hasattr(socket, 'SO_REUSEPORT') \ -+ and 'WITHIN_PYTHON_RPM_BUILD' not in os.environ: # rhbz#913732 - try: - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: - raise TestFailed("tests should never set the SO_REUSEPORT " \ -diff -up Python-3.3.0/Lib/test/test_support.py.rhbz913732 Python-3.3.0/Lib/test/test_support.py diff --git a/00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch b/00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch deleted file mode 100644 index 2112730..0000000 --- a/00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/Tools/gdb/libpython.py 2013-04-06 03:41:58.000000000 -0400 -+++ b/Tools/gdb/libpython.py 2013-04-24 03:51:04.720540343 -0400 -@@ -274,6 +274,9 @@ - self.tp_name = tp_name - self.address = address - -+ def __len__(self): -+ return len(repr(self)) -+ - def __repr__(self): - # For the NULL pointer, we have no way of knowing a type, so - # special-case it as per -@@ -881,6 +884,8 @@ - filename = self.filename() - try: - f = open(os_fsencode(filename), 'r') -+ except TypeError: # filename is FakeRepr -+ return None - except IOError: - return None - with f: -@@ -1523,9 +1528,12 @@ - - def print_summary(self): - if self.is_evalframeex(): -- pyop = self.get_pyop() -- if pyop: -+ try: -+ pyop = self.get_pyop() - line = pyop.get_truncated_repr(MAX_OUTPUT_LEN) -+ except: -+ pyop = None -+ if pyop: - write_unicode(sys.stdout, '#%i %s\n' % (self.get_index(), line)) - if not pyop.is_optimized_out(): - line = pyop.current_line() -@@ -1542,7 +1550,10 @@ - - def print_traceback(self): - if self.is_evalframeex(): -- pyop = self.get_pyop() -+ try: -+ pyop = self.get_pyop() -+ except: -+ pyop = None - if pyop: - pyop.print_traceback() - if not pyop.is_optimized_out(): diff --git a/bdist_rpm5.py b/bdist_rpm5.py deleted file mode 100644 index 7b8e19c..0000000 --- a/bdist_rpm5.py +++ /dev/null @@ -1,235 +0,0 @@ -from distutils.command.bdist_rpm import bdist_rpm -import distutils.command.sdist -from distutils.sysconfig import get_config_var -from distutils.filelist import FileList -import string, os, sys -from types import * -from glob import glob -# import rpm - -class bdist_rpm5(bdist_rpm): - def _make_spec_file(self): - """Generate the text of an RPM spec file and return it as a - list of strings (one per line). - """ - sdist = self.reinitialize_command('sdist') - sdist.finalize_options() - sdist.filelist = FileList() - sdist.get_file_list() - manifest = sdist.filelist.files - - # definitions and headers - name = self.distribution.get_name() - version = self.distribution.get_version().replace('-','_') - release = self.release.replace('-','_') - summary = self.distribution.get_description().strip().strip('.') - - spec_file = [ - '%define\toname\t'+name, - ] - if name[:2] == "py": - spec_file.append('%define\tmodule\t' + name[2:]) - module = '%{module}' - else: - module = '%{oname}' - - spec_file.extend([ - '', - 'Name:\t\tpython3-' + module, - 'Version:\t' + version, - 'Release:\t' + release, - 'Summary:\t' + summary, - 'Source0:\thttp://pypi.python.org/packages/source/%c/%%{oname}/%%{oname}-%%{version}.tar' % name[0], - ]) - # XXX yuck! this filename is available from the "sdist" command, - # but only after it has run: and we create the spec file before - # running "sdist", in case of --spec-only. - if sdist.formats and 'xztar' in sdist.formats: - spec_file[-1] += '.xz' - elif sdist.formats and 'bztar' in sdist.formats: - spec_file[-1] += '.bz2' - else: - spec_file[-1] += '.gz' - - license = self.distribution.get_license() - if license == "UNKNOWN": - classifiers = self.distribution.get_classifiers() - for classifier in classifiers: - values = classifier.split(" :: ") - if values[0] == "License": - license = values[-1] - license.replace("GPL ", "GPLv").strip() - - # Hardcoded value from bdist_rpm not suitable for ROSA - if self.group == "Development/Libraries": - self.group == "Development/Python" - - spec_file.extend([ - 'License:\t' + license, - 'Group:\t\t' + self.group,]) - if self.distribution.get_url() != 'UNKNOWN': - spec_file.append('Url:\t\t' + self.distribution.get_url()) - - doc_names = ['README', 'CHANGES','ChangeLog', 'NEWS', 'THANKS', - 'HISTORY', 'AUTHORS', 'BUGS', 'ReleaseNotes', 'DISCLAIMER', - 'TODO', 'TROUBLESHOOTING', 'IDEAS', 'HACKING', 'WISHLIST', - 'CREDITS', 'PROJECTS', 'LEGAL', 'KNOWN_BUGS', - 'MISSING_FEATURES', 'FAQ', 'ANNOUNCE', 'FEATURES', 'WHATSNEW'] - license_names = ['LICENSE', 'COPYRIGHT', 'COPYING'] - common_licenses = glob('/usr/share/common-licenses/*') - for i in range(len(common_licenses)): - common_licenses[i] = os.path.basename(common_licenses[i]) - doc_names.extend(license_names) - doc_suffixes = ('.doc', '.htm', '.txt', '.pdf', '.odt') - - self.doc_files = [] - all_files = [] - if self.distribution.data_files: - all_files.extend(self.distribution.data_files) - if manifest: - all_files.extend(manifest) - if all_files: - for data_file in all_files: - done = False - for doc_name in doc_names: - if doc_name.lower() in data_file[1][0].lower(): - if doc_name in license_names and license in common_licenses: - done = True - break - self.doc_files.append(data_file) - done = True - break - if done: - continue - for doc_suffix in doc_suffixes: - ext = os.path.splitext(data_file.lower())[1] - if ext.lower().startswith(doc_suffix.lower()): - self.doc_files.append(data_file) - break - if not self.force_arch: - # noarch if no extension modules - if not self.distribution.has_ext_modules(): - spec_file.append('BuildArch:\tnoarch') - else: - spec_file.append( 'BuildArch:\t%s' % self.force_arch ) - - for field in ('Provides', - 'Requires', - 'Conflicts', - 'Obsoletes', - ): - val = getattr(self, field.lower()) - if type(val) == list: - spec_file.append('%s: %s' % (field, string.join(val))) - elif val is not None: - spec_file.append('%s: %s' % (field, val)) - - build_requires = [] - if self.distribution.has_ext_modules(): - build_requires.append('python3-devel') - # Ugly, but should mostly work... :p - if 'setuptools' in str(self.distribution.__dict__) or 'setuptools' in str(sdist.__dict__): - build_requires.append('python3egg(distribute)') - if build_requires: - spec_file.append('BuildRequires:\t' + - " ".join(build_requires)) - - if self.build_requires: - spec_file.append('BuildRequires:\t' + - " ".join(self.build_requires)) - - spec_file.extend([ - '', - '%description', - self.distribution.get_long_description().strip() - ]) - - - # insert contents of files - - # XXX this is kind of misleading: user-supplied options are files - # that we open and interpolate into the spec file, but the defaults - # are just text that we drop in as-is. Hmmm. - - if 'test_suite' in self.distribution.__dict__ and self.distribution.test_suite: - verify_script = "python3 setup.py test" - else: - verify_script = None - - script_options = [ - ('prep', 'prep_script', "%setup -qn %{oname}-%{version}"), - ('build', 'build_script', "python3 setup.py build"), - ('install', 'install_script', - ("python3 setup.py install " - "--root=%{buildroot}")), - ('check', 'verify_script', verify_script), - ('pre', 'pre_install', None), - ('post', 'post_install', None), - ('preun', 'pre_uninstall', None), - ('postun', 'post_uninstall', None), - ] - - for (rpm_opt, attr, default) in script_options: - # Insert contents of file referred to, if no file is referred to - # use 'default' as contents of script - val = getattr(self, attr) - if val or default: - spec_file.extend([ - '', - '%' + rpm_opt,]) - if val: - spec_file.extend(string.split(open(val, 'r').read(), '\n')) - else: - spec_file.append(default) - - - # files section - spec_file.extend([ - '', - '%files', - ]) - for doc_file in self.doc_files: - spec_file.append('%doc ' + doc_file) - - if self.distribution.has_ext_modules(): - site_pkgs = '%{py3_platsitedir}' - else: - site_pkgs = '%{py3_puresitedir}' - if self.distribution.has_scripts(): - for script in self.distribution.scripts: - if type(script) == StringType: - spec_file.append(os.path.join('%{_bindir}', os.path.basename(script))) - site_pkgs_files = [] - if self.distribution.data_files: - for data_file in self.distribution.data_files: - site_pkgs_files.append(os.path.join(site_pkgs, data_file)) - if 'entry_points' in self.distribution.__dict__ and self.distribution.entry_points: - if type(self.distribution.entry_points) is DictType: - for entry_points in self.distribution.entry_points: - for entry_point in self.distribution.entry_points[entry_points]: - site_pkgs_files.append(os.path.join('%{_bindir}', os.path.basename(entry_point.split('=')[0]))) - if 'py_modules' in self.distribution.__dict__ and self.distribution.py_modules: - for py_module in self.distribution.py_modules: - py_module = py_module.replace('.', os.path.sep) - site_pkgs_files.append(os.path.join(site_pkgs, py_module + '.py*')) - if 'packages' in self.distribution.__dict__ and self.distribution.packages: - for package in self.distribution.packages: - package = package.replace('.', os.path.sep) - #spec_file.append('%dir ' + os.path.join(site_pkgs, package)) - site_pkgs_files.append(os.path.join(site_pkgs, package, '*.py*')) - if self.distribution.has_ext_modules(): - for ext_module in self.distribution.ext_modules: - ext_module = ext_module.name.replace('.', os.path.sep) - site_pkgs_files.append(os.path.join(site_pkgs, ext_module + ".so")) - - site_pkgs_files.sort() - for f in site_pkgs_files: - spec_file.append(f) - - spec_file.append(os.path.join(site_pkgs, name.replace('-', '_') + '*.egg-info')) - - return spec_file - - # _make_spec_file () - - diff --git a/python-3.3.0b1-test-posix_fadvise.patch b/python-3.3.0b1-test-posix_fadvise.patch deleted file mode 100644 index d3c9f71..0000000 --- a/python-3.3.0b1-test-posix_fadvise.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: Python-3.3.0b1/Lib/test/test_posix.py -=================================================================== ---- Python-3.3.0b1.orig/Lib/test/test_posix.py 2012-06-26 22:19:48.000000000 +0200 -+++ Python-3.3.0b1/Lib/test/test_posix.py 2012-08-03 14:06:26.000000000 +0200 -@@ -231,7 +231,7 @@ - def test_posix_fadvise(self): - fd = os.open(support.TESTFN, os.O_RDONLY) - try: -- posix.posix_fadvise(fd, 0, 0, posix.POSIX_FADV_WILLNEED) -+ posix.posix_fadvise(fd, 0, 0, posix.POSIX_FADV_RANDOM) - finally: - os.close(fd) - diff --git a/python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch b/python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch new file mode 100644 index 0000000..20930ac --- /dev/null +++ b/python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch @@ -0,0 +1,68 @@ +diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/case.py +--- Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest 2011-09-03 12:16:44.000000000 -0400 ++++ Python-3.2.2/Lib/unittest/case.py 2011-09-09 06:35:16.365568382 -0400 +@@ -3,6 +3,7 @@ + import sys + import functools + import difflib ++import os + import logging + import pprint + import re +@@ -101,6 +102,43 @@ def expectedFailure(func): + raise self.test_case.failureException(msg) + + ++# Non-standard/downstream-only hooks for handling issues with specific test ++# cases: ++ ++def _skipInRpmBuild(reason): ++ """ ++ Non-standard/downstream-only decorator for marking a specific unit test ++ to be skipped when run within the %check of an rpmbuild. ++ ++ Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within ++ the environment, and has no effect otherwise. ++ """ ++ if 'WITHIN_PYTHON_RPM_BUILD' in os.environ: ++ return skip(reason) ++ else: ++ return _id ++ ++def _expectedFailureInRpmBuild(func): ++ """ ++ Non-standard/downstream-only decorator for marking a specific unit test ++ as expected to fail within the %check of an rpmbuild. ++ ++ Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within ++ the environment, and has no effect otherwise. ++ """ ++ @functools.wraps(func) ++ def wrapper(*args, **kwargs): ++ if 'WITHIN_PYTHON_RPM_BUILD' in os.environ: ++ try: ++ func(*args, **kwargs) ++ except Exception: ++ raise _ExpectedFailure(sys.exc_info()) ++ raise _UnexpectedSuccess ++ else: ++ # Call directly: ++ func(*args, **kwargs) ++ return wrapper ++ + class _AssertRaisesBaseContext(_BaseTestCaseContext): + + def __init__(self, expected, test_case, callable_obj=None, +diff -up Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/__init__.py +--- Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest 2011-09-03 12:16:44.000000000 -0400 ++++ Python-3.2.2/Lib/unittest/__init__.py 2011-09-09 06:35:16.366568382 -0400 +@@ -57,7 +57,8 @@ __unittest = True + + from .result import TestResult + from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf, +- skipUnless, expectedFailure) ++ skipUnless, expectedFailure, ++ _skipInRpmBuild, _expectedFailureInRpmBuild) + from .suite import BaseTestSuite, TestSuite + from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, + findTestCases) diff --git a/python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch b/python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch new file mode 100644 index 0000000..e224fc6 --- /dev/null +++ b/python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch @@ -0,0 +1,12 @@ +--- Python-3.3.2/setup.py.orig 2013-07-01 15:23:24.377711044 +0200 ++++ Python-3.3.2/setup.py 2013-07-01 15:23:34.094676496 +0200 +@@ -1882,7 +1882,8 @@ + if not line: + ffi_inc = None + break +- if line.startswith('#define LIBFFI_H'): ++ if line.startswith('#define LIBFFI_H') or \ ++ line.startswith('#define ffi_wrapper_h'): + break + ffi_lib = None + if ffi_inc is not None: diff --git a/python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch b/python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch new file mode 100644 index 0000000..0e28036 --- /dev/null +++ b/python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch @@ -0,0 +1,11 @@ +diff -up Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds Python-3.3.0b1/Lib/test/test_socket.py +--- Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds 2012-07-24 15:02:30.823355067 -0400 ++++ Python-3.3.0b1/Lib/test/test_socket.py 2012-07-24 15:08:13.021354999 -0400 +@@ -2188,6 +2188,7 @@ class RecvmsgGenericStreamTests(RecvmsgG + # Tests which require a stream socket and can use either recvmsg() + # or recvmsg_into(). + ++ @unittest._skipInRpmBuild('fails intermittently when run within Koji') + def testRecvmsgEOF(self): + # Receive end-of-stream indicator (b"", peer socket closed). + msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock, 1024) diff --git a/python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch b/python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch new file mode 100644 index 0000000..9fa91d5 --- /dev/null +++ b/python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch @@ -0,0 +1,11 @@ +diff -up cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build cpython-59223da36dec/Lib/test/test_posix.py +--- cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build 2012-08-07 17:15:59.000000000 -0400 ++++ cpython-59223da36dec/Lib/test/test_posix.py 2012-08-07 17:16:53.528330330 -0400 +@@ -973,6 +973,7 @@ class PosixTester(unittest.TestCase): + posix.RTLD_GLOBAL + posix.RTLD_LOCAL + ++ @unittest._skipInRpmBuild('running kernel may not match kernel in chroot') + @unittest.skipUnless(hasattr(os, 'SEEK_HOLE'), + "test needs an OS that reports file holes") + def test_fs_holes(self): diff --git a/python3-3.4.0-disable-tests-in-test_io.patch b/python3-3.4.0-disable-tests-in-test_io.patch new file mode 100644 index 0000000..d81a2d0 --- /dev/null +++ b/python3-3.4.0-disable-tests-in-test_io.patch @@ -0,0 +1,11 @@ +diff -up Python-2.7.2/Lib/test/test_io.py.disable-tests-in-test_io Python-2.7.2/Lib/test/test_io.py +--- Python-2.7.2/Lib/test/test_io.py.disable-tests-in-test_io 2011-09-01 14:18:45.963304089 -0400 ++++ Python-2.7.2/Lib/test/test_io.py 2011-09-01 15:08:53.796098413 -0400 +@@ -2669,6 +2669,7 @@ class SignalsTest(unittest.TestCase): + self.check_interrupted_read_retry(lambda x: x, + mode="r") + ++ @unittest.skip('rhbz#732998') + @unittest.skipUnless(threading, 'Threading required for this test.') + def check_interrupted_write_retry(self, item, **fdopen_kwargs): + """Check that a buffered write, when it gets interrupted (either diff --git a/python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch b/python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch new file mode 100644 index 0000000..7fbb157 --- /dev/null +++ b/python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch @@ -0,0 +1,13 @@ +Index: Lib/test/test_urllib2_localnet.py +=================================================================== +--- Lib/test/test_urllib2_localnet.py ++++ Lib/test/test_urllib2_localnet.py 2014-05-22 00:54:24.510284417 +0200 +@@ -541,6 +541,7 @@ + url = open_url.geturl() + self.assertEqual(url, "http://localhost:%s" % handler.port) + ++ @unittest._skipInRpmBuild('fails intermittently when run on BS') + def test_bad_address(self): + # Make sure proper exception is raised when connecting to a bogus + # address. + diff --git a/python3-3.4.0-dont-add-Werror-declaration-after-statement.patch b/python3-3.4.0-dont-add-Werror-declaration-after-statement.patch new file mode 100644 index 0000000..506d9ea --- /dev/null +++ b/python3-3.4.0-dont-add-Werror-declaration-after-statement.patch @@ -0,0 +1,86 @@ +diff --git a/Makefile.pre.in b/Makefile.pre.in +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -71,12 +71,17 @@ + BASECFLAGS= @BASECFLAGS@ + BASECPPFLAGS= @BASECPPFLAGS@ + CONFIGURE_CFLAGS= @CFLAGS@ ++# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions. ++# Use it when a compiler flag should _not_ be part of the distutils CFLAGS ++# once Python is installed (Issue #21121). ++CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@ + CONFIGURE_CPPFLAGS= @CPPFLAGS@ + CONFIGURE_LDFLAGS= @LDFLAGS@ + # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the + # command line to append to these values without stomping the pre-set + # values. + PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) ++PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) + # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to + # be able to build extension modules using the directories specified in the + # environment variables +@@ -91,7 +96,7 @@ + # Extra C flags added for building the interpreter object files. + CFLAGSFORSHARED=@CFLAGSFORSHARED@ + # C flags used for building the interpreter object files +-PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE ++PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE + + + # Machine-dependent subdirectories +diff --git a/configure b/configure +--- a/configure ++++ b/configure +@@ -662,6 +662,7 @@ + LIBTOOL_CRUFT + OTHER_LIBTOOL_OPT + UNIVERSAL_ARCH_FLAGS ++CFLAGS_NODIST + BASECFLAGS + OPT + ABIFLAGS +@@ -6504,7 +6505,7 @@ + + if test $ac_cv_declaration_after_statement_warning = yes + then +- BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" ++ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement" + fi + + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 +diff --git a/configure.ac b/configure.ac +--- a/configure.ac ++++ b/configure.ac +@@ -1147,6 +1147,7 @@ + fi + + AC_SUBST(BASECFLAGS) ++AC_SUBST(CFLAGS_NODIST) + + # The -arch flags for universal builds on OSX + UNIVERSAL_ARCH_FLAGS= +@@ -1231,7 +1232,7 @@ + + if test $ac_cv_declaration_after_statement_warning = yes + then +- BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" ++ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement" + fi + + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 +diff --git a/setup.py b/setup.py +--- a/setup.py ++++ b/setup.py +@@ -19,6 +19,12 @@ + + cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ + ++# Add special CFLAGS reserved for building the interpreter and the stdlib ++# modules (Issue #21121). ++cflags = sysconfig.get_config_var('CFLAGS') ++py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST') ++sysconfig.get_config_vars()['CFLAGS'] = cflags + ' ' + py_cflags_nodist ++ + def get_platform(): + # cross build + if "_PYTHON_HOST_PLATFORM" in os.environ: diff --git a/python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch b/python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch new file mode 100644 index 0000000..fc49b30 --- /dev/null +++ b/python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch @@ -0,0 +1,30 @@ +diff -r 39b9b05c3085 Lib/distutils/sysconfig.py +--- a/Lib/distutils/sysconfig.py Wed Apr 10 00:27:23 2013 +0200 ++++ b/Lib/distutils/sysconfig.py Wed Apr 10 10:14:18 2013 +0200 +@@ -362,7 +362,10 @@ + done[n] = item = "" + if found: + after = value[m.end():] +- value = value[:m.start()] + item + after ++ value = value[:m.start()] ++ if item.strip() not in value: ++ value += item ++ value += after + if "$" in after: + notdone[name] = value + else: +diff -r 39b9b05c3085 Lib/sysconfig.py +--- a/Lib/sysconfig.py Wed Apr 10 00:27:23 2013 +0200 ++++ b/Lib/sysconfig.py Wed Apr 10 10:14:18 2013 +0200 +@@ -296,7 +296,10 @@ + + if found: + after = value[m.end():] +- value = value[:m.start()] + item + after ++ value = value[:m.start()] ++ if item.strip() not in value: ++ value += item ++ value += after + if "$" in after: + notdone[name] = value + else: diff --git a/python3-3.4.0-dont-raise-from-py_compile.patch b/python3-3.4.0-dont-raise-from-py_compile.patch new file mode 100644 index 0000000..25c4a9d --- /dev/null +++ b/python3-3.4.0-dont-raise-from-py_compile.patch @@ -0,0 +1,14 @@ +diff -r 7fa3e824a4ee Lib/test/test_py_compile.py +--- a/Lib/test/test_py_compile.py Tue Oct 29 22:25:06 2013 -0400 ++++ b/Lib/test/test_py_compile.py Wed Oct 30 11:08:31 2013 +0100 +@@ -54,6 +54,10 @@ + self.assertTrue(os.path.exists(self.pyc_path)) + self.assertFalse(os.path.exists(self.cache_path)) + ++ def test_bad_coding(self): ++ bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py') ++ self.assertIsNone(py_compile.compile(bad_coding, doraise=False)) ++ + def test_relative_path(self): + py_compile.compile(os.path.relpath(self.source_path), + os.path.relpath(self.pyc_path)) diff --git a/python3-3.2.3-fdr-lib64-fix-for-test_install.patch b/python3-3.4.0-fdr-lib64-fix-for-test_install.patch similarity index 100% rename from python3-3.2.3-fdr-lib64-fix-for-test_install.patch rename to python3-3.4.0-fdr-lib64-fix-for-test_install.patch diff --git a/python3-3.4.0-fdr-lib64.patch b/python3-3.4.0-fdr-lib64.patch new file mode 100644 index 0000000..db5fd95 --- /dev/null +++ b/python3-3.4.0-fdr-lib64.patch @@ -0,0 +1,192 @@ +--- Python-3.4.0b1/Lib/distutils/command/install.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/distutils/command/install.py 2013-11-27 11:10:43.821150774 +0100 +@@ -45,14 +45,14 @@ else: + INSTALL_SCHEMES = { + 'unix_prefix': { + 'purelib': '$base/lib/python$py_version_short/site-packages', +- 'platlib': '$platbase/lib/python$py_version_short/site-packages', ++ 'platlib': '$platbase/lib64/python$py_version_short/site-packages', + 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', + }, + 'unix_home': { + 'purelib': '$base/lib/python', +- 'platlib': '$base/lib/python', ++ 'platlib': '$base/lib64/python', + 'headers': '$base/include/python/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', +--- Python-3.4.0b1/Lib/distutils/sysconfig.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/distutils/sysconfig.py 2013-11-27 11:10:43.821150774 +0100 +@@ -141,8 +141,12 @@ + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": ++ if plat_specific or standard_lib: ++ lib = "lib64" ++ else: ++ lib = "lib" + libpython = os.path.join(prefix, +- "lib", "python" + get_python_version()) ++ lib, "python" + get_python_version()) + if standard_lib: + return libpython + else: +--- Python-3.4.0b1/Lib/site.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/site.py 2013-11-27 11:10:43.822150773 +0100 +@@ -304,12 +304,16 @@ + seen.add(prefix) + + if os.sep == '/': ++ sitepackages.append(os.path.join(prefix, "lib64", ++ "python" + sys.version[:3], ++ "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", + "python" + sys.version[:3], + "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-python")) + else: + sitepackages.append(prefix) ++ sitepackages.append(os.path.join(prefix, "lib64", "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-packages")) + if sys.platform == "darwin": + # for framework builds *only* we add the standard Apple +--- Python-3.4.0b1/Lib/sysconfig.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/sysconfig.py 2013-11-27 11:10:43.822150773 +0100 +@@ -20,10 +20,10 @@ + + _INSTALL_SCHEMES = { + 'posix_prefix': { +- 'stdlib': '{installed_base}/lib/python{py_version_short}', +- 'platstdlib': '{platbase}/lib/python{py_version_short}', ++ 'stdlib': '{installed_base}/lib64/python{py_version_short}', ++ 'platstdlib': '{platbase}/lib64/python{py_version_short}', + 'purelib': '{base}/lib/python{py_version_short}/site-packages', +- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{platbase}/lib64/python{py_version_short}/site-packages', + 'include': + '{installed_base}/include/python{py_version_short}{abiflags}', + 'platinclude': +@@ -61,10 +61,10 @@ + 'data': '{userbase}', + }, + 'posix_user': { +- 'stdlib': '{userbase}/lib/python{py_version_short}', +- 'platstdlib': '{userbase}/lib/python{py_version_short}', ++ 'stdlib': '{userbase}/lib64/python{py_version_short}', ++ 'platstdlib': '{userbase}/lib64/python{py_version_short}', + 'purelib': '{userbase}/lib/python{py_version_short}/site-packages', +- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{userbase}/lib64/python{py_version_short}/site-packages', + 'include': '{userbase}/include/python{py_version_short}', + 'scripts': '{userbase}/bin', + 'data': '{userbase}', +--- Python-3.4.0b1/Lib/test/test_site.py.lib64 2013-11-24 21:36:55.000000000 +0100 ++++ Python-3.4.0b1/Lib/test/test_site.py 2013-11-27 11:10:43.822150773 +0100 +@@ -244,12 +244,15 @@ + self.assertEqual(dirs[2], wanted) + elif os.sep == '/': + # OS X non-framwework builds, Linux, FreeBSD, etc +- self.assertEqual(len(dirs), 2) +- wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], ++ self.assertEqual(len(dirs), 3) ++ wanted = os.path.join('xoxo', 'lib64', 'python' + sys.version[:3], + 'site-packages') + self.assertEqual(dirs[0], wanted) +- wanted = os.path.join('xoxo', 'lib', 'site-python') ++ wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], ++ 'site-packages') + self.assertEqual(dirs[1], wanted) ++ wanted = os.path.join('xoxo', 'lib', 'site-python') ++ self.assertEqual(dirs[2], wanted) + else: + # other platforms + self.assertEqual(len(dirs), 2) +--- Python-3.4.0b1/Makefile.pre.in.lib64 2013-11-27 11:10:43.814150786 +0100 ++++ Python-3.4.0b1/Makefile.pre.in 2013-11-27 11:10:43.823150771 +0100 +@@ -115,7 +115,7 @@ + MANDIR= @mandir@ + INCLUDEDIR= @includedir@ + CONFINCLUDEDIR= $(exec_prefix)/include +-SCRIPTDIR= $(prefix)/lib ++SCRIPTDIR= $(prefix)/lib64 + ABIFLAGS= @ABIFLAGS@ + + # Detailed destination directories +--- Python-3.4.0b1/Modules/getpath.c.lib64 2013-11-24 21:36:56.000000000 +0100 ++++ Python-3.4.0b1/Modules/getpath.c 2013-11-27 11:17:33.619449704 +0100 +@@ -122,8 +122,8 @@ + #endif + + #ifndef PYTHONPATH +-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ +- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" ++#define PYTHONPATH PREFIX "/lib64/python" VERSION ":" \ ++ EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload" + #endif + + #ifndef LANDMARK +@@ -498,7 +498,7 @@ + _pythonpath = _Py_char2wchar(PYTHONPATH, NULL); + _prefix = _Py_char2wchar(PREFIX, NULL); + _exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL); +- lib_python = _Py_char2wchar("lib/python" VERSION, NULL); ++ lib_python = _Py_char2wchar("lib64/python" VERSION, NULL); + + if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) { + Py_FatalError( +@@ -687,7 +687,7 @@ + } + else + wcsncpy(zip_path, _prefix, MAXPATHLEN); +- joinpath(zip_path, L"lib/python00.zip"); ++ joinpath(zip_path, L"lib64/python00.zip"); + bufsz = wcslen(zip_path); /* Replace "00" with version */ + zip_path[bufsz - 6] = VERSION[0]; + zip_path[bufsz - 5] = VERSION[2]; +@@ -699,7 +699,7 @@ + fprintf(stderr, + "Could not find platform dependent libraries \n"); + wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN); +- joinpath(exec_prefix, L"lib/lib-dynload"); ++ joinpath(exec_prefix, L"lib64/lib-dynload"); + } + /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ + +--- Python-3.4.0b1/setup.py.lib64 2013-11-24 21:36:56.000000000 +0100 ++++ Python-3.4.0b1/setup.py 2013-11-27 11:10:43.824150769 +0100 +@@ -441,7 +441,7 @@ + # directories (i.e. '.' and 'Include') must be first. See issue + # 10520. + if not cross_compiling: +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') ++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + # only change this for cross builds for 3.3, issues on Mageia + if cross_compiling: +@@ -718,11 +718,11 @@ + elif curses_library: + readline_libs.append(curses_library) + elif self.compiler.find_library_file(lib_dirs + +- ['/usr/lib/termcap'], ++ ['/usr/lib64/termcap'], + 'termcap'): + readline_libs.append('termcap') + exts.append( Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], ++ library_dirs=['/usr/lib64/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs) ) + else: +@@ -759,8 +759,8 @@ + if krb5_h: + ssl_incs += krb5_h + ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, +- ['/usr/local/ssl/lib', +- '/usr/contrib/ssl/lib/' ++ ['/usr/local/ssl/lib64', ++ '/usr/contrib/ssl/lib64/' + ] ) + + if (ssl_incs is not None and diff --git a/python3-3.4.0-fix-test_gdb-noise.patch b/python3-3.4.0-fix-test_gdb-noise.patch new file mode 100644 index 0000000..8b0a76c --- /dev/null +++ b/python3-3.4.0-fix-test_gdb-noise.patch @@ -0,0 +1,31 @@ +--- Lib/test/test_gdb.py.old 2012-04-11 21:04:01.367073855 -0400 ++++ Lib/test/test_gdb.py 2012-04-12 08:52:58.320288761 -0400 +@@ -96,6 +96,15 @@ class DebuggerTests(unittest.TestCase): + # Generate a list of commands in gdb's language: + commands = ['set breakpoint pending yes', + 'break %s' % breakpoint, ++ ++ # GDB as of Fedora 17 onwards can distinguish between the ++ # value of a variable at entry vs current value: ++ # http://sourceware.org/gdb/onlinedocs/gdb/Variables.html ++ # which leads to the selftests failing with errors like this: ++ # AssertionError: 'v@entry=()' != '()' ++ # Disable this: ++ 'set print entry-values no', ++ + 'run'] + if cmds_after_breakpoint: + commands += cmds_after_breakpoint +--- Lib/test/test_gdb.py.old 2012-04-11 21:04:01.367073855 -0400 ++++ Lib/test/test_gdb.py 2012-04-12 08:52:58.320288761 -0400 +@@ -144,6 +153,10 @@ + 'Missing separate debuginfo for ', + 'Try: zypper install -C ', + ) ++ ignore_patterns += ('warning: Unable to open', ++ 'Missing separate debuginfo for', ++ 'Try: yum --disablerepo=', ++ 'Undefined set print command') + for line in errlines: + if not line.startswith(ignore_patterns): + unexpected_errlines.append(line) diff --git a/python3-3.4.0-hashlib-fips.patch b/python3-3.4.0-hashlib-fips.patch new file mode 100644 index 0000000..3d92c34 --- /dev/null +++ b/python3-3.4.0-hashlib-fips.patch @@ -0,0 +1,637 @@ +--- Python-3.4.0b1/Lib/hashlib.py.hashlib-fips 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/hashlib.py 2013-11-27 11:45:17.073617547 +0100 +@@ -23,6 +23,16 @@ + Choose your hash function wisely. Some have known collision weaknesses. + sha384 and sha512 will be slow on 32 bit platforms. + ++If the underlying implementation supports "FIPS mode", and this is enabled, it ++may restrict the available hashes to only those that are compliant with FIPS ++regulations. For example, it may deny the use of MD5, on the grounds that this ++is not secure for uses such as authentication, system integrity checking, or ++digital signatures. If you need to use such a hash for non-security purposes ++(such as indexing into a data structure for speed), you can override the keyword ++argument "usedforsecurity" from True to False to signify that your code is not ++relying on the hash for security purposes, and this will allow the hash to be ++usable even in FIPS mode. ++ + Hash objects have these methods: + - update(arg): Update the hash object with the bytes in arg. Repeated calls + are equivalent to a single call with the concatenation of all +@@ -63,6 +73,19 @@ + __all__ = __always_supported + ('new', 'algorithms_guaranteed', + 'algorithms_available', 'pbkdf2_hmac') + ++import functools ++def __ignore_usedforsecurity(func): ++ """Used for sha3_* functions. Until OpenSSL implements them, we want ++ to use them from Python _sha3 module, but we want them to accept ++ usedforsecurity argument too.""" ++ # TODO: remove this function when OpenSSL implements sha3 ++ @functools.wraps(func) ++ def inner(*args, **kwargs): ++ if 'usedforsecurity' in kwargs: ++ kwargs.pop('usedforsecurity') ++ return func(*args, **kwargs) ++ return inner ++ + + __builtin_constructor_cache = {} + +@@ -108,34 +131,41 @@ + f = getattr(_hashlib, 'openssl_' + name) + # Allow the C module to raise ValueError. The function will be + # defined but the hash not actually available thanks to OpenSSL. +- f() ++ # We pass "usedforsecurity=False" to disable FIPS-based restrictions: ++ # at this stage we're merely seeing if the function is callable, ++ # rather than using it for actual work. ++ f(usedforsecurity=False) + # Use the C function directly (very fast) + return f + except (AttributeError, ValueError): ++ # TODO: We want to just raise here when OpenSSL implements sha3 ++ # because we want to make sure that Fedora uses everything from OpenSSL + return __get_builtin_constructor(name) + + +-def __py_new(name, data=b''): +- """new(name, data=b'') - Return a new hashing object using the named algorithm; +- optionally initialized with data (which must be bytes). ++def __py_new(name, data=b'', usedforsecurity=True): ++ """new(name, data=b'', usedforsecurity=True) - Return a new hashing object using ++ the named algorithm; optionally initialized with data (which must be bytes). ++ The 'usedforsecurity' keyword argument does nothing, and is for compatibilty ++ with the OpenSSL implementation + """ + return __get_builtin_constructor(name)(data) + + +-def __hash_new(name, data=b''): +- """new(name, data=b'') - Return a new hashing object using the named algorithm; +- optionally initialized with data (which must be bytes). ++def __hash_new(name, data=b'', usedforsecurity=True): ++ """new(name, data=b'', usedforsecurity=True) - Return a new hashing object using ++ the named algorithm; optionally initialized with data (which must be bytes). ++ ++ Override 'usedforsecurity' to False when using for non-security purposes in ++ a FIPS environment + """ + try: +- return _hashlib.new(name, data) ++ return _hashlib.new(name, data, usedforsecurity) + except ValueError: +- # If the _hashlib module (OpenSSL) doesn't support the named +- # hash, try using our builtin implementations. +- # This allows for SHA224/256 and SHA384/512 support even though +- # the OpenSSL library prior to 0.9.8 doesn't provide them. ++ # TODO: We want to just raise here when OpenSSL implements sha3 ++ # because we want to make sure that Fedora uses everything from OpenSSL + return __get_builtin_constructor(name)(data) + +- + try: + import _hashlib + new = __hash_new +@@ -215,7 +245,10 @@ + # try them all, some may not work due to the OpenSSL + # version not supporting that algorithm. + try: +- globals()[__func_name] = __get_hash(__func_name) ++ func = __get_hash(__func_name) ++ if 'sha3_' in __func_name: ++ func = __ignore_usedforsecurity(func) ++ globals()[__func_name] = func + except ValueError: + import logging + logging.exception('code for hash %s was not found.', __func_name) +@@ -223,3 +256,4 @@ + # Cleanup locals() + del __always_supported, __func_name, __get_hash + del __py_new, __hash_new, __get_openssl_constructor ++del __ignore_usedforsecurity +--- Python-3.4.0b1/Lib/test/test_hashlib.py 2013-11-27 11:55:42.769601363 +0100 ++++ Python-3.4.0b1/Lib/test/test_hashlib.py 2013-11-28 09:33:03.929008508 +0100 +@@ -24,7 +24,22 @@ + COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') + + c_hashlib = import_fresh_module('hashlib', fresh=['_hashlib']) +-py_hashlib = import_fresh_module('hashlib', blocked=['_hashlib']) ++# skipped on Fedora, since we always use OpenSSL implementation ++# py_hashlib = import_fresh_module('hashlib', blocked=['_hashlib']) ++ ++def openssl_enforces_fips(): ++ # Use the "openssl" command (if present) to try to determine if the local ++ # OpenSSL is configured to enforce FIPS ++ from subprocess import Popen, PIPE ++ try: ++ p = Popen(['openssl', 'md5'], ++ stdin=PIPE, stdout=PIPE, stderr=PIPE) ++ except OSError: ++ # "openssl" command not found ++ return False ++ stdout, stderr = p.communicate(input=b'abc') ++ return b'unknown cipher' in stderr ++OPENSSL_ENFORCES_FIPS = openssl_enforces_fips() + + def hexstr(s): + assert isinstance(s, bytes), repr(s) +@@ -34,6 +49,16 @@ + r += h[(i >> 4) & 0xF] + h[i & 0xF] + return r + ++# hashlib and _hashlib-based functions support a "usedforsecurity" keyword ++# argument, and FIPS mode requires that it be used overridden with a False ++# value for these selftests to work. Other cryptographic code within Python ++# doesn't support this keyword. ++# Modify a function to one in which "usedforsecurity=False" is added to the ++# keyword arguments: ++def suppress_fips(f): ++ def g(*args, **kwargs): ++ return f(*args, usedforsecurity=False, **kwargs) ++ return g + + class HashLibTestCase(unittest.TestCase): + supported_hash_names = ( 'md5', 'MD5', 'sha1', 'SHA1', +@@ -66,11 +91,11 @@ + # For each algorithm, test the direct constructor and the use + # of hashlib.new given the algorithm name. + for algorithm, constructors in self.constructors_to_test.items(): +- constructors.add(getattr(hashlib, algorithm)) ++ constructors.add(suppress_fips(getattr(hashlib, algorithm))) + def _test_algorithm_via_hashlib_new(data=None, _alg=algorithm): + if data is None: +- return hashlib.new(_alg) +- return hashlib.new(_alg, data) ++ return suppress_fips(hashlib.new)(_alg) ++ return suppress_fips(hashlib.new)(_alg, data) + constructors.add(_test_algorithm_via_hashlib_new) + + _hashlib = self._conditional_import_module('_hashlib') +@@ -82,26 +107,12 @@ + for algorithm, constructors in self.constructors_to_test.items(): + constructor = getattr(_hashlib, 'openssl_'+algorithm, None) + if constructor: +- constructors.add(constructor) ++ constructors.add(suppress_fips(constructor)) + + def add_builtin_constructor(name): + constructor = getattr(hashlib, "__get_builtin_constructor")(name) + self.constructors_to_test[name].add(constructor) + +- _md5 = self._conditional_import_module('_md5') +- if _md5: +- add_builtin_constructor('md5') +- _sha1 = self._conditional_import_module('_sha1') +- if _sha1: +- add_builtin_constructor('sha1') +- _sha256 = self._conditional_import_module('_sha256') +- if _sha256: +- add_builtin_constructor('sha224') +- add_builtin_constructor('sha256') +- _sha512 = self._conditional_import_module('_sha512') +- if _sha512: +- add_builtin_constructor('sha384') +- add_builtin_constructor('sha512') + + super(HashLibTestCase, self).__init__(*args, **kwargs) + +@@ -157,9 +169,6 @@ + else: + del sys.modules['_md5'] + self.assertRaises(TypeError, get_builtin_constructor, 3) +- constructor = get_builtin_constructor('md5') +- self.assertIs(constructor, _md5.md5) +- self.assertEqual(sorted(builtin_constructor_cache), ['MD5', 'md5']) + + def test_hexdigest(self): + for cons in self.hash_constructors: +@@ -558,6 +567,65 @@ + + self.assertEqual(expected_hash, hasher.hexdigest()) + ++ def test_issue9146(self): ++ # Ensure that various ways to use "MD5" from "hashlib" don't segfault: ++ m = hashlib.md5(usedforsecurity=False) ++ m.update(b'abc\n') ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ m = hashlib.new('md5', usedforsecurity=False) ++ m.update(b'abc\n') ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ m = hashlib.md5(b'abc\n', usedforsecurity=False) ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ m = hashlib.new('md5', b'abc\n', usedforsecurity=False) ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ @unittest.skipUnless(OPENSSL_ENFORCES_FIPS, ++ 'FIPS enforcement required for this test.') ++ def test_hashlib_fips_mode(self): ++ # Ensure that we raise a ValueError on vanilla attempts to use MD5 ++ # in hashlib in a FIPS-enforced setting: ++ with self.assertRaisesRegexp(ValueError, '.*unknown cipher'): ++ m = hashlib.md5() ++ ++ if not self._conditional_import_module('_md5'): ++ with self.assertRaisesRegexp(ValueError, '.*unknown cipher'): ++ m = hashlib.new('md5') ++ ++ @unittest.skipUnless(OPENSSL_ENFORCES_FIPS, ++ 'FIPS enforcement required for this test.') ++ def test_hashopenssl_fips_mode(self): ++ # Verify the _hashlib module's handling of md5: ++ _hashlib = self._conditional_import_module('_hashlib') ++ if _hashlib: ++ assert hasattr(_hashlib, 'openssl_md5') ++ ++ # Ensure that _hashlib raises a ValueError on vanilla attempts to ++ # use MD5 in a FIPS-enforced setting: ++ with self.assertRaisesRegexp(ValueError, '.*unknown cipher'): ++ m = _hashlib.openssl_md5() ++ with self.assertRaisesRegexp(ValueError, '.*unknown cipher'): ++ m = _hashlib.new('md5') ++ ++ # Ensure that in such a setting we can whitelist a callsite with ++ # usedforsecurity=False and have it succeed: ++ m = _hashlib.openssl_md5(usedforsecurity=False) ++ m.update(b'abc\n') ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ m = _hashlib.new('md5', usedforsecurity=False) ++ m.update(b'abc\n') ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ m = _hashlib.openssl_md5(b'abc\n', usedforsecurity=False) ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ ++ m = _hashlib.new('md5', b'abc\n', usedforsecurity=False) ++ self.assertEquals(m.hexdigest(), "0bee89b07a248e27c83fc3d5951213c1") ++ + + class KDFTests(unittest.TestCase): + +@@ -639,6 +707,7 @@ + with self.assertRaisesRegex(ValueError, 'unsupported hash type'): + pbkdf2('unknown', b'pass', b'salt', 1) + ++ @unittest.skip('skipped on Fedora, as we always use OpenSSL pbkdf2_hmac') + def test_pbkdf2_hmac_py(self): + self._test_pbkdf2_hmac(py_hashlib.pbkdf2_hmac) + +--- Python-3.4.0b1/Modules/_hashopenssl.c.hashlib-fips 2013-11-24 21:36:56.000000000 +0100 ++++ Python-3.4.0b1/Modules/_hashopenssl.c 2013-11-27 12:01:57.443537463 +0100 +@@ -19,6 +19,8 @@ + + + /* EVP is the preferred interface to hashing in OpenSSL */ ++#include ++#include + #include + #include + /* We use the object interface to discover what hashes OpenSSL supports. */ +@@ -48,11 +50,19 @@ + + static PyTypeObject EVPtype; + ++/* Struct to hold all the cached information we need on a specific algorithm. ++ We have one of these per algorithm */ ++typedef struct { ++ PyObject *name_obj; ++ EVP_MD_CTX ctxs[2]; ++ /* ctx_ptrs will point to ctxs unless an error occurred, when it will ++ be NULL: */ ++ EVP_MD_CTX *ctx_ptrs[2]; ++ PyObject *error_msgs[2]; ++} EVPCachedInfo; + +-#define DEFINE_CONSTS_FOR_NEW(Name) \ +- static PyObject *CONST_ ## Name ## _name_obj = NULL; \ +- static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \ +- static EVP_MD_CTX *CONST_new_ ## Name ## _ctx_p = NULL; ++#define DEFINE_CONSTS_FOR_NEW(Name) \ ++ static EVPCachedInfo cached_info_ ##Name; + + DEFINE_CONSTS_FOR_NEW(md5) + DEFINE_CONSTS_FOR_NEW(sha1) +@@ -97,6 +107,48 @@ + } + } + ++static void ++mc_ctx_init(EVP_MD_CTX *ctx, int usedforsecurity) ++{ ++ EVP_MD_CTX_init(ctx); ++ ++ /* ++ If the user has declared that this digest is being used in a ++ non-security role (e.g. indexing into a data structure), set ++ the exception flag for openssl to allow it ++ */ ++ if (!usedforsecurity) { ++#ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW ++ EVP_MD_CTX_set_flags(ctx, ++ EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); ++#endif ++ } ++} ++ ++/* Get an error msg for the last error as a PyObject */ ++static PyObject * ++error_msg_for_last_error(void) ++{ ++ char *errstr; ++ ++ errstr = ERR_error_string(ERR_peek_last_error(), NULL); ++ ERR_clear_error(); ++ ++ return PyUnicode_FromString(errstr); /* Can be NULL */ ++} ++ ++static void ++set_evp_exception(void) ++{ ++ char *errstr; ++ ++ errstr = ERR_error_string(ERR_peek_last_error(), NULL); ++ ERR_clear_error(); ++ ++ PyErr_SetString(PyExc_ValueError, errstr); ++} ++ ++ + /* Internal methods for a hash object */ + + static void +@@ -281,15 +333,16 @@ + static int + EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds) + { +- static char *kwlist[] = {"name", "string", NULL}; ++ static char *kwlist[] = {"name", "string", "usedforsecurity", NULL}; + PyObject *name_obj = NULL; + PyObject *data_obj = NULL; ++ int usedforsecurity = 1; + Py_buffer view; + char *nameStr; + const EVP_MD *digest; + +- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:HASH", kwlist, +- &name_obj, &data_obj)) { ++ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:HASH", kwlist, ++ &name_obj, &data_obj, &usedforsecurity)) { + return -1; + } + +@@ -310,7 +363,12 @@ + PyBuffer_Release(&view); + return -1; + } +- EVP_DigestInit(&self->ctx, digest); ++ mc_ctx_init(&self->ctx, usedforsecurity); ++ if (!EVP_DigestInit_ex(&self->ctx, digest, NULL)) { ++ set_evp_exception(); ++ PyBuffer_Release(&view); ++ return -1; ++ } + + self->name = name_obj; + Py_INCREF(self->name); +@@ -394,7 +452,8 @@ + static PyObject * + EVPnew(PyObject *name_obj, + const EVP_MD *digest, const EVP_MD_CTX *initial_ctx, +- const unsigned char *cp, Py_ssize_t len) ++ const unsigned char *cp, Py_ssize_t len, ++ int usedforsecurity) + { + EVPobject *self; + +@@ -409,7 +468,12 @@ + if (initial_ctx) { + EVP_MD_CTX_copy(&self->ctx, initial_ctx); + } else { +- EVP_DigestInit(&self->ctx, digest); ++ mc_ctx_init(&self->ctx, usedforsecurity); ++ if (!EVP_DigestInit_ex(&self->ctx, digest, NULL)) { ++ set_evp_exception(); ++ Py_DECREF(self); ++ return NULL; ++ } + } + + if (cp && len) { +@@ -433,21 +497,29 @@ + An optional string argument may be provided and will be\n\ + automatically hashed.\n\ + \n\ +-The MD5 and SHA1 algorithms are always supported.\n"); ++The MD5 and SHA1 algorithms are always supported.\n\ ++\n\ ++An optional \"usedforsecurity=True\" keyword argument is provided for use in\n\ ++environments that enforce FIPS-based restrictions. Some implementations of\n\ ++OpenSSL can be configured to prevent the usage of non-secure algorithms (such\n\ ++as MD5). If you have a non-security use for these algorithms (e.g. a hash\n\ ++table), you can override this argument by marking the callsite as\n\ ++\"usedforsecurity=False\"."); + + static PyObject * + EVP_new(PyObject *self, PyObject *args, PyObject *kwdict) + { +- static char *kwlist[] = {"name", "string", NULL}; ++ static char *kwlist[] = {"name", "string", "usedforsecurity", NULL}; + PyObject *name_obj = NULL; + PyObject *data_obj = NULL; ++ int usedforsecurity = 1; + Py_buffer view = { 0 }; + PyObject *ret_obj; + char *name; + const EVP_MD *digest; + +- if (!PyArg_ParseTupleAndKeywords(args, kwdict, "O|O:new", kwlist, +- &name_obj, &data_obj)) { ++ if (!PyArg_ParseTupleAndKeywords(args, kwdict, "O|Oi:new", kwlist, ++ &name_obj, &data_obj, &usedforsecurity)) { + return NULL; + } + +@@ -461,7 +533,8 @@ + + digest = EVP_get_digestbyname(name); + +- ret_obj = EVPnew(name_obj, digest, NULL, (unsigned char*)view.buf, view.len); ++ ret_obj = EVPnew(name_obj, digest, NULL, (unsigned char*)view.buf, view.len, ++ usedforsecurity); + + if (data_obj) + PyBuffer_Release(&view); +@@ -742,57 +815,115 @@ + + + /* +- * This macro generates constructor function definitions for specific +- * hash algorithms. These constructors are much faster than calling +- * the generic one passing it a python string and are noticably +- * faster than calling a python new() wrapper. Thats important for ++ * This macro and function generates a family of constructor function ++ * definitions for specific hash algorithms. These constructors are much ++ * faster than calling the generic one passing it a python string and are ++ * noticably faster than calling a python new() wrapper. That's important for + * code that wants to make hashes of a bunch of small strings. + */ + #define GEN_CONSTRUCTOR(NAME) \ + static PyObject * \ +- EVP_new_ ## NAME (PyObject *self, PyObject *args) \ ++ EVP_new_ ## NAME (PyObject *self, PyObject *args, PyObject *kwdict) \ + { \ +- PyObject *data_obj = NULL; \ +- Py_buffer view = { 0 }; \ +- PyObject *ret_obj; \ +- \ +- if (!PyArg_ParseTuple(args, "|O:" #NAME , &data_obj)) { \ +- return NULL; \ +- } \ +- \ +- if (data_obj) \ +- GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view); \ +- \ +- ret_obj = EVPnew( \ +- CONST_ ## NAME ## _name_obj, \ +- NULL, \ +- CONST_new_ ## NAME ## _ctx_p, \ +- (unsigned char*)view.buf, \ +- view.len); \ +- \ +- if (data_obj) \ +- PyBuffer_Release(&view); \ +- return ret_obj; \ ++ return implement_specific_EVP_new(self, args, kwdict, \ ++ "|Oi:" #NAME, \ ++ &cached_info_ ## NAME ); \ ++ } ++ ++static PyObject * ++implement_specific_EVP_new(PyObject *self, PyObject *args, PyObject *kwdict, ++ const char *format, ++ EVPCachedInfo *cached_info) ++{ ++ static char *kwlist[] = {"string", "usedforsecurity", NULL}; ++ PyObject *data_obj = NULL; ++ Py_buffer view = { 0 }; ++ int usedforsecurity = 1; ++ int idx; ++ PyObject *ret_obj = NULL; ++ ++ assert(cached_info); ++ ++ if (!PyArg_ParseTupleAndKeywords(args, kwdict, format, kwlist, ++ &data_obj, &usedforsecurity)) { ++ return NULL; ++ } ++ ++ if (data_obj) ++ GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view); ++ ++ idx = usedforsecurity ? 1 : 0; ++ ++ /* ++ * If an error occurred during creation of the global content, the ctx_ptr ++ * will be NULL, and the error_msg will hopefully be non-NULL: ++ */ ++ if (cached_info->ctx_ptrs[idx]) { ++ /* We successfully initialized this context; copy it: */ ++ ret_obj = EVPnew(cached_info->name_obj, ++ NULL, ++ cached_info->ctx_ptrs[idx], ++ (unsigned char*)view.buf, view.len, ++ usedforsecurity); ++ } else { ++ /* Some kind of error happened initializing the global context for ++ this (digest, usedforsecurity) pair. ++ Raise an exception with the saved error message: */ ++ if (cached_info->error_msgs[idx]) { ++ PyErr_SetObject(PyExc_ValueError, cached_info->error_msgs[idx]); ++ } else { ++ PyErr_SetString(PyExc_ValueError, "Error initializing hash"); ++ } + } + ++ if (data_obj) ++ PyBuffer_Release(&view); ++ ++ return ret_obj; ++} ++ + /* a PyMethodDef structure for the constructor */ + #define CONSTRUCTOR_METH_DEF(NAME) \ +- {"openssl_" #NAME, (PyCFunction)EVP_new_ ## NAME, METH_VARARGS, \ ++ {"openssl_" #NAME, (PyCFunction)EVP_new_ ## NAME, \ ++ METH_VARARGS|METH_KEYWORDS, \ + PyDoc_STR("Returns a " #NAME \ + " hash object; optionally initialized with a string") \ + } + +-/* used in the init function to setup a constructor: initialize OpenSSL +- constructor constants if they haven't been initialized already. */ +-#define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ +- if (CONST_ ## NAME ## _name_obj == NULL) { \ +- CONST_ ## NAME ## _name_obj = PyUnicode_FromString(#NAME); \ +- if (EVP_get_digestbyname(#NAME)) { \ +- CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \ +- EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ +- } \ +- } \ ++/* ++ Macro/function pair to set up the constructors. ++ ++ Try to initialize a context for each hash twice, once with ++ EVP_MD_CTX_FLAG_NON_FIPS_ALLOW and once without. ++ ++ Any that have errors during initialization will end up with a NULL ctx_ptrs ++ entry, and err_msgs will be set (unless we're very low on memory) ++*/ ++#define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ ++ init_constructor_constant(&cached_info_ ## NAME, #NAME); \ + } while (0); ++static void ++init_constructor_constant(EVPCachedInfo *cached_info, const char *name) ++{ ++ assert(cached_info); ++ cached_info->name_obj = PyUnicode_FromString(name); ++ if (EVP_get_digestbyname(name)) { ++ int i; ++ for (i=0; i<2; i++) { ++ mc_ctx_init(&cached_info->ctxs[i], i); ++ if (EVP_DigestInit_ex(&cached_info->ctxs[i], ++ EVP_get_digestbyname(name), NULL)) { ++ /* Success: */ ++ cached_info->ctx_ptrs[i] = &cached_info->ctxs[i]; ++ } else { ++ /* Failure: */ ++ cached_info->ctx_ptrs[i] = NULL; ++ cached_info->error_msgs[i] = error_msg_for_last_error(); ++ } ++ } ++ } ++} ++ + + GEN_CONSTRUCTOR(md5) + GEN_CONSTRUCTOR(sha1) +@@ -843,13 +974,10 @@ + { + PyObject *m, *openssl_md_meth_names; + +- OpenSSL_add_all_digests(); +- ERR_load_crypto_strings(); ++ SSL_load_error_strings(); ++ SSL_library_init(); + +- /* TODO build EVP_functions openssl_* entries dynamically based +- * on what hashes are supported rather than listing many +- * but having some be unsupported. Only init appropriate +- * constants. */ ++ OpenSSL_add_all_digests(); + + Py_TYPE(&EVPtype) = &PyType_Type; + if (PyType_Ready(&EVPtype) < 0) diff --git a/python3-3.4.0-more-configuration-flags.patch b/python3-3.4.0-more-configuration-flags.patch new file mode 100644 index 0000000..1067af1 --- /dev/null +++ b/python3-3.4.0-more-configuration-flags.patch @@ -0,0 +1,50 @@ +diff -up Python-3.3.0b1/configure.ac.more-configuration-flags Python-3.3.0b1/configure.ac +--- Python-3.3.0b1/configure.ac.more-configuration-flags 2012-07-20 13:25:33.232864839 -0400 ++++ Python-3.3.0b1/configure.ac 2012-07-20 13:25:33.314863815 -0400 +@@ -2585,6 +2585,30 @@ else AC_MSG_RESULT(no) + fi], + [AC_MSG_RESULT(no)]) + ++AC_MSG_CHECKING(for --with-count-allocs) ++AC_ARG_WITH(count-allocs, ++[ --with(out)count-allocs enable/disable per-type instance accounting], [ ++if test "$withval" != no ++then ++ AC_DEFINE(COUNT_ALLOCS, 1, ++ [Define to keep records of the number of instances of each type]) ++ AC_MSG_RESULT(yes) ++else AC_MSG_RESULT(no) ++fi], ++[AC_MSG_RESULT(no)]) ++ ++AC_MSG_CHECKING(for --with-call-profile) ++AC_ARG_WITH(call-profile, ++[ --with(out)-call-profile enable/disable statistics on function call invocation], [ ++if test "$withval" != no ++then ++ AC_DEFINE(CALL_PROFILE, 1, ++ [Define to keep records on function call invocation]) ++ AC_MSG_RESULT(yes) ++else AC_MSG_RESULT(no) ++fi], ++[AC_MSG_RESULT(no)]) ++ + # Check for Python-specific malloc support + AC_MSG_CHECKING(for --with-pymalloc) + AC_ARG_WITH(pymalloc, +diff -up Python-3.3.0b1/pyconfig.h.in.more-configuration-flags Python-3.3.0b1/pyconfig.h.in +--- Python-3.3.0b1/pyconfig.h.in.more-configuration-flags 2012-07-20 13:25:33.000000000 -0400 ++++ Python-3.3.0b1/pyconfig.h.in 2012-07-20 13:26:02.826494869 -0400 +@@ -12,6 +12,12 @@ + support for AIX C++ shared extension modules. */ + #undef AIX_GENUINE_CPLUSPLUS + ++/* Define to keep records on function call invocation */ ++#undef CALL_PROFILE ++ ++/* Define to keep records of the number of instances of each type */ ++#undef COUNT_ALLOCS ++ + /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM + mixed-endian order (byte order 45670123) */ + #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 diff --git a/python3-3.4.0-no-static-lib.patch b/python3-3.4.0-no-static-lib.patch new file mode 100644 index 0000000..bd1bc40 --- /dev/null +++ b/python3-3.4.0-no-static-lib.patch @@ -0,0 +1,59 @@ +diff -up cpython-59223da36dec/Makefile.pre.in.no-static-lib cpython-59223da36dec/Makefile.pre.in +--- cpython-59223da36dec/Makefile.pre.in.no-static-lib 2012-08-07 16:43:43.296466422 -0400 ++++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:44:13.299464371 -0400 +@@ -464,7 +464,7 @@ coverage: + $(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make + + # Build the interpreter +-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) ++$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) $(PY3LIBRARY) + $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + + platform: $(BUILDPYTHON) pybuilddir.txt +@@ -480,18 +480,6 @@ sharedmods: $(BUILDPYTHON) $(SYSCONFIGDA + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + +-# Build static library +-# avoid long command lines, same as LIBRARY_OBJS +-$(LIBRARY): $(LIBRARY_OBJS) +- -rm -f $@ +- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o +- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) +- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) +- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o +- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS) +- $(AR) $(ARFLAGS) $@ $(MODOBJS) +- $(RANLIB) $@ +- + libpython$(LDVERSION).so: $(LIBRARY_OBJS) + if test $(INSTSONAME) != $(LDLIBRARY); then \ + $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ +@@ -581,7 +569,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.d + echo "-----------------------------------------------"; \ + fi + +-Modules/_testembed: Modules/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) ++Modules/_testembed: Modules/_testembed.o $(LDLIBRARY) $(PY3LIBRARY) + $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + + ############################################################################ +@@ -1155,18 +1143,6 @@ libainstall: all python-config + else true; \ + fi; \ + done +- @if test -d $(LIBRARY); then :; else \ +- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ +- if test "$(SHLIB_SUFFIX)" = .dll; then \ +- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ +- else \ +- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- fi; \ +- else \ +- echo Skip install of $(LIBRARY) - use make frameworkinstall; \ +- fi; \ +- fi + $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c + $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o + $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in diff --git a/python3-3.4.0-skip-distutils-tests-that-fail-in-rpmbuild.patch b/python3-3.4.0-skip-distutils-tests-that-fail-in-rpmbuild.patch new file mode 100644 index 0000000..8a6bc46 --- /dev/null +++ b/python3-3.4.0-skip-distutils-tests-that-fail-in-rpmbuild.patch @@ -0,0 +1,12 @@ +diff -up Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py.skip-distutils-tests-that-fail-in-rpmbuild Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py +--- Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py.skip-distutils-tests-that-fail-in-rpmbuild 2011-09-03 12:16:40.000000000 -0400 ++++ Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py 2011-09-10 05:04:56.328852558 -0400 +@@ -23,6 +23,7 @@ setup(name='foo', version='0.1', py_modu + + """ + ++@unittest._skipInRpmBuild("don't try to nest one rpm build inside another rpm build") + class BuildRpmTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): +diff -up Python-3.2.2/Lib/distutils/tests/test_build_ext.py.skip-distutils-tests-that-fail-in-rpmbuild Python-3.2.2/Lib/distutils/tests/test_build_ext.py diff --git a/python3-3.4.0-uid-gid-overflows.patch b/python3-3.4.0-uid-gid-overflows.patch new file mode 100644 index 0000000..43bd394 --- /dev/null +++ b/python3-3.4.0-uid-gid-overflows.patch @@ -0,0 +1,62 @@ +--- Python-3.4.0b1/Lib/test/test_os.py.orig 2013-11-27 12:07:32.368411798 +0100 ++++ Python-3.4.0b1/Lib/test/test_os.py 2013-11-27 12:12:11.220265174 +0100 +@@ -1319,30 +1319,36 @@ + def test_setuid(self): + if os.getuid() != 0: + self.assertRaises(OSError, os.setuid, 0) ++ self.assertRaises(TypeError, os.setuid, 'not an int') + self.assertRaises(OverflowError, os.setuid, 1<<32) + + @unittest.skipUnless(hasattr(os, 'setgid'), 'test needs os.setgid()') + def test_setgid(self): + if os.getuid() != 0 and not HAVE_WHEEL_GROUP: + self.assertRaises(OSError, os.setgid, 0) ++ self.assertRaises(TypeError, os.setgid, 'not an int') + self.assertRaises(OverflowError, os.setgid, 1<<32) + + @unittest.skipUnless(hasattr(os, 'seteuid'), 'test needs os.seteuid()') + def test_seteuid(self): + if os.getuid() != 0: + self.assertRaises(OSError, os.seteuid, 0) ++ self.assertRaises(TypeError, os.seteuid, 'not an int') + self.assertRaises(OverflowError, os.seteuid, 1<<32) + + @unittest.skipUnless(hasattr(os, 'setegid'), 'test needs os.setegid()') + def test_setegid(self): + if os.getuid() != 0 and not HAVE_WHEEL_GROUP: + self.assertRaises(OSError, os.setegid, 0) ++ self.assertRaises(TypeError, os.setegid, 'not an int') + self.assertRaises(OverflowError, os.setegid, 1<<32) + + @unittest.skipUnless(hasattr(os, 'setreuid'), 'test needs os.setreuid()') + def test_setreuid(self): + if os.getuid() != 0: + self.assertRaises(OSError, os.setreuid, 0, 0) ++ self.assertRaises(TypeError, os.setreuid, 'not an int', 0) ++ self.assertRaises(TypeError, os.setreuid, 0, 'not an int') + self.assertRaises(OverflowError, os.setreuid, 1<<32, 0) + self.assertRaises(OverflowError, os.setreuid, 0, 1<<32) + +@@ -1358,6 +1364,8 @@ + def test_setregid(self): + if os.getuid() != 0 and not HAVE_WHEEL_GROUP: + self.assertRaises(OSError, os.setregid, 0, 0) ++ self.assertRaises(TypeError, os.setregid, 'not an int', 0) ++ self.assertRaises(TypeError, os.setregid, 0, 'not an int') + self.assertRaises(OverflowError, os.setregid, 1<<32, 0) + self.assertRaises(OverflowError, os.setregid, 0, 1<<32) + +--- Python-3.4.0b1/Lib/test/test_pwd.py.orig 2013-11-24 21:36:55.000000000 +0100 ++++ Python-3.4.0b1/Lib/test/test_pwd.py 2013-11-27 12:07:32.369411798 +0100 +@@ -89,9 +89,9 @@ + # In some cases, byuids isn't a complete list of all users in the + # system, so if we try to pick a value not in byuids (via a perturbing + # loop, say), pwd.getpwuid() might still be able to find data for that +- # uid. Using sys.maxint may provoke the same problems, but hopefully ++ # uid. Using 2**32 - 2 may provoke the same problems, but hopefully + # it will be a more repeatable failure. +- fakeuid = sys.maxsize ++ fakeuid = 2**32 - 2 + self.assertNotIn(fakeuid, byuids) + self.assertRaises(KeyError, pwd.getpwuid, fakeuid) + diff --git a/python3.spec b/python3.spec index ca07a9f..577a7bf 100644 --- a/python3.spec +++ b/python3.spec @@ -1,76 +1,109 @@ -%define docver 3.4.0 +%define docver 3.4.1 %define dirver 3.4 %define familyver 3 -%define lib_major %{dirver} -%define lib_name_orig libpython%{familyver} -%define lib_name %mklibname python %{lib_major} -%define develname %mklibname python3 -d +%define lib_major %{dirver} +%define lib_name_orig libpython%{familyver} +%define lib_name %mklibname python %{lib_major} +%define develname %mklibname python3 -d %ifarch %{ix86} x86_64 ppc -%bcond_without valgrind +%bcond_without valgrind %else -%bcond_with valgrind +%bcond_with valgrind %endif -Summary: An interpreted, interactive object-oriented programming language -Name: python3 -Version: 3.4.1 -Release: 2 -License: Modified CNRI Open Source License -Group: Development/Python -Source: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz -Source1: http://www.python.org/ftp/python/doc/%{docver}/python-%{docver}-docs-html.tar.bz2 -Source2: python3.macros -Source3: pybytecompile.macros +%define with_rewheel 0 + +# We want to byte-compile the .py files within the packages using the new +# python3 binary. +# +# Unfortunately, rpmbuild's infrastructure requires us to jump through some +# hoops to avoid byte-compiling with the system python 2 version: +# /usr/lib/rpm/mageia/macros sets up build policy that (amongst other things) +# defines __os_install_post. In particular, "brp-python-bytecompile" is +# invoked without an argument thus using the wrong version of python +# (/usr/bin/python, rather than the freshly built python), thus leading to +# numerous syntax errors, and incorrect magic numbers in the .pyc files. We +# thus remove the invocation of brp-python-bytecompile, whilst keeping the +# invocation of brp-python-hardlink (since this should still work for python3 +# pyc/pyo files) +%define _python_bytecompile_build 0 + + +Summary: An interpreted, interactive object-oriented programming language +Name: python3 +Version: 3.4.1 +Release: 3 +License: Modified CNRI Open Source License +Group: Development/Python + +Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz +Source1: https://docs.python.org/3/archives/python-%{docver}-docs-html.tar.bz2 +Source2: python3.macros +Source3: pybytecompile.macros Source100: %{name}.rpmlintrc -Source5: bdist_rpm5.py -Patch0: python-3.3.0-module-linkage.patch -Patch1: python3-3.3.0-fdr-lib64.patch -Patch2: python3-3.2.3-fdr-lib64-fix-for-test_install.patch -Patch3: Python-select-requires-libm.patch -Patch4: python-3.3.0b1-test-posix_fadvise.patch -Patch5: Python-nis-requires-tirpc.patch - -Patch153: 00153-fix-test_gdb-noise.patch -Patch156: 00156-gdb-autoload-safepath.patch -# 00173 # -# Workaround for ENOPROTOOPT seen in bs within -# test.test_support.bind_port() -# from Fedora (rhbz#913732) -Patch173: 00173-workaround-ENOPROTOOPT-in-bind_port.patch -Patch179: 00179-dont-raise-error-on-gdb-corrupted-frames-in-backtrace.patch - -URL: http://www.python.org/ -Conflicts: tkinter3 < %{version} -Conflicts: %{lib_name}-devel < 3.1.2-4 -Conflicts: %{develname} < 3.2.2-3 -Requires: %{lib_name} = %{version} -BuildRequires: blt -BuildRequires: db-devel -BuildRequires: pkgconfig(expat) -BuildRequires: gdbm-devel -BuildRequires: gmp-devel -BuildRequires: pkgconfig(ncursesw) -BuildRequires: pkgconfig(openssl) -BuildRequires: readline-devel -BuildRequires: tcl tcl-devel -BuildRequires: tk tk-devel -BuildRequires: autoconf -BuildRequires: bzip2-devel -BuildRequires: pkgconfig(sqlite3) -BuildRequires: pkgconfig(libtirpc) -# uncomment once the emacs part no longer conflict with python 2.X -#BuildRequires: emacs -#BuildRequires: emacs-bin -%if %{with valgrind} -BuildRequires: valgrind-devel +Patch0: python-3.3.0-module-linkage.patch +Patch1: python3-3.4.0-fdr-lib64.patch +Patch2: python3-3.4.0-fdr-lib64-fix-for-test_install.patch +Patch3: python3-3.4.0-no-static-lib.patch +Patch4: python3-3.4.0-more-configuration-flags.patch +Patch5: python3-3.4.0-disable-tests-in-test_io.patch +Patch6: python3-3.4.0-add-rpmbuild-hooks-to-unittest.patch +Patch7: python3-3.4.0-skip-distutils-tests-that-fail-in-rpmbuild.patch +Patch8: python3-3.4.0-hashlib-fips.patch +Patch9: python3-3.4.0-fix-test_gdb-noise.patch +Patch10: python3-3.4.0-uid-gid-overflows.patch +Patch11: python3-3.4.0-disable-test_fs_holes-in-rpm-build.patch +Patch12: python3-3.4.0-disable-parts-of-test_socket-in-rpm-build.patch +Patch13: python3-3.4.0-dont-duplicate-flags-in-sysconfig.patch +Patch14: python3-3.4.0-ctypes-should-build-with-libffi-multilib-wrapper.patch +Patch15: python3-3.4.0-dont-raise-from-py_compile.patch +%if 0%{with_rewheel} +Patch16: python3-3.4.0-add-rewheel-module.patch %endif -Provides: %{name} = %{version} -Provides: python(abi) = %{dirver} -Provides: /usr/bin/python%{dirver}mu +# http://bugs.python.org/issue21121 +Patch17: python3-3.4.0-dont-add-Werror-declaration-after-statement.patch +Patch18: python3-3.4.0-disable-tests-in-test_urllib2_localnet.patch +Patch19: Python-nis-requires-tirpc.patch +Patch20: Python-select-requires-libm.patch +URL: http://www.python.org/ +Conflicts: tkinter3 < %{version} +Conflicts: %{lib_name}-devel < 3.4 +Conflicts: %{develname} < 3.4 +Requires: %{lib_name} = %{version} +BuildRequires: automake +BuildRequires: gcc-c++ +BuildRequires: blt +BuildRequires: db-devel +BuildRequires: expat-devel +BuildRequires: gdbm-devel +BuildRequires: gmp-devel +BuildRequires: ffi-devel +BuildRequires: ncursesw-devel +BuildRequires: openssl-devel +BuildRequires: readline-devel +BuildRequires: termcap-devel +BuildRequires: tcl tcl-devel +BuildRequires: tk tk-devel +BuildRequires: autoconf +BuildRequires: bzip2-devel +BuildRequires: sqlite3-devel +# uncomment once the emacs part no longer conflict with python 2.X +#BuildRequires: emacs +#BuildRequires: emacs-bin +%if %{with valgrind} +BuildRequires: valgrind-devel +%endif +%if 0%{?with_rewheel} +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%endif +Provides: python(abi) = %{dirver} +Provides: /usr/bin/python%{dirver}m +Provides: /usr/bin/python%{dirver} %description Python is an interpreted, interactive, object-oriented programming @@ -89,26 +122,26 @@ Tix widget set for Tk and RPM. Note that documentation for Python is provided in the python-docs package. -%package -n %{lib_name} -Summary: Shared libraries for Python %{version} -Group: System/Libraries +%package -n %{lib_name} +Summary: Shared libraries for Python %{version} +Group: System/Libraries -%description -n %{lib_name} +%description -n %{lib_name} This packages contains Python shared object library. Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. -%package -n %{develname} -Summary: The libraries and header files needed for Python development -Group: Development/Python -Requires: %{name} = %{version} -Requires: %{lib_name} = %{version} -Provides: %{name}-devel = %{version}-%{release} -Provides: %{lib_name_orig}-devel = %{version}-%{release} -Obsoletes: %{_lib}python3.1-devel < %{version} -Obsoletes: %{_lib}python3.2-devel < %{version}-%{release} +%package -n %{develname} +Summary: The libraries and header files needed for Python development +Group: Development/Python +Requires: %{name} = %{version} +Requires: %{lib_name} = %{version} +Provides: %{name}-devel = %{version}-%{release} +Provides: %{lib_name_orig}-devel = %{version}-%{release} +Obsoletes: %{_lib}python3.1-devel < %{version} +Obsoletes: %{_lib}python3.2-devel < %{version}-%{release} -%description -n %{develname} +%description -n %{develname} The Python programming language's interpreter can be extended with dynamically loaded extensions and can be embedded in other programs. This package contains the header files and libraries needed to do @@ -119,14 +152,14 @@ python package will also need to be installed. You'll probably also want to install the python-docs package, which contains Python documentation. -%package docs -Summary: Documentation for the Python programming language -Group: Development/Python -Requires: %{name} = %{version} -Requires: xdg-utils -BuildArch: noarch +%package docs +Summary: Documentation for the Python programming language +Requires: %{name} = %{version} +Requires: xdg-utils +Group: Development/Python +BuildArch: noarch -%description docs +%description docs The python-docs package contains documentation on the Python programming language and interpreter. The documentation is provided in ASCII text files and in LaTeX source files. @@ -134,42 +167,63 @@ in ASCII text files and in LaTeX source files. Install the python-docs package if you'd like to use the documentation for the Python language. -%package -n tkinter3 -Summary: A graphical user interface for the Python scripting language -Group: Development/Python -Requires: %{name} = %{version} -Requires: tcl tk +%package -n tkinter3 +Summary: A graphical user interface for the Python scripting language +Group: Development/Python +Requires: %{name} = %{version} +Requires: tcl tk +Provides: python3-tkinter -%description -n tkinter3 +%description -n tkinter3 The Tkinter (Tk interface) program is an graphical user interface for the Python scripting language. You should install the tkinter package if you'd like to use a graphical user interface for Python programming. -%package -n tkinter3-apps -Summary: Various applications written using tkinter -Group: Development/Python -Requires: tkinter3 +%package -n tkinter3-apps +Summary: Various applications written using tkinter +Group: Development/Python +Requires: tkinter3 -%description -n tkinter3-apps +%description -n tkinter3-apps Various applications written using tkinter + %prep %setup -qn Python-%{version} -%patch0 -p0 -b .link~ +%patch0 -p0 -b .link %if "%{_lib}" == "lib64" -%patch1 -p1 -b .lib64~ -%patch2 -p1 -b .p2~ +%patch1 -p1 -b .lib64 +%patch2 -p1 %endif -%patch3 -p1 -b .lm~ -%patch4 -p1 -b .p4~ -%patch5 -p1 -b .tirpc~ -%patch153 -p1 -b .p153~ -%patch156 -p1 -b .p156~ -%patch173 -p1 -b .p173~ -%patch179 -p1 -b .p179~ + +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p0 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 + +%if 0%{with_rewheel} +%patch16 -p1 +%endif + +%patch17 -p1 +%patch18 -p0 +%patch19 -p1 -b .tirpc~ +%patch20 -p1 -b .lm~ + +# drop Autoconf version requirement +sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac # docs mkdir html @@ -177,15 +231,6 @@ bzcat %{SOURCE1} | tar x -C html find . -type f -print0 | xargs -0 perl -p -i -e 's@/usr/local/bin/python@/usr/bin/python3@' -cat > README.urpmi << EOF -Python interpreter support readline completion by default. -This is only used with the interpreter. In order to remove it, -you can : -1) unset PYTHONSTARTUP when you login -2) create a empty file \$HOME/.pythonrc.py -3) change %{_sysconfdir}/pythonrc.py -EOF - %build rm -f Modules/Setup.local @@ -197,28 +242,26 @@ export CFLAGS="%{optflags} -I/usr/include/ncursesw" export CPPFLAGS="%{optflags} -I/usr/include/ncursesw" autoreconf -vfi -%configure2_5x --with-threads \ - --enable-ipv6 \ - --with-wide-unicode \ - --with-dbmliborder=gdbm \ - --enable-shared \ +# Remove -Wl,--no-undefined in accordance with MGA #9395 : +# https://bugs.mageia.org/show_bug.cgi?id=9395 +%define _disable_ld_no_undefined 1 +%configure2_5x --with-threads \ + --enable-ipv6 \ + --with-dbmliborder=gdbm \ + --with-system-expat \ + --with-system-ffi \ + --enable-shared \ + --without-ensurepip \ %if %{with valgrind} - --with-valgrind + --with-valgrind %endif # fix build #perl -pi -e 's/^(LDFLAGS=.*)/$1 -lstdc++/' Makefile # (misc) if the home is nfs mounted, rmdir fails due to delay export TMP="/tmp" TMPDIR="/tmp" -make LN="ln -sf" - -%check -# (misc) if the home is nfs mounted, rmdir fails -export TMP="/tmp" TMPDIR="/tmp" - -# Currently (3.3.0-1), LOTS of tests fail, but python3 seems to work -# quite fine anyway. Chances are something in the testsuite itself is bogus. -#make test TESTOPTS="-w -x test_linuxaudiodev -x test_nis -x test_shutil -x test_pyexpat -x test_minidom -x test_sax -x test_string -x test_str -x test_unicode -x test_userstring -x test_bytes -x test_distutils -x test_mailbox -x test_ioctl -x test_telnetlib -x test_strtod -x test_urllib2net -x test_runpy -x test_posix -x test_robotparser -x test_numeric_tower -x test_math -x test_cmath -x test_importlib -x test_import -x test_float -x test_strtod -x test_timeout" +#%make LN="ln -sf" +make EXTRA_CFLAGS="$CFLAGS" LN="ln -sf" %install mkdir -p %{buildroot}%{_prefix}/lib/python%{dirver} @@ -228,30 +271,23 @@ perl -pi -e "/^CC=/ and s/distcc/gcc/" Makefile # set the install path echo '[install_scripts]' >setup.cfg -echo 'install_dir='"%{buildroot}%{_bindir}" >>setup.cfg +echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg # python is not GNU and does not know fsstd mkdir -p %{buildroot}%{_mandir} %makeinstall_std LN="ln -sf" +# overwrite the copied binary with a link +pushd %{buildroot}%{_bindir} +ln -sf python%{dirver}m python%{dirver} +ln -sf python%{dirver} python%{familyver} +popd + (cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so) # fix files conflicting with python2.6 -mv %{buildroot}%{_bindir}/2to3 %{buildroot}%{_bindir}/python3-2to3 +mv %{buildroot}/%{_bindir}/2to3 %{buildroot}/%{_bindir}/python3-2to3 -# conflicts with python2 -# # emacs, I use it, I want it -# mkdir -p %{buildroot}%{_datadir}/emacs/site-lisp -# install -m 644 Misc/python-mode.el %{buildroot}%{_datadir}/emacs/site-lisp -# emacs -batch -f batch-byte-compile %{buildroot}%{_datadir}/emacs/site-lisp/python-mode.el -# -# install -d %{buildroot}%{_sysconfdir}/emacs/site-start.d -# cat <%{buildroot}%{_sysconfdir}/emacs/site-start.d/%{name}.el -# (setq auto-mode-alist (cons '("\\\\.py$" . python-mode) auto-mode-alist)) -# (autoload 'python-mode "python-mode" "Mode for python files." t) -# EOF - -#" this comment is just here because vim syntax higlighting is confused by the previous snippet of lisp # install pynche as pynche3 cat << EOF > %{buildroot}%{_bindir}/pynche3 @@ -273,9 +309,7 @@ mkdir -p %{buildroot}%{_datadir}/applications cat > %{buildroot}%{_datadir}/applications/rosa-tkinter3.desktop << EOF [Desktop Entry] Name=IDLE -Name[ru]=IDLE Comment=IDE for Python3 -Comment[ru]=IDE для Python3 Exec=%{_bindir}/idle3 Icon=development_environment_section Terminal=false @@ -287,10 +321,8 @@ EOF cat > %{buildroot}%{_datadir}/applications/rosa-%{name}-docs.desktop << EOF [Desktop Entry] Name=Python documentation -Name[ru]=Документация Python Comment=Python complete reference -Comment[ru]=Полная документация Python -Exec=%{_bindir}/xdg-open %{_defaultdocdir}/%{name}-docs/index.html +Exec=%{_bindir}/xdg-open %_defaultdocdir/%{name}-docs/index.html Icon=documentation_section Terminal=false Type=Application @@ -305,69 +337,35 @@ find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" - chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 %{buildroot}%{_libdir}/libpython3.so -mkdir -p %{buildroot}%{_sysconfdir}/profile.d/ - -cat > %{buildroot}%{_sysconfdir}/profile.d/30python.sh << 'EOF' -if [ -f $HOME/.pythonrc.py ] ; then - export PYTHONSTARTUP=$HOME/.pythonrc.py -else - export PYTHONSTARTUP=/etc/pythonrc.py -fi - -export PYTHONDONTWRITEBYTECODE=1 -EOF - -cat > %{buildroot}%{_sysconfdir}/profile.d/30python.csh << 'EOF' -if ( -f ${HOME}/.pythonrc.py ) then - setenv PYTHONSTARTUP ${HOME}/.pythonrc.py -else - setenv PYTHONSTARTUP /etc/pythonrc.py -endif -setenv PYTHONDONTWRITEBYTECODE 1 -EOF - -cat > %{buildroot}%{_sysconfdir}/pythonrc.py << EOF -try: - # this add completion to python interpreter - import readline - import rlcompleter - # see readline man page for this - readline.parse_and_bind("set show-all-if-ambiguous on") - readline.parse_and_bind("tab: complete") -except: - pass -# you can place a file .pythonrc.py in your home to overrides this one -# but then, this file will not be sourced -EOF - %multiarch_includes %{buildroot}/usr/include/python*/pyconfig.h mkdir -p %{buildroot}%{_sysconfdir}/rpm/macros.d install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.d/ +install -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/rpm/macros.d/ -install -m644 %{SOURCE5} -D %{buildroot}%{_libdir}/python%{dirver}/distutils/command/bdist_rpm5.py + +%check +# (misc) if the home is nfs mounted, rmdir fails +export TMP="/tmp" TMPDIR="/tmp" + +# all tests must pass +# but we disable network on BS +#WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u none -x $EXCLUDE" +# consider use network on local build +#WITHIN_PYTHON_RPM_BUILD= make test TESTOPTS="-u network -x $EXCLUDE" %files -%doc README.urpmi -# conflicts with python2.6 -#%config(noreplace) %{_sysconfdir}/emacs/site-start.d/%{name}.el %{_sysconfdir}/rpm/macros.d/*.macros -%{_sysconfdir}/profile.d/* -%config(noreplace) %{_sysconfdir}/pythonrc.py %{_includedir}/python*/pyconfig.h -%{multiarch_includedir}/python*/pyconfig.h - -%dir %{_libdir}/python*/config-* +%multiarch_includedir/python*/pyconfig.h %{_libdir}/python*/config*/Makefile %exclude %{_libdir}/python*/site-packages/pynche %exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so -# HACK: build fails without this (TODO: investigate rpm) %dir %{_libdir}/python* %{_libdir}/python*/LICENSE.txt %{_libdir}/python%{dirver}/*.py %{_libdir}/python%{dirver}/__pycache__ -%{_libdir}/python%{dirver}/asyncio %{_libdir}/python%{dirver}/collections %{_libdir}/python%{dirver}/concurrent %{_libdir}/python%{dirver}/ctypes @@ -376,7 +374,6 @@ install -m644 %{SOURCE5} -D %{buildroot}%{_libdir}/python%{dirver}/distutils/com %{_libdir}/python%{dirver}/distutils %{_libdir}/python%{dirver}/email %{_libdir}/python%{dirver}/encodings -%{_libdir}/python%{dirver}/ensurepip %{_libdir}/python%{dirver}/html %{_libdir}/python%{dirver}/http %{_libdir}/python%{dirver}/importlib @@ -396,10 +393,17 @@ install -m644 %{SOURCE5} -D %{buildroot}%{_libdir}/python%{dirver}/distutils/com %{_libdir}/python%{dirver}/wsgiref* %{_libdir}/python%{dirver}/xml %{_libdir}/python%{dirver}/xmlrpc +%{_libdir}/python%{dirver}/asyncio +%{_libdir}/python%{dirver}/ensurepip +# %exclude %{_libdir}/python%{dirver}/ensurepip/_bundled +%if 0%{?with_rewheel} +%dir %{_libdir}/python%{dirver}/ensurepip/rewheel/ +%{_libdir}/python%{dirver}/ensurepip/rewheel/*.py +%{_libdir}/python%{dirver}/ensurepip/rewheel/__pycache__/ +%endif %{_bindir}/pydoc3* %{_bindir}/python3* -%{_bindir}/pyvenv -%{_bindir}/pyvenv-%{dirver} +%{_bindir}/pyvenv* %{_bindir}/2to3-%{dirver} %exclude %{_bindir}/python*config #%{_datadir}/emacs/site-lisp/* @@ -407,23 +411,6 @@ install -m644 %{SOURCE5} -D %{buildroot}%{_libdir}/python%{dirver}/distutils/com %if %{with valgrind} %{_libdir}/valgrind/valgrind-python3.supp %endif -# pip bits -%if "%{_libdir}" != "%{_prefix}/lib" -# In the %{_libdir} == %{_prefix}/lib case, those are caught by -# globs above. -%dir %{_prefix}/lib/python%{dirver} -%dir %{_prefix}/lib/python%{dirver}/site-packages -%{_prefix}/lib/python%{dirver}/site-packages/__pycache__ -%{_prefix}/lib/python%{dirver}/site-packages/pkg_resources.py -%{_prefix}/lib/python%{dirver}/site-packages/easy_install.py -%{_prefix}/lib/python%{dirver}/site-packages/pip -# %{_prefix}/lib/python%{dirver}/site-packages/setuptools* -%{_prefix}/lib/python%{dirver}/site-packages/_markerlib -%{_prefix}/lib/python%{dirver}/site-packages/pip-*.dist-info -%endif -%{_bindir}/easy_install-%{dirver} -%{_bindir}/pip3 -%{_bindir}/pip%{dirver} %files -n %{lib_name} %{_libdir}/libpython*.so.1* @@ -453,3 +440,6 @@ install -m644 %{SOURCE5} -D %{buildroot}%{_libdir}/python%{dirver}/distutils/com %{_bindir}/idle3* %{_bindir}/pynche3 %{_datadir}/applications/rosa-tkinter3.desktop + + +