Hello,

Samuel Thibault, le ven. 20 juil. 2018 09:39:26 +0200, a ecrit:
> Samuel Thibault, le ven. 20 juil. 2018 09:36:28 +0200, a ecrit:
> > Samuel Thibault, le jeu. 19 juil. 2018 10:24:20 +0200, a ecrit:
> > > pypy is becoming more and more a dependence for a lot of packages. I
> > > have worked on the hurd port, here is the patch I have come up with and
> > > submitted to https://bitbucket.org/pypy/pypy/issues/2848/gnu-hurd-port
> > 
> > Upstream has commited it.
> > 
> > Could you upload these three patches to Debian so we can get all the
> > rdeps of pypy fixed?
> 
> Here is the upstream version of the "hurd" patch.

I have uploaded the upstream fixes, as attached to this mail, to DELAYED/5

Samuel
diff -Nru pypy-6.0.0+dfsg/debian/changelog pypy-6.0.0+dfsg/debian/changelog
--- pypy-6.0.0+dfsg/debian/changelog    2018-04-27 23:16:57.000000000 +0200
+++ pypy-6.0.0+dfsg/debian/changelog    2018-08-14 00:02:40.000000000 +0200
@@ -1,3 +1,13 @@
+pypy (6.0.0+dfsg-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * patches/hurd-fix1: Upstream fix for hurd-i386.
+  * patches/hurd-fix2: Upstream fix for hurd-i386.
+  * patches/hurd: Upstream support for hurd-i386 (Closes: #904076)
+  * control: Add hurd-any architecture.
+
+ -- Samuel Thibault <sthiba...@debian.org>  Tue, 14 Aug 2018 00:02:40 +0200
+
 pypy (6.0.0+dfsg-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru pypy-6.0.0+dfsg/debian/control pypy-6.0.0+dfsg/debian/control
--- pypy-6.0.0+dfsg/debian/control      2018-04-27 23:16:57.000000000 +0200
+++ pypy-6.0.0+dfsg/debian/control      2018-08-14 00:02:40.000000000 +0200
@@ -34,7 +34,7 @@
 Rules-Requires-Root: no
 
 Package: pypy
-Architecture: kfreebsd-any linux-any
+Architecture: hurd-any kfreebsd-any linux-any
 Depends: pypy-lib (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends}
 Breaks: pypy-dev (<< ${source:Version})
 Provides: ${pypy-abi}
@@ -56,7 +56,7 @@
  This package contains the PyPy interpreter.
 
 Package: pypy-tk
-Architecture: kfreebsd-any linux-any
+Architecture: hurd-any kfreebsd-any linux-any
 Depends: pypy (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends}
 Replaces: pypy-lib (<< 2.2)
 Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends}
@@ -68,7 +68,7 @@
  (2.7).
 
 Package: pypy-lib
-Architecture: kfreebsd-any linux-any
+Architecture: hurd-any kfreebsd-any linux-any
 Multi-Arch: same
 Depends: ${misc:Depends}
 Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends}
diff -Nru pypy-6.0.0+dfsg/debian/patches/hurd 
pypy-6.0.0+dfsg/debian/patches/hurd
--- pypy-6.0.0+dfsg/debian/patches/hurd 1970-01-01 01:00:00.000000000 +0100
+++ pypy-6.0.0+dfsg/debian/patches/hurd 2018-08-13 23:48:59.000000000 +0200
@@ -0,0 +1,122 @@
+# HG changeset patch
+# User Armin Rigo <ar...@tunes.org>
+# Date 1532071553 -7200
+#      Fri Jul 20 09:25:53 2018 +0200
+# Node ID 2ca5d2f3a174ec02ebf49f889aee1efe1922d71a
+# Parent  587bebd539604208eb416ccdeb05e841db74e0aa
+Issue #2848
+
+Patch for GNU Hurd.
+
+diff -r 587bebd53960 -r 2ca5d2f3a174 
pypy/module/_multiprocessing/interp_semaphore.py
+--- a/pypy/module/_multiprocessing/interp_semaphore.py Wed Jul 18 22:47:52 
2018 +0200
++++ b/pypy/module/_multiprocessing/interp_semaphore.py Fri Jul 20 09:25:53 
2018 +0200
+@@ -57,7 +57,7 @@
+         TIMESPEC = platform.Struct('struct timespec', [('tv_sec', 
rffi.TIME_T),
+                                                        ('tv_nsec', 
rffi.LONG)])
+         SEM_FAILED = platform.ConstantInteger('SEM_FAILED')
+-        SEM_VALUE_MAX = platform.ConstantInteger('SEM_VALUE_MAX')
++        SEM_VALUE_MAX = platform.DefinedConstantInteger('SEM_VALUE_MAX')
+         SEM_TIMED_WAIT = platform.Has('sem_timedwait')
+         SEM_T_SIZE = platform.SizeOf('sem_t')
+ 
+@@ -70,6 +70,8 @@
+     #                rffi.cast(SEM_T, config['SEM_FAILED'])
+     SEM_FAILED     = config['SEM_FAILED']
+     SEM_VALUE_MAX  = config['SEM_VALUE_MAX']
++    if SEM_VALUE_MAX is None:      # on Hurd
++        SEM_VALUE_MAX = sys.maxint
+     SEM_TIMED_WAIT = config['SEM_TIMED_WAIT']
+     SEM_T_SIZE = config['SEM_T_SIZE']
+     if sys.platform == 'darwin':
+diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/jit/backend/detect_cpu.py
+--- a/rpython/jit/backend/detect_cpu.py        Wed Jul 18 22:47:52 2018 +0200
++++ b/rpython/jit/backend/detect_cpu.py        Fri Jul 20 09:25:53 2018 +0200
+@@ -57,6 +57,7 @@
+             'i486': MODEL_X86,
+             'i586': MODEL_X86,
+             'i686': MODEL_X86,
++            'i686-AT386': MODEL_X86,  # Hurd
+             'i86pc': MODEL_X86,    # Solaris/Intel
+             'x86': MODEL_X86,      # Apple
+             'Power Macintosh': MODEL_PPC_64,
+diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/rlib/rposix.py
+--- a/rpython/rlib/rposix.py   Wed Jul 18 22:47:52 2018 +0200
++++ b/rpython/rlib/rposix.py   Fri Jul 20 09:25:53 2018 +0200
+@@ -1086,9 +1086,12 @@
+         else:
+             return bool(c_func(status))
+ 
+-WAIT_MACROS = ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
++WAIT_MACROS = ['WCOREDUMP', 'WIFSTOPPED',
+                'WIFSIGNALED', 'WIFEXITED',
+                'WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG']
++if not sys.platform.startswith('gnu'):
++    WAIT_MACROS.append('WIFCONTINUED')
++
+ for name in WAIT_MACROS:
+     _make_waitmacro(name)
+ 
+diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/translator/platform/__init__.py
+--- a/rpython/translator/platform/__init__.py  Wed Jul 18 22:47:52 2018 +0200
++++ b/rpython/translator/platform/__init__.py  Fri Jul 20 09:25:53 2018 +0200
+@@ -308,6 +308,13 @@
+         host_factory = OpenBSD
+     else:
+         host_factory = OpenBSD_64
++elif sys.platform.startswith('gnu'):
++    from rpython.translator.platform.hurd import Hurd
++    import platform
++    if platform.architecture()[0] == '32bit':
++        host_factory = Hurd
++    else:
++        host_factory = Hurd_64
+ elif os.name == 'nt':
+     from rpython.translator.platform.windows import Windows, Windows_x64
+     import platform
+diff -r 587bebd53960 -r 2ca5d2f3a174 rpython/translator/platform/hurd.py
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ b/rpython/translator/platform/hurd.py      Fri Jul 20 09:25:53 2018 +0200
+@@ -0,0 +1,42 @@
++"""Support for Hurd."""
++
++import os
++import platform
++import sys
++from rpython.translator.platform.posix import BasePosix
++
++class BaseHurd(BasePosix):
++    name = "hurd"
++
++    link_flags = tuple(
++                 ['-pthread',]
++                 + os.environ.get('LDFLAGS', '').split())
++    extra_libs = ('-lrt',)
++    cflags = tuple(
++             ['-O3', '-pthread', '-fomit-frame-pointer',
++              '-Wall', '-Wno-unused', '-Wno-address']
++             + os.environ.get('CFLAGS', '').split())
++    standalone_only = ()
++    shared_only = ('-fPIC',)
++    so_ext = 'so'
++
++    def _args_for_shared(self, args, **kwds):
++        return ['-shared'] + args
++
++    def _include_dirs_for_libffi(self):
++        return self._pkg_config("libffi", "--cflags-only-I",
++                                ['/usr/include/libffi'],
++                                check_result_dir=True)
++
++    def _library_dirs_for_libffi(self):
++        return self._pkg_config("libffi", "--libs-only-L",
++                                ['/usr/lib/libffi'],
++                                check_result_dir=True)
++
++
++class Hurd(BaseHurd):
++    shared_only = () # it seems that on 32-bit GNU, compiling with -fPIC
++                     # gives assembler that asmgcc is not happy about.
++
++class HurdPIC(BaseHurd):
++    pass
diff -Nru pypy-6.0.0+dfsg/debian/patches/hurd-fix1 
pypy-6.0.0+dfsg/debian/patches/hurd-fix1
--- pypy-6.0.0+dfsg/debian/patches/hurd-fix1    1970-01-01 01:00:00.000000000 
+0100
+++ pypy-6.0.0+dfsg/debian/patches/hurd-fix1    2018-08-13 23:49:35.000000000 
+0200
@@ -0,0 +1,17 @@
+# HG changeset patch
+# User Armin Rigo <ar...@tunes.org>
+# Date 1530647130 -7200
+#      Tue Jul 03 21:45:30 2018 +0200
+# Node ID 60d37209763ded4f11bfdb86d7e1700109b9ce8e
+# Parent  55061f499bd529fa3efa23e47c77c22133884d99
+Fix rvmprof/dummy: stop_sampling() is supposed to return an integer, not None
+
+diff -r 55061f499bd5 -r 60d37209763d rpython/rlib/rvmprof/dummy.py
+--- a/rpython/rlib/rvmprof/dummy.py    Sun Jul 01 22:39:13 2018 +0200
++++ b/rpython/rlib/rvmprof/dummy.py    Tue Jul 03 21:45:30 2018 +0200
+@@ -23,4 +23,4 @@
+         pass
+ 
+     def stop_sampling(self):
+-        pass
++        return -1
diff -Nru pypy-6.0.0+dfsg/debian/patches/hurd-fix2 
pypy-6.0.0+dfsg/debian/patches/hurd-fix2
--- pypy-6.0.0+dfsg/debian/patches/hurd-fix2    1970-01-01 01:00:00.000000000 
+0100
+++ pypy-6.0.0+dfsg/debian/patches/hurd-fix2    2018-08-13 23:49:38.000000000 
+0200
@@ -0,0 +1,80 @@
+# HG changeset patch
+# User Armin Rigo <ar...@tunes.org>
+# Date 1531903611 -7200
+#      Wed Jul 18 10:46:51 2018 +0200
+# Node ID 0ee5333ce97ea580ca99c024fec9afd96b7e0db4
+# Parent  94d4f08d6056245f7615d019d24d2469e8c3ee6f
+rvmprof.dummy is not really working, at least for pypy.  Try to fix it some 
more,
+but give up for now.  Instead, robustly detect that vmprof is not supported 
from
+pypyoption and disable the '_vmprof' and 'faulthandler' modules.
+
+diff -r 94d4f08d6056 -r 0ee5333ce97e pypy/config/pypyoption.py
+--- a/pypy/config/pypyoption.py        Tue Jul 17 12:32:16 2018 +0200
++++ b/pypy/config/pypyoption.py        Wed Jul 18 10:46:51 2018 +0200
+@@ -39,14 +39,10 @@
+     "_csv", "_cppyy", "_pypyjson", "_jitlog"
+ ])
+ 
+-from rpython.jit.backend import detect_cpu
+-try:
+-    if detect_cpu.autodetect().startswith('x86'):
+-        if not sys.platform.startswith('openbsd'):
+-            working_modules.add('_vmprof')
+-            working_modules.add('faulthandler')
+-except detect_cpu.ProcessorAutodetectError:
+-    pass
++import rpython.rlib.rvmprof.cintf
++if rpython.rlib.rvmprof.cintf.IS_SUPPORTED:
++    working_modules.add('_vmprof')
++    working_modules.add('faulthandler')
+ 
+ translation_modules = default_modules.copy()
+ translation_modules.update([
+@@ -318,3 +314,4 @@
+     parser = to_optparse(config) #, useoptions=["translation.*"])
+     option, args = parser.parse_args()
+     print config
++    print working_modules
+diff -r 94d4f08d6056 -r 0ee5333ce97e rpython/rlib/rvmprof/dummy.py
+--- a/rpython/rlib/rvmprof/dummy.py    Tue Jul 17 12:32:16 2018 +0200
++++ b/rpython/rlib/rvmprof/dummy.py    Wed Jul 18 10:46:51 2018 +0200
+@@ -1,6 +1,7 @@
+ from rpython.rlib.objectmodel import specialize
+ 
+ class DummyVMProf(object):
++    is_enabled = False
+ 
+     def __init__(self):
+         self._unique_id = 0
+diff -r 94d4f08d6056 -r 0ee5333ce97e rpython/rlib/rvmprof/rvmprof.py
+--- a/rpython/rlib/rvmprof/rvmprof.py  Tue Jul 17 12:32:16 2018 +0200
++++ b/rpython/rlib/rvmprof/rvmprof.py  Wed Jul 18 10:46:51 2018 +0200
+@@ -23,6 +23,7 @@
+ VMPROF_GC_TAG = 5
+ 
+ class VMProfError(Exception):
++    msg = ''   # annotation hack
+     def __init__(self, msg):
+         self.msg = msg
+     def __str__(self):
+diff -r 94d4f08d6056 -r 0ee5333ce97e rpython/rlib/rvmprof/traceback.py
+--- a/rpython/rlib/rvmprof/traceback.py        Tue Jul 17 12:32:16 2018 +0200
++++ b/rpython/rlib/rvmprof/traceback.py        Wed Jul 18 10:46:51 2018 +0200
+@@ -13,6 +13,8 @@
+     array_length).  The caller must free array_p.  Not for signal handlers:
+     for these, call vmprof_get_traceback() from C code.
+     """
++    if not cintf.IS_SUPPORTED:
++        return (None, 0)
+     _cintf = rvmprof._get_vmprof().cintf
+     size = estimate_number_of_entries * 2 + 4
+     stack = cintf.get_rvmprof_stack()
+@@ -47,6 +49,8 @@
+     'code_obj' may be None if it can't be determined.  'loc' is one
+     of the LOC_xxx constants.
+     """
++    if not cintf.IS_SUPPORTED:
++        return
+     i = 0
+     while i < array_length - 1:
+         tag = array_p[i]
diff -Nru pypy-6.0.0+dfsg/debian/patches/series 
pypy-6.0.0+dfsg/debian/patches/series
--- pypy-6.0.0+dfsg/debian/patches/series       2018-04-27 23:16:57.000000000 
+0200
+++ pypy-6.0.0+dfsg/debian/patches/series       2018-08-13 23:50:06.000000000 
+0200
@@ -21,3 +21,6 @@
 tkinter-import
 noise
 dots-stackcheck
+hurd-fix1
+hurd-fix2
+hurd

Reply via email to