From 26f62305fe07f9429bb6f4dc47d8749d7bd8ca7f Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 10 Jul 2012 16:45:52 -0400 Subject: [PATCH] 1.9-3 * Tue Jul 10 2012 David Malcolm - 1.9-3 - log all output from "make" (patch 6) - disable the MOTD at startup (patch 7) - hide symbols from the dynamic linker (patch 8) - add PyInt_AsUnsignedLongLongMask (patch 9) - capture the Makefile, the typeids.txt, and the dynamic-symbols file within the debuginfo package --- 006-always-log-stdout.patch | 11 ++++ 007-remove-startup-message.patch | 21 ++++++ 008-fix-dynamic-symbols-script.patch | 15 +++++ 009-add-PyInt_AsUnsignedLongLongMask.patch | 48 ++++++++++++++ pypy.spec | 76 ++++++++++++++++++++-- 5 files changed, 164 insertions(+), 7 deletions(-) create mode 100644 006-always-log-stdout.patch create mode 100644 007-remove-startup-message.patch create mode 100644 008-fix-dynamic-symbols-script.patch create mode 100644 009-add-PyInt_AsUnsignedLongLongMask.patch diff --git a/006-always-log-stdout.patch b/006-always-log-stdout.patch new file mode 100644 index 0000000..2df1f00 --- /dev/null +++ b/006-always-log-stdout.patch @@ -0,0 +1,11 @@ +--- pypy-pypy-341e1e3821ff/pypy/translator/platform/__init__.py.always_log_stdout 2012-07-06 11:13:46.878979461 -0400 ++++ pypy-pypy-341e1e3821ff/pypy/translator/platform/__init__.py 2012-07-06 11:25:26.281235732 -0400 +@@ -126,6 +126,8 @@ class Platform(object): + self._handle_error(returncode, stdout, stderr, outname) + + def _handle_error(self, returncode, stdout, stderr, outname): ++ for line in stdout.splitlines(): ++ log.message(line) + if returncode != 0: + errorfile = outname.new(ext='errors') + errorfile.write(stderr, 'wb') diff --git a/007-remove-startup-message.patch b/007-remove-startup-message.patch new file mode 100644 index 0000000..e05586b --- /dev/null +++ b/007-remove-startup-message.patch @@ -0,0 +1,21 @@ +--- pypy-pypy-341e1e3821ff/lib_pypy/_pypy_interact.py.remove_startup_message 2012-07-06 12:10:46.504228264 -0400 ++++ pypy-pypy-341e1e3821ff/lib_pypy/_pypy_interact.py 2012-07-06 12:11:01.986034714 -0400 +@@ -13,18 +13,6 @@ def interactive_console(mainmodule=None) + sys.ps2 = '.... ' + # + try: +- from _pypy_irc_topic import some_topic +- text = "And now for something completely different: ``%s''" % ( +- some_topic(),) +- while len(text) >= 80: +- i = text[:80].rfind(' ') +- print text[:i] +- text = text[i+1:] +- print text +- except ImportError: +- pass +- # +- try: + if not os.isatty(sys.stdin.fileno()): + # Bail out if stdin is not tty-like, as pyrepl wouldn't be happy + # For example, with: diff --git a/008-fix-dynamic-symbols-script.patch b/008-fix-dynamic-symbols-script.patch new file mode 100644 index 0000000..5b1d551 --- /dev/null +++ b/008-fix-dynamic-symbols-script.patch @@ -0,0 +1,15 @@ +diff --git a/pypy/translator/platform/posix.py b/pypy/translator/platform/posix.py +--- a/pypy/translator/platform/posix.py ++++ b/pypy/translator/platform/posix.py +@@ -48,8 +48,10 @@ + response_file = self._make_response_file("dynamic-symbols-") + f = response_file.open("w") + f.write("{\n") ++ f.write(" global:\n") + for sym in eci.export_symbols: +- f.write("%s;\n" % (sym,)) ++ f.write(" %s;\n" % (sym,)) ++ f.write(" local:*;\n") + f.write("};") + f.close() + diff --git a/009-add-PyInt_AsUnsignedLongLongMask.patch b/009-add-PyInt_AsUnsignedLongLongMask.patch new file mode 100644 index 0000000..dae7e16 --- /dev/null +++ b/009-add-PyInt_AsUnsignedLongLongMask.patch @@ -0,0 +1,48 @@ +diff --git a/pypy/module/cpyext/intobject.py b/pypy/module/cpyext/intobject.py +--- a/pypy/module/cpyext/intobject.py ++++ b/pypy/module/cpyext/intobject.py +@@ -6,7 +6,7 @@ + PyObject, PyObjectFields, CONST_STRING, CANNOT_FAIL, Py_ssize_t) + from pypy.module.cpyext.pyobject import ( + make_typedescr, track_reference, RefcountState, from_ref) +-from pypy.rlib.rarithmetic import r_uint, intmask, LONG_TEST ++from pypy.rlib.rarithmetic import r_uint, intmask, LONG_TEST, r_ulonglong + from pypy.objspace.std.intobject import W_IntObject + import sys + +@@ -83,6 +83,20 @@ + num = space.bigint_w(w_int) + return num.uintmask() + ++@cpython_api([PyObject], rffi.ULONGLONG, error=-1) ++def PyInt_AsUnsignedLongLongMask(space, w_obj): ++ """Will first attempt to cast the object to a PyIntObject or ++ PyLongObject, if it is not already one, and then return its value as ++ unsigned long long, without checking for overflow. ++ """ ++ w_int = space.int(w_obj) ++ if space.is_true(space.isinstance(w_int, space.w_int)): ++ num = space.int_w(w_int) ++ return r_ulonglong(num) ++ else: ++ num = space.bigint_w(w_int) ++ return num.ulonglongmask() ++ + @cpython_api([PyObject], lltype.Signed, error=CANNOT_FAIL) + def PyInt_AS_LONG(space, w_int): + """Return the value of the object w_int. No error checking is performed.""" +diff --git a/pypy/module/cpyext/test/test_intobject.py b/pypy/module/cpyext/test/test_intobject.py +--- a/pypy/module/cpyext/test/test_intobject.py ++++ b/pypy/module/cpyext/test/test_intobject.py +@@ -34,6 +34,11 @@ + assert (api.PyInt_AsUnsignedLongMask(space.wrap(10**30)) + == 10**30 % ((sys.maxint + 1) * 2)) + ++ assert (api.PyInt_AsUnsignedLongLongMask(space.wrap(sys.maxint)) ++ == sys.maxint) ++ assert (api.PyInt_AsUnsignedLongLongMask(space.wrap(10**30)) ++ == 10**30 % (2**64)) ++ + def test_coerce(self, space, api): + class Coerce(object): + def __int__(self): diff --git a/pypy.spec b/pypy.spec index e579720..2ed932b 100644 --- a/pypy.spec +++ b/pypy.spec @@ -1,6 +1,6 @@ Name: pypy Version: 1.9 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python implementation with a Just-In-Time compiler Group: Development/Languages @@ -164,6 +164,39 @@ Patch4: more-readable-c-code.patch # Not yet sent upstream Patch5: pypy-1.6-fix-test-subprocess-with-nonreadable-path-dir.patch +# Patch pypy.translator.platform so that stdout from "make" etc gets logged, +# rather than just stderr, so that the command-line invocations of the compiler +# and linker are captured: +Patch6: 006-always-log-stdout.patch + +# Disable the printing of a quote from IRC on startup (these are stored in +# ROT13 form in lib_pypy/_pypy_irc_topic.py). Some are cute, but some could +# cause confusion for end-users (and many are in-jokes within the PyPy +# community that won't make sense outside of it). [Sorry to be a killjoy] +Patch7: 007-remove-startup-message.patch + +# With pypy-1.9-1.fc17.x86_64, the pypy binary exposes about 200k symbols to +# the dynamic linker: +# $ eu-readelf -s $(which pypy) | head +# Symbol table [ 5] '.dynsym' contains 194163 entries: +# which is far more than necessary. +# Fix the version script for the linker as invoked thus in the Makefile: +# "-Wl,--export-dynamic,--version-script=../dynamic-symbols-6" +# so that it contains a "local: *;" clause, thus hiding the bulk of the +# symbols from the dynamic linker. +# Ideally we'd add: +# __attribute__ ((visibility ("hidden"))) +# to most symbols, allowing the compiler to potentially generate better code. +# Not yet reported upstream +Patch8: 008-fix-dynamic-symbols-script.patch + + +# Cherrypick upstream patch to add PyInt_AsUnsignedLongLongMask (used by +# the rpm python bindings); see https://bugs.pypy.org/issue1211 +# This is https://bitbucket.org/pypy/pypy/changeset/542d481517d3 +Patch9: 009-add-PyInt_AsUnsignedLongLongMask.patch + + # Build-time requirements: # pypy's can be rebuilt using itself, rather than with CPython; doing so @@ -358,6 +391,11 @@ Build of PyPy with support for micro-threads for massive concurrency # [translation:ERROR] AttributeError: 'Block' object has no attribute 'isstartblock' %patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 + # Replace /usr/local/bin/python shebangs with /usr/bin/python: find -name "*.py" -exec \ @@ -696,15 +734,31 @@ mkdir -p %{buildroot}%{pypy_debuginfo_dir} # copy over everything: cp -a pypy %{buildroot}%{pypy_debuginfo_dir} -# ...then delete files that aren't .py files: +# ...then delete files that aren't: +# - *.py files +# - the Makefile +# - typeids.txt +# - dynamic-symbols-* find \ - %{buildroot}%{pypy_debuginfo_dir} \ - \( -type f \ - -a \ - \! -name "*.py" \ - \) \ + %{buildroot}%{pypy_debuginfo_dir} \ + \( -type f \ + -a \ + \! \( -name "*.py" \ + -o \ + -name "Makefile" \ + -o \ + -name "typeids.txt" \ + -o \ + -name "dynamic-symbols-*" \ + \) \ + \) \ -delete +# Alternatively, we could simply keep everything. This leads to a ~350MB +# debuginfo package, but it makes it easy to hack on the Makefile and C build +# flags by rebuilding/linking the sources. +# To do so, remove the above "find" command. + # We don't need bytecode for these files; they are being included for reference # purposes. # There are some rpmlint warnings from these files: @@ -890,6 +944,14 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Jul 10 2012 David Malcolm - 1.9-3 +- log all output from "make" (patch 6) +- disable the MOTD at startup (patch 7) +- hide symbols from the dynamic linker (patch 8) +- add PyInt_AsUnsignedLongLongMask (patch 9) +- capture the Makefile, the typeids.txt, and the dynamic-symbols file within +the debuginfo package + * Mon Jun 18 2012 Peter Robinson - 1.9-2 - Compile with PIC, fixes FTBFS on ARM