Package: python2.6
Version: 2.6.4-3
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

currently[1] (log referring to 2.6.4-2, but same error on -3) python2.6 does
not build on GNU/Hurd.

The attached patches hopefully make it compiling:
- hurd-broken-poll.dpatch:
  ported from python 2.5, as it seems to have been forgotten
- hurd-disable-nonworking-constants.dpatch:
  this disables from the public API few constant whose C counterparts are not
  implemented, so using them either always blocks or always fails (this caused
  issues in the test suite)
- debian.diff:
  * excludes the profiled build for hurd
  * disables four blocking tests from the test suite
  * adds the two dpatch'es above

[1] 
http://buildd.debian-ports.org/fetch.php?&pkg=python2.6&ver=2.6.4-2&arch=hurd-i386&stamp=1263649759&file=log&as=raw

Thanks,
-- 
Pino
#! /bin/sh -e

# DP: Fix build failure on hurd, working around poll() on systems
# DP: on which it returns an error on invalid FDs.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
        exit 1
esac
exit 0

--- Modules/selectmodule.c.orig
+++ Modules/selectmodule.c
@@ -1723,7 +1723,7 @@
 
 static PyMethodDef select_methods[] = {
 	{"select",	select_select,	METH_VARARGS,	select_doc},
-#ifdef HAVE_POLL
+#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
 	{"poll",	select_poll,	METH_NOARGS,	poll_doc},
 #endif /* HAVE_POLL */
 	{0,  	0},	/* sentinel */
@@ -1747,7 +1747,7 @@
 	Py_INCREF(SelectError);
 	PyModule_AddObject(m, "error", SelectError);
 
-#if defined(HAVE_POLL)
+#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
 #ifdef __APPLE__
 	if (select_have_broken_poll()) {
 		if (PyObject_DelAttrString(m, "poll") == -1) {
#! /bin/sh -e

# DP: Comment out constant exposed on the API which are not implemented on
# DP: GNU/Hurd. They would not work at runtime anyway.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
        exit 1
esac
exit 0

--- Modules/posixmodule.c.orig
+++ Modules/posixmodule.c
@@ -8854,12 +8854,14 @@
 #ifdef O_LARGEFILE
         if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1;
 #endif
+#ifndef __GNU__
 #ifdef O_SHLOCK
         if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1;
 #endif
 #ifdef O_EXLOCK
         if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1;
 #endif
+#endif
 
 /* MS Windows */
 #ifdef O_NOINHERIT
--- Modules/socketmodule.c.orig
+++ Modules/socketmodule.c
@@ -4680,9 +4680,11 @@
 #ifdef	SO_OOBINLINE
 	PyModule_AddIntConstant(m, "SO_OOBINLINE", SO_OOBINLINE);
 #endif
+#ifndef __GNU__
 #ifdef	SO_REUSEPORT
 	PyModule_AddIntConstant(m, "SO_REUSEPORT", SO_REUSEPORT);
 #endif
+#endif
 #ifdef	SO_SNDBUF
 	PyModule_AddIntConstant(m, "SO_SNDBUF", SO_SNDBUF);
 #endif
--- a/debian/rules
+++ b/debian/rules
@@ -134,7 +134,7 @@
 d_dbg  := debian/$(p_dbg)
 
 # profiled build fails on amd64, lpia, sparc
-ifneq (,$(filter $(DEB_BUILD_ARCH), amd64 armel i386 ia64 lpia mips mipsel 
s390 sparc))
+ifneq (,$(filter $(DEB_BUILD_ARCH), amd64 armel i386 ia64 lpia mips mipsel 
s390 sparc hurd-i386))
   make_build_target =
 else
   make_build_target = profile-opt
@@ -344,6 +344,9 @@
     TEST_EXCLUDES += test_compiler
   endif
 endif
+ifneq (,$(filter $(DEB_BUILD_ARCH), hurd-i386))
+  TEST_EXCLUDES += test_random test_signal test_ssl test_threading
+endif
 ifneq (,$(TEST_EXCLUDES))
   TESTOPTS += -x $(sort $(TEST_EXCLUDES))
 endif
@@ -981,6 +984,8 @@
        bdist-wininst-notfound \
        setup-modules-ssl \
        makesetup-bashism \
+       hurd-broken-poll \
+       hurd-disable-nonworking-constants \
 
 #      setup-modules \
 #      profiled-build \

Reply via email to