Bug#904076: pypy: hurd support

2018-08-19 Thread Samuel Thibault
Stefano Rivera, le sam. 18 août 2018 16:43:08 -0700, a ecrit:
> Hi Samuel (2018.08.15_08:08:44_-0700)
> > Thanks! I'll supersede that with an upload that bundles in a bunch of
> > other things I need to do.
> 
> Uploaded. It needs to be bootstrapped (as it currently B-Ds on pypy on
> any-i386). Would you do that?

I'm doing it, yes.

Thanks!
Samuel



Bug#904076: pypy: hurd support

2018-08-18 Thread Stefano Rivera
Hi Samuel (2018.08.15_08:08:44_-0700)
> Thanks! I'll supersede that with an upload that bundles in a bunch of
> other things I need to do.

Uploaded. It needs to be bootstrapped (as it currently B-Ds on pypy on
any-i386). Would you do that? Or should I upload a -3 with kfreebsd-i386
and i386 for now?

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272



Bug#904076: pypy: hurd support

2018-08-15 Thread Samuel Thibault
Hello,

Stefano Rivera, le mer. 15 août 2018 17:08:44 +0200, a ecrit:
> I didn't see any patch here adding platform data (DLFCN, CDROM, IN,
> TYPES). See for example
> https://bitbucket.org/pypy/pypy/src/29eab8b5cf205d791413edeee6ada18dde0cfe1f/lib-python/2.7/plat-linux2/?at=default
> 
> Interestingly, I don't see this in our cpython package, either:
> https://sources.debian.org/src/python2.7/2.7.15-3/debian/patches/
> 
> They aren't widely used, I guess nobody noticed?

For most things plat-generic/ is probably enough.

Samuel



Bug#904076: pypy: hurd support

2018-08-15 Thread Stefano Rivera
Hi Samuel (2018.08.14_13:21:14_+0200)
> > > 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

Thanks! I'll supersede that with an upload that bundles in a bunch of
other things I need to do.

I didn't see any patch here adding platform data (DLFCN, CDROM, IN,
TYPES). See for example
https://bitbucket.org/pypy/pypy/src/29eab8b5cf205d791413edeee6ada18dde0cfe1f/lib-python/2.7/plat-linux2/?at=default

Interestingly, I don't see this in our cpython package, either:
https://sources.debian.org/src/python2.7/2.7.15-3/debian/patches/

They aren't widely used, I guess nobody noticed?

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272



Bug#904076: pypy: hurd support

2018-08-14 Thread Samuel Thibault
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/changelog2018-04-27 23:16:57.0 +0200
+++ pypy-6.0.0+dfsg/debian/changelog2018-08-14 00:02:40.0 +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   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.0 +0200
+++ pypy-6.0.0+dfsg/debian/control  2018-08-14 00:02:40.0 +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.0 +0100
+++ pypy-6.0.0+dfsg/debian/patches/hurd 2018-08-13 23:48:59.0 +0200
@@ -0,0 +1,122 @@
+# HG changeset patch
+# User Armin Rigo 
+# 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.pyWed Jul 18 22:47:52 2018 +0200
 b/rpython/jit/backend/detect_cpu.pyFri 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', 

Bug#904076: pypy: hurd support

2018-07-20 Thread Samuel Thibault
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.

Samuel
# HG changeset patch
# User Armin Rigo 
# 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.pyWed Jul 18 22:47:52 2018 +0200
+++ b/rpython/rlib/rposix.pyFri 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 +
+++ 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'],
+

Bug#904076: pypy: hurd support

2018-07-20 Thread Samuel Thibault
Hello,

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?

Thanks,
Samuel



Bug#904076: pypy: hurd support

2018-07-19 Thread Samuel Thibault
Source: pypy
Version: 6.0.0+dfsg-1
Severity: important
Tags: patch upstream
Forwarded: https://bitbucket.org/pypy/pypy/issues/2848/gnu-hurd-port
User: debian-h...@lists.debian.org
User-tags: hurd

Hello,

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
There were a couple of issues which were fixed upstream, I have also
attached the patches.

Samuel

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'stable-debug'), (500, 'oldoldstable'), (500, 
'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 
'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.17.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Samuel
Now, it we had this sort of thing:
  yield -a for yield to all traffic
  yield -t for yield to trucks
  yield -f for yield to people walking (yield foot)
  yield -d t*  for yield on days starting with t
...you'd have a lot of dead people at intersections, and traffic jams you
wouldn't believe...
(Discussion in comp.os.linux.misc on the intuitiveness of commands.)
Index: pypy-6.0.0+dfsg/rpython/translator/platform/__init__.py
===
--- pypy-6.0.0+dfsg.orig/rpython/translator/platform/__init__.py
+++ pypy-6.0.0+dfsg/rpython/translator/platform/__init__.py
@@ -310,6 +310,13 @@ elif "openbsd" in sys.platform:
 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
Index: pypy-6.0.0+dfsg/rpython/translator/platform/hurd.py
===
--- /dev/null
+++ pypy-6.0.0+dfsg/rpython/translator/platform/hurd.py
@@ -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
Index: pypy-6.0.0+dfsg/rpython/rlib/rposix.py
===
--- pypy-6.0.0+dfsg.orig/rpython/rlib/rposix.py
+++ pypy-6.0.0+dfsg/rpython/rlib/rposix.py
@@ -1086,9 +1086,12 @@ def _make_waitmacro(name):
 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)
 
Index: pypy-6.0.0+dfsg/rpython/jit/backend/detect_cpu.py
===
--- pypy-6.0.0+dfsg.orig/rpython/jit/backend/detect_cpu.py
+++ pypy-6.0.0+dfsg/rpython/jit/backend/detect_cpu.py
@@ -57,6 +57,7 @@ def detect_model_from_host_platform():
 'i486': MODEL_X86,
 'i586': MODEL_X86,
 'i686': MODEL_X86,
+'i686-AT386': MODEL_X86,
 'i86pc': MODEL_X86,# Solaris/Intel
 'x86': MODEL_X86,  # Apple
 'Power