Package: python2.7
Version: 2.7.3-rc2
Severity: Wishlist
User: [email protected]
Usertags: multiarch

I have made a start on backporting mattias python3.3 multiarch support
to python2.7.

This was a bit tricky as there were a lot of other changes to do with
cross-building, file renaming and making things co-installable (I
think), as well as 2.7->3.3 difference and I tried to keep this patch
down to just the part needed to add the lib* packages to make the
necessary parts of python co-installable/foreign. (I'll do another for
the cross-building aspects in due course).

I've run out of time to quite make this work as I'm off on hols for
three weeks, so am filing this in case anyone else is enthused in the
meantime. 

It all builds, but there is still at least one bug in the rules file
moving everything about into final locations/names.

I did fail to grok exactly how some of the 3.3 differences related to
2.7 so this could easily have something missing.

Anyway, hope it's useful.

The current build fails as follows, which will be some incorrect path or other:
dh_installdirs -ppython2.7-dbg \
                usr/bin \
                usr/share/man/man1 \
                usr/share/doc/python2.7
cp -p Misc/SpecialBuilds.txt debian/python2.7-dbg/usr/share/doc/python2.7/
cp -p debian/python2.7-dbg.README.Debian \
                debian/python2.7-dbg/usr/share/doc/python2.7/README.debug
cp -p 
/home/wookey/linaro/multiarch/packages/python2.7-2.7.3~rc2/build-debug/python 
debian/python2.7-dbg/usr/bin/python2.7-dbg
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python2.7-dbg\1,' \
                debian/tmp-dbg/usr/bin/python2.7-config \
                > debian/python2.7-dbg/usr/bin/python2.7-dbg-config
chmod 755 debian/python2.7-dbg/usr/bin/python2.7-dbg-config
cp -p 
/home/wookey/linaro/multiarch/packages/python2.7-2.7.3~rc2/build-debug/build/lib*/*_d.so
 \
                debian/python2.7-dbg/usr/lib/python2.7/lib-dynload/
cp: target `debian/python2.7-dbg/usr/lib/python2.7/lib-dynload/' is not a 
directory
make: *** [stamps/stamp-install] Error 1
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2


Wookey
-- 
Principal hats:  Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/
diff -urN python2.7-2.7.3~rc2.orig/debian/changelog python2.7-2.7.3~rc2/debian/changelog
--- python2.7-2.7.3~rc2.orig/debian/changelog	2012-08-01 14:19:27.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/changelog	2012-07-31 03:46:48.000000000 +0100
@@ -1,3 +1,9 @@
+python2.7 (2.7.3~rc2-3) UNRELEASED; urgency=low
+
+  * Backport multiarch changes from 3.3
+
+ -- Wookey <[email protected]>  Tue, 31 Jul 2012 03:46:17 +0100
+
 python2.7 (2.7.3~rc2-2.1) unstable; urgency=low
 
   * Non-maintainer upload (with maintainer's permission).
diff -urN python2.7-2.7.3~rc2.orig/debian/control python2.7-2.7.3~rc2/debian/control
--- python2.7-2.7.3~rc2.orig/debian/control	2012-08-01 14:19:27.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/control	2012-07-31 03:49:18.000000000 +0100
@@ -23,9 +23,8 @@
 Package: python2.7
 Architecture: any
 Priority: optional
-Depends: python2.7-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Depends: python2.7-minimal (= ${binary:Version}), libpython2.7-stdlib (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
 Suggests: python2.7-doc, binutils
-Provides: python2.7-cjkcodecs, python2.7-ctypes, python2.7-elementtree, python2.7-celementtree, python2.7-wsgiref, python2.7-profiler, python2.7-argparse, python-argparse
 Conflicts: python-profiler (<= 2.7.1-2)
 Replaces: python-profiler (<= 2.7.1-2)
 Description: Interactive high-level object-oriented language (version 2.7)
@@ -33,10 +32,27 @@
  includes an extensive class library with lots of goodies for
  network programming, system administration, sounds and graphics.
 
+Package: libpython2.7-stdlib
+Architecture: any
+Multi-Arch: same
+Priority: optional
+Pre-Depends: multiarch-support
+Depends: libpython2.7-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Suggests: python2.7-profiler
+Provides: python2.7-cjkcodecs, python2.7-ctypes, python2.7-elementtree, python2.7-celementtree, python2.7-wsgiref, python2.7-profiler, python2.7-argparse, python-argparse
+Replaces: python2.7 (<< 2.7-2.7.3~rc2-3~)
+Description: Interactive high-level object-oriented language (version 2.7)
+ Version 2.7 of the high-level, interactive object oriented language,
+ includes an extensive class library with lots of goodies for
+ network programming, system administration, sounds and graphics.
+ .
+ This package contains the standard library. It is normally not
+ used on it's own, but as a dependency of python2.7.
+
 Package: python2.7-minimal
 Architecture: any
 Priority: optional
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: libpython2.7-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Recommends: python2.7
 Suggests: binfmt-support
 Replaces: python2.7 (<< 2.7.1~rc1-2~)
@@ -47,11 +63,26 @@
  See /usr/share/doc/python2.7-minimal/README.Debian for a list of the modules
  contained in this package.
 
+Package: libpython2.7-minimal
+Architecture: any
+Multi-Arch: same
+Priority: optional
+Pre-Depends: multiarch-support
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libpython2.7-stdlib
+Replaces: python2.7 (<< 2.7.1~rc1-2~), python2.7-minimal (<< 2.7-2.7.3~rc2-3~)
+Conflicts: binfmt-support (<< 1.1.2)
+Description: Minimal subset of the Python language (version 2.7)
+ This package contains some essential modules. It is normally not
+ used on it's own, but as a dependency of python2.7-minimal.
+
 Package: libpython2.7
 Architecture: any
+Multi-Arch: same
 Section: libs
 Priority: optional
-Depends: python2.7 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Pre-Depends: multiarch-support
+Depends: libpython2.7-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Replaces: python2.7 (<< 2.6)
 Description: Shared Python runtime library (version 2.7)
  Version 2.7 of the high-level, interactive object oriented language,
@@ -70,7 +101,7 @@
 
 Package: python2.7-dev
 Architecture: any
-Depends: python2.7 (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
+Depends: python2.7 (= ${binary:Version}), libpython2.7-dev (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
 Recommends: libc6-dev | libc-dev
 Replaces: python2.7 (<< 2.7-3)
 Description: Header files and a static library for Python (v2.7)
@@ -80,6 +111,24 @@
  .
  Maintainers of Python packages should read README.maintainers.
 
+Package: libpython2.7-dev
+Section: libdevel
+Architecture: any
+Multi-Arch: same
+Pre-Depends: multiarch-support
+Depends: libpython2.7-stdlib (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libssl-dev, libexpat1-dev, ${shlibs:Depends}, ${misc:Depends}
+Replaces: python2.7 (<< 2.7-3), python2.7-dev (<< 2.7-2.7.3~rc2-3~), python2.7-minimal (<< 2.7-2.7.3~rc2-3~)
+Recommends: libc6-dev | libc-dev
+Description: Header files and a static library for Python (v2.7)
+ Header files, a static library and development tools for building
+ Python (v2.7) modules, extending the Python interpreter or embedding
+ Python (v2.7) in applications.
+ .
+ Maintainers of Python packages should read README.maintainers.
+ .
+ This package contains development files. It is normally not
+ used on it's own, but as a dependency of python2.7-dev.
+
 Package: idle-python2.7
 Architecture: all
 Depends: python2.7, python-tk (>= 2.6~a3), python2.7-tk, ${misc:Depends}
@@ -114,7 +163,7 @@
 Section: debug
 Architecture: any
 Priority: extra
-Depends: python2.7 (>= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends: python2.7 (= ${binary:Version}), libpython2.7-dbg (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Suggests: python-gdbm-dbg, python-tk-dbg
 Description: Debug Build of the Python Interpreter (version 2.7)
  Python interpreter configured with --pydebug. Dynamically loaded modules are
diff -urN python2.7-2.7.3~rc2.orig/debian/control.in python2.7-2.7.3~rc2/debian/control.in
--- python2.7-2.7.3~rc2.orig/debian/control.in	2012-08-01 14:19:27.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/control.in	2012-07-31 01:42:15.000000000 +0100
@@ -23,9 +23,8 @@
 Package: @PVER@
 Architecture: any
 Priority: @PRIO@
-Depends: @PVER@-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Depends: @PVER@-minimal (= ${binary:Version}), lib@PVER@-stdlib (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
 Suggests: @PVER@-doc, binutils
-Provides: @PVER@-cjkcodecs, @PVER@-ctypes, @PVER@-elementtree, @PVER@-celementtree, @PVER@-wsgiref, @PVER@-profiler, @PVER@-argparse, python-argparse
 Conflicts: python-profiler (<= 2.7.1-2)
 Replaces: python-profiler (<= 2.7.1-2)
 Description: Interactive high-level object-oriented language (version @VER@)
@@ -33,10 +32,27 @@
  includes an extensive class library with lots of goodies for
  network programming, system administration, sounds and graphics.
 
+Package: lib@PVER@-stdlib
+Architecture: any
+Multi-Arch: same
+Priority: @PRIO@
+Pre-Depends: multiarch-support
+Depends: lib@PVER@-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Suggests: @PVER@-profiler
+Provides: @PVER@-cjkcodecs, @PVER@-ctypes, @PVER@-elementtree, @PVER@-celementtree, @PVER@-wsgiref, @PVER@-profiler, @PVER@-argparse, python-argparse
+Replaces: @PVER@ (<< 2.7-2.7.3~rc2-3~)
+Description: Interactive high-level object-oriented language (version @VER@)
+ Version @VER@ of the high-level, interactive object oriented language,
+ includes an extensive class library with lots of goodies for
+ network programming, system administration, sounds and graphics.
+ .
+ This package contains the standard library. It is normally not
+ used on it's own, but as a dependency of @PVER@.
+
 Package: @PVER@-minimal
 Architecture: any
 Priority: @MINPRIO@
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: lib@PVER@-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Recommends: @PVER@
 Suggests: binfmt-support
 Replaces: @PVER@ (<< 2.7.1~rc1-2~)
@@ -47,11 +63,26 @@
  See /usr/share/doc/@PVER@-minimal/README.Debian for a list of the modules
  contained in this package.
 
+Package: lib@PVER@-minimal
+Architecture: any
+Multi-Arch: same
+Priority: @MINPRIO@
+Pre-Depends: multiarch-support
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: lib@PVER@-stdlib
+Replaces: @PVER@ (<< 2.7.1~rc1-2~), @PVER@-minimal (<< 2.7-2.7.3~rc2-3~)
+Conflicts: binfmt-support (<< 1.1.2)
+Description: Minimal subset of the Python language (version @VER@)
+ This package contains some essential modules. It is normally not
+ used on it's own, but as a dependency of @PVER@-minimal.
+
 Package: lib@PVER@
 Architecture: any
+Multi-Arch: same
 Section: libs
-Priority: optional
-Depends: @PVER@ (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Priority: @PRIO@
+Pre-Depends: multiarch-support
+Depends: lib@PVER@-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Replaces: @PVER@ (<< 2.6)
 Description: Shared Python runtime library (version @VER@)
  Version @VER@ of the high-level, interactive object oriented language,
@@ -70,7 +101,7 @@
 
 Package: @PVER@-dev
 Architecture: any
-Depends: @PVER@ (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
+Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dev (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
 Recommends: libc6-dev | libc-dev
 Replaces: @PVER@ (<< 2.7-3)
 Description: Header files and a static library for Python (v@VER@)
@@ -80,6 +111,24 @@
  .
  Maintainers of Python packages should read README.maintainers.
 
+Package: lib@PVER@-dev
+Section: libdevel
+Architecture: any
+Multi-Arch: same
+Pre-Depends: multiarch-support
+Depends: lib@PVER@-stdlib (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libssl-dev, libexpat1-dev, ${shlibs:Depends}, ${misc:Depends}
+Replaces: @PVER@ (<< 2.7-3), @PVER@-dev (<< 2.7-2.7.3~rc2-3~), @PVER@-minimal (<< 2.7-2.7.3~rc2-3~)
+Recommends: libc6-dev | libc-dev
+Description: Header files and a static library for Python (v@VER@)
+ Header files, a static library and development tools for building
+ Python (v@VER@) modules, extending the Python interpreter or embedding
+ Python (v@VER@) in applications.
+ .
+ Maintainers of Python packages should read README.maintainers.
+ .
+ This package contains development files. It is normally not
+ used on it's own, but as a dependency of @PVER@-dev.
+
 Package: idle-@PVER@
 Architecture: all
 Depends: @PVER@, python-tk (>= 2.6~a3), @PVER@-tk, ${misc:Depends}
@@ -114,7 +163,7 @@
 Section: debug
 Architecture: any
 Priority: extra
-Depends: @PVER@ (>= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dbg (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Suggests: python-gdbm-dbg, python-tk-dbg
 Description: Debug Build of the Python Interpreter (version @VER@)
  Python interpreter configured with --pydebug. Dynamically loaded modules are
diff -urN python2.7-2.7.3~rc2.orig/debian/libPVER-dbg.symbols.in python2.7-2.7.3~rc2/debian/libPVER-dbg.symbols.in
--- python2.7-2.7.3~rc2.orig/debian/libPVER-dbg.symbols.in	1970-01-01 01:00:00.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/libPVER-dbg.symbols.in	2012-07-31 01:48:21.000000000 +0100
@@ -0,0 +1,38 @@
+libpython@[email protected] libpython@VER@-dbg #MINVER#
+#include "libpython.symbols"
+ _PyDict_Dummy@Base @VER@
+ _PyMem_DebugFree@Base @VER@
+ _PyMem_DebugMalloc@Base @VER@
+ _PyMem_DebugRealloc@Base @VER@
+ _PyObject_DebugCheckAddress@Base @VER@
+ _PyObject_DebugCheckAddressApi@Base @VER@
+ _PyObject_DebugDumpAddress@Base @VER@
+ _PyObject_DebugFree@Base @VER@
+ _PyObject_DebugFreeApi@Base @VER@
+ _PyObject_DebugMalloc@Base @VER@
+ _PyObject_DebugMallocApi@Base @VER@
+ _PyObject_DebugMallocStats@Base @VER@
+ _PyObject_DebugRealloc@Base @VER@
+ _PyObject_DebugReallocApi@Base @VER@
+ _PySet_Dummy@Base @VER@
+ _PyUnicode_CheckConsistency@Base @VER@
+ _PyUnicode_Dump@Base @VER@
+ _PyUnicode_compact_data@Base @VER@
+ _PyUnicode_data@Base @VER@
+ _PyUnicode_utf8@Base @VER@
+ _Py_AddToAllObjects@Base @VER@
+ _Py_Dealloc@Base @VER@
+ _Py_ForgetReference@Base @VER@
+ _Py_GetObjects@Base @VER@
+ _Py_GetRefTotal@Base @VER@
+ _Py_HashSecret_Initialized@Base @VER@
+ _Py_NegativeRefcount@Base @VER@
+ _Py_NewReference@Base @VER@
+ _Py_PrintReferenceAddresses@Base @VER@
+ _Py_PrintReferences@Base @VER@
+ _Py_RefTotal@Base @VER@
+ _Py_dumptree@Base @VER@
+ _Py_printtree@Base @VER@
+ _Py_showtree@Base @VER@
+ _Py_tok_dump@Base @VER@
+ PyModule_Create2TraceRefs@Base @VER@
diff -urN python2.7-2.7.3~rc2.orig/debian/libPVER-dev.overrides.in python2.7-2.7.3~rc2/debian/libPVER-dev.overrides.in
--- python2.7-2.7.3~rc2.orig/debian/libPVER-dev.overrides.in	1970-01-01 01:00:00.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/libPVER-dev.overrides.in	2012-07-15 01:09:15.000000000 +0100
@@ -0,0 +1 @@
+lib@PVER@-dev binary: python-script-but-no-python-dep
diff -urN python2.7-2.7.3~rc2.orig/debian/libPVER-minimal.overrides.in python2.7-2.7.3~rc2/debian/libPVER-minimal.overrides.in
--- python2.7-2.7.3~rc2.orig/debian/libPVER-minimal.overrides.in	1970-01-01 01:00:00.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/libPVER-minimal.overrides.in	2012-07-15 01:09:15.000000000 +0100
@@ -0,0 +1 @@
+lib@PVER@-minimal binary: python-script-but-no-python-dep
diff -urN python2.7-2.7.3~rc2.orig/debian/libPVER-minimal.postinst.in python2.7-2.7.3~rc2/debian/libPVER-minimal.postinst.in
--- python2.7-2.7.3~rc2.orig/debian/libPVER-minimal.postinst.in	1970-01-01 01:00:00.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/libPVER-minimal.postinst.in	2012-07-15 01:09:15.000000000 +0100
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+set -e
+
+if [ ! -f /etc/@PVER@/sitecustomize.py ]; then
+    cat <<-EOF
+	# Empty sitecustomize.py to avoid a dangling symlink
+EOF
+fi
+
+#DEBHELPER#
+
+exit 0
diff -urN python2.7-2.7.3~rc2.orig/debian/libPVER-stdlib.overrides.in python2.7-2.7.3~rc2/debian/libPVER-stdlib.overrides.in
--- python2.7-2.7.3~rc2.orig/debian/libPVER-stdlib.overrides.in	1970-01-01 01:00:00.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/libPVER-stdlib.overrides.in	2012-07-15 01:09:15.000000000 +0100
@@ -0,0 +1,12 @@
+# idlelib images
+lib@PVER@-stdlib binary: image-file-in-usr-lib
+
+# license file referred by the standard library
+lib@PVER@-stdlib binary: extra-license-file
+
+# template files
+lib@PVER@-stdlib binary: interpreter-not-absolute usr/lib/python3.3/venv/scripts/posix/pydoc #!__VENV_PYTHON__
+lib@PVER@-stdlib binary: unusual-interpreter usr/lib/python3.3/venv/scripts/posix/pydoc #!__VENV_PYTHON__
+
+# the split is the reason for that
+lib@PVER@-stdlib binary: python-script-but-no-python-dep
diff -urN python2.7-2.7.3~rc2.orig/debian/patches/multiarch.diff python2.7-2.7.3~rc2/debian/patches/multiarch.diff
--- python2.7-2.7.3~rc2.orig/debian/patches/multiarch.diff	1970-01-01 01:00:00.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/patches/multiarch.diff	2012-08-01 18:28:20.000000000 +0100
@@ -0,0 +1,123 @@
+Index: python2.7-2.7.3~rc2/Lib/sysconfig.py
+===================================================================
+--- python2.7-2.7.3~rc2.orig/Lib/sysconfig.py	2012-08-01 17:16:57.031873210 +0100
++++ python2.7-2.7.3~rc2/Lib/sysconfig.py	2012-08-01 17:16:57.475875418 +0100
+@@ -12,7 +12,7 @@
+         'purelib': '{base}/lib/python{py_version_short}/site-packages',
+         'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+         'include': '{base}/include/python{py_version_short}',
+-        'platinclude': '{platbase}/include/python{py_version_short}',
++        'platinclude': '{platbase}/include{multiarchsubdir}/python{py_version_short}',
+         'scripts': '{base}/bin',
+         'data': '{base}',
+         },
+@@ -480,6 +480,12 @@
+         # the init-function.
+         _CONFIG_VARS['userbase'] = _getuserbase()
+ 
++        multiarch = get_config_var('MULTIARCH')
++        if multiarch:
++            _CONFIG_VARS['multiarchsubdir'] = '/' + multiarch
++        else:
++            _CONFIG_VARS['multiarchsubdir'] = ''
++
+         if 'srcdir' not in _CONFIG_VARS:
+             _CONFIG_VARS['srcdir'] = _PROJECT_BASE
+ 
+Index: python2.7-2.7.3~rc2/Makefile.pre.in
+===================================================================
+--- python2.7-2.7.3~rc2.orig/Makefile.pre.in	2012-08-01 17:16:57.391874988 +0100
++++ python2.7-2.7.3~rc2/Makefile.pre.in	2012-08-01 18:28:07.817050884 +0100
+@@ -88,6 +88,9 @@
+ # Machine-dependent subdirectories
+ MACHDEP=	@MACHDEP@
+ 
++# Multiarch directory (may be empty)
++MULTIARCH=	@MULTIARCH@
++
+ # Install prefix for architecture-independent files
+ prefix=		@prefix@
+ 
+@@ -102,7 +105,7 @@
+ LIBDIR=		@libdir@
+ MANDIR=		@mandir@
+ INCLUDEDIR=	@includedir@
+-CONFINCLUDEDIR=	$(exec_prefix)/include
++CONFINCLUDEDIR=	$(exec_prefix)/include/$(MULTIARCH)
+ SCRIPTDIR=	$(prefix)/lib
+ 
+ # Detailed destination directories
+@@ -546,6 +549,10 @@
+ Modules/python.o: $(srcdir)/Modules/python.c
+ 	$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+ 
++Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
++	$(CC) -c $(PY_CORE_CFLAGS) \
++		$(if $(MULTIARCH),-DMULTIARCH='"$(MULTIARCH)"') \
++		-o $@ $(srcdir)/Python/dynload_shlib.c
+ 
+ # Use a stamp file to prevent make -j invoking pgen twice
+ $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
+@@ -854,7 +861,7 @@
+ 		$(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
+ 
+ # Install the library
+-PLATDIR=	plat-$(MACHDEP)
++PLATDIR=	plat-$(MULTIARCH)
+ EXTRAPLATDIR= @EXTRAPLATDIR@
+ EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
+ MACHDEPS=	$(PLATDIR) $(EXTRAPLATDIR)
+@@ -1002,10 +1009,10 @@
+ 
+ # Install the library and miscellaneous stuff needed for extending/embedding
+ # This goes into $(exec_prefix)$(DEBUG_EXT)
+-LIBPL=		$(LIBP)/config$(DEBUG_EXT)
++LIBPL=		$(LIBP)/config-$(MULTIARCH)$(DEBUG_EXT)
+ 
+ # pkgconfig directory
+-LIBPC=		$(LIBDIR)/pkgconfig
++LIBPC=		$(LIBDIR)/$(MULTIARCH)/pkgconfig
+ 
+ libainstall:	all python-config
+ 	@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \
+Index: python2.7-2.7.3~rc2/Modules/Setup.dist
+===================================================================
+--- python2.7-2.7.3~rc2.orig/Modules/Setup.dist	2012-08-01 17:16:57.271874394 +0100
++++ python2.7-2.7.3~rc2/Modules/Setup.dist	2012-08-01 17:16:57.475875418 +0100
+@@ -91,7 +91,7 @@
+ TESTPATH=
+ 
+ # Path components for machine- or system-dependent modules and shared libraries
+-MACHDEPPATH=:plat-$(MACHDEP)
++MACHDEPPATH=:plat-$(MULTIARCH)
+ EXTRAMACHDEPPATH=
+ 
+ # Path component for the Tkinter-related modules
+Index: python2.7-2.7.3~rc2/configure.in
+===================================================================
+--- python2.7-2.7.3~rc2.orig/configure.in	2012-08-01 17:16:57.339874733 +0100
++++ python2.7-2.7.3~rc2/configure.in	2012-08-01 17:16:57.475875418 +0100
+@@ -12,6 +12,9 @@
+ AC_CONFIG_SRCDIR([Include/object.h])
+ AC_CONFIG_HEADER(pyconfig.h)
+ 
++MULTIARCH=$(gcc --print-multiarch 2>/dev/null)
++AC_SUBST(MULTIARCH)
++
+ dnl Ensure that if prefix is specified, it does not end in a slash. If
+ dnl it does, we get path names containing '//' which is both ugly and
+ dnl can cause trouble.
+Index: python2.7-2.7.3~rc2/Python/dynload_shlib.c
+===================================================================
+--- python2.7-2.7.3~rc2.orig/Python/dynload_shlib.c	2012-08-01 17:16:57.031873210 +0100
++++ python2.7-2.7.3~rc2/Python/dynload_shlib.c	2012-08-01 18:26:30.660569115 +0100
+@@ -50,6 +50,9 @@
+     {"_d.so", "rb", C_EXTENSION},
+     {"module_d.so", "rb", C_EXTENSION},
+ #endif
++#ifdef MULTIARCH
++    {"MULTIARCH.so", "rb", C_EXTENSION},
++#endif
+     {".so", "rb", C_EXTENSION},
+     {"module.so", "rb", C_EXTENSION},
+ #endif
diff -urN python2.7-2.7.3~rc2.orig/debian/patches/series.in python2.7-2.7.3~rc2/debian/patches/series.in
--- python2.7-2.7.3~rc2.orig/debian/patches/series.in	2012-08-01 14:19:27.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/patches/series.in	2012-07-30 23:37:02.000000000 +0100
@@ -62,3 +62,4 @@
 sqlite-rpath.diff
 pypirc-secure.diff
 issue14505.diff
+multiarch.diff
\ No newline at end of file
diff -urN python2.7-2.7.3~rc2.orig/debian/rules python2.7-2.7.3~rc2/debian/rules
--- python2.7-2.7.3~rc2.orig/debian/rules	2012-08-01 14:19:27.000000000 +0100
+++ python2.7-2.7.3~rc2/debian/rules	2012-08-02 17:47:21.000000000 +0100
@@ -15,6 +15,7 @@
 DEB_HOST_ARCH		?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
 DEB_HOST_ARCH_BITS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_BITS)
 DEB_HOST_ARCH_OS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_OS)
+DEB_HOST_MULTIARCH	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
 
 changelog_values := $(shell dpkg-parsechangelog \
 			| awk '/^(Version|Source):/ {print $$2}')
@@ -163,6 +164,11 @@
 p_doc	:= $(PVER)-doc
 p_dbg	:= $(PVER)-dbg
 
+p_lbase	:= lib$(PVER)-stdlib
+p_lmin	:= lib$(PVER)-minimal
+p_ldev	:= lib$(PVER)-dev
+p_ldbg	:= lib$(PVER)-dbg
+
 d_base	:= debian/$(p_base)
 d_min	:= debian/$(p_min)
 d_lib	:= debian/$(p_lib)
@@ -174,6 +180,11 @@
 d_doc	:= debian/$(p_doc)
 d_dbg	:= debian/$(p_dbg)
 
+d_lbase	:= debian/$(p_lbase)
+d_lmin	:= debian/$(p_lmin)
+d_ldev	:= debian/$(p_ldev)
+d_ldbg	:= debian/$(p_ldbg)
+
 build-arch: stamps/stamp-build
 build-indep: stamps/stamp-build-doc
 build: build-arch
@@ -575,6 +586,7 @@
 	rm -rf $(buildd_static) $(buildd_shared) $(buildd_debug) $(buildd_shdebug)
 	find -name '*.py[co]' | xargs -r rm -f
 	rm -f Lib/lib2to3/*.pickle
+	rm -rf Lib/plat-$(DEB_HOST_MULTIARCH)
 	rm -rf locales
 	rm -rf $(d)-dbg
 
@@ -624,9 +636,12 @@
 else
 	$(MAKE) -C $(buildd_shared) install prefix=$(CURDIR)/$(d)/usr
 endif
+
 	-find $(d)/usr/lib/python$(VER) -name '*_failed*.so'
 	find $(d)/usr/lib/python$(VER) -name '*_failed*.so' | xargs -r rm -f
 
+	mv $(d)/usr/lib/libpython*.a $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/
+
 	mv $(d)/usr/lib/python$(VER)/site-packages \
 		$(d)/usr/lib/python$(VER)/dist-packages
 
@@ -667,16 +682,21 @@
 		$(d)/$(scriptdir)/lib-dynload/Python-$(VER).egg-info
 
 	dh_installdirs -p$(p_lib) \
-		$(scriptdir)/config \
+		usr/lib/$(DEB_HOST_MULTIARCH) \
+		$(scriptdir)/config-$(DEB_HOST_MULTIARCH) \
 		usr/share/doc
 	: # install the shared library
-	cp -p $(buildd_shared)/libpython$(VER).so.1.0 $(d_lib)/usr/lib/
-	ln -sf libpython$(VER).so.1.0 $(d_lib)/usr/lib/libpython$(VER).so.1
-	ln -sf ../../libpython$(VER).so.1 \
-		$(d_lib)/$(scriptdir)/config/libpython$(VER).so
+	cp -p $(buildd_shared)/libpython$(VER).so.1.0 \
+		$(d_lib)/usr/lib/$(DEB_HOST_MULTIARCH)/
+	dh_link -p$(p_lib) \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1.0 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so.1 \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so \
+		/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/libpython$(VER).so
+
 	ln -sf $(p_base) $(d_lib)/usr/share/doc/$(p_lib)
 
-	ln -sf libpython$(VER).so.1 $(d)/usr/lib/libpython$(VER).so
+	ln -sf libpython$(VER).so.1 $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).so
 
 ifeq ($(with_interp),shared)
 	: # install the statically linked runtime
@@ -690,55 +710,79 @@
 	: # install the Makefile of the shared python build
 	sed -e '/^OPT/s,-O3,-O2,' \
 	    -e 's,^RUNSHARED *=.*,RUNSHARED=,' \
-		build-shared/Makefile > $(d)/$(scriptdir)/config/Makefile
+		build-shared/Makefile > $(d)/$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/Makefile
 
-	: # Move the binary and the minimal libraries into $(p_min).
-	dh_installdirs -p$(p_min) \
+	: # Move the minimal libraries into $(p_lmin).
+	dh_installdirs -p$(p_lmin) \
 		etc/$(PVER) \
 		usr/bin \
 		usr/include/$(PVER) \
 		usr/share/man/man1 \
 		$(scriptdir)/lib-dynload \
-		$(scriptdir)/config
-	DH_COMPAT=2 dh_movefiles -p$(p_min) --sourcedir=$(d) \
-		usr/bin/python$(VER) \
-		usr/share/man/man1/python$(VER).1 \
+		$(scriptdir)/config-$(DEB_HOST_MULTIARCH)
+
+	DH_COMPAT=2 dh_movefiles -p$(p_lmin) --sourcedir=$(d) \
 		$(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \
 		$(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \
 		$(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \
-		$(scriptdir)/config/Makefile \
-		usr/include/$(PVER)/pyconfig.h \
+		$(scriptdir)/config-$(DEB_HOST_MULTIARCH)/Makefile \
+		usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)/pyconfig.h \
 		$(scriptdir)/site.py
 
 #		$(foreach i,$(MIN_EXTS),$(scriptdir)/lib-dynload/$(i).so) \
 
+	: # Move the binary and the minimal libraries into $(p_min).
+	dh_installdirs -p$(p_min) \
+		usr/bin \
+		usr/share/man/man1
+	DH_COMPAT=2 dh_movefiles -p$(p_min) --sourcedir=$(d) \
+		usr/bin/python$(VER) \
+		usr/share/man/man1/python$(VER).1
+
 	: # Install sitecustomize.py.
-	cp -p debian/sitecustomize.py $(d_min)/etc/$(PVER)/
-	patch --no-backup -d $(d_min)/$(scriptdir) < debian/patches/site-builddir.diff
-	dh_link -p$(p_min) /etc/$(PVER)/sitecustomize.py \
+	cp -p debian/sitecustomize.py $(d_lmin)/etc/$(PVER)/
+	patch --no-backup -d $(d_lmin)/$(scriptdir) < debian/patches/site-builddir.diff
+	dh_link -p$(p_lmin) /etc/$(PVER)/sitecustomize.py \
 		/$(scriptdir)/sitecustomize.py
 
 	: # Move the static library and the header files into $(p_dev).
 #	mv $(d)/usr/share/include/python$(VER)/* $(d)/usr/include/python$(VER)/.
 #	rm -rf $(d)/usr/share/include
-	dh_installdirs -p$(p_dev) \
-		usr/share/doc/python$(VER) \
+
+	cp $(d)/usr/bin/python$(VER)-config $(d)/usr/bin/$(DEB_HOST_MULTIARCH)-python-config
+
+	dh_installdirs -p$(p_ldev) \
+		usr/bin \
 		$(scriptdir) \
-		$(scriptdir)/doc/html \
 		usr/include \
+		usr/share/man/man1
+
+	DH_COMPAT=2 dh_movefiles -p$(p_ldev) --sourcedir=$(d) \
+		usr/bin/$(DEB_HOST_MULTIARCH)-python-config \
+		usr/lib/python$(VER)/config-$(DEB_HOST_MULTIARCH) \
+		usr/include \
+		usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).{a,so} \
+		usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)*.pc
+
+	dh_link -p$(p_ldev) \
+	    /usr/lib/$(PVER)/config-$(DEB_HOST_MULTIARCH)/libpython$(VER).a \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER).a
+
+	cp -p $(buildd_shared)/libpython$(VER)-pic.a \
+		$(d_ldev)/usr/lib/python$(VER)/config-$(DEB_HOST_MULTIARCH)/
+
+	dh_installdirs -p$(p_dev) \
+		usr/share/doc/python$(VER) \
 		usr/share/man/man1 \
-		usr/lib
+		$(scriptdir) \
+		$(scriptdir)/doc/html
+
 	cp -p Misc/HISTORY Misc/README.valgrind Misc/gdbinit \
 		debian/README.maintainers \
 		debian/test_results $(buildd_static)/pybench.log \
 	    $(d_dev)/usr/share/doc/python$(VER)/
 
 	DH_COMPAT=2 dh_movefiles -p$(p_dev) --sourcedir=$(d) \
-		usr/lib/python$(VER)/config \
-		usr/include/python$(VER) \
-		usr/lib/libpython$(VER).so \
-		usr/lib/libpython$(VER).a \
-		usr/lib/pkgconfig/python-$(VER).pc \
 		usr/bin/python$(VER)-config \
 		usr/lib/python$(VER)/distutils/command/wininst-*.exe
 
@@ -747,8 +791,6 @@
 
 	cp -p debian/python-config.1 \
 		$(d_dev)/usr/share/man/man1/python$(VER)-config.1
-	cp -p $(buildd_shared)/libpython$(VER)-pic.a \
-		$(d_dev)/usr/lib/python$(VER)/config/
 
 ifeq ($(with_tk),yes)
 	: # Move the Tkinter files into $(p_tk).
@@ -857,6 +899,12 @@
 	cp -p debian/README.Tk $(d_tk)/usr/share/doc/$(p_tk)/
 endif
 
+	: # library files into $(p_lbase)
+	dh_installdirs -p$(p_lbase) \
+		usr/lib
+	dh_movefiles -p$(p_lbase) \
+		usr/lib/python$(VER)
+
 	: # The rest goes into $(p_base)
 	mkdir -p $(d)/usr/lib/python$(VER)/dist-packages
 	(cd $(d) && tar cf - .) | (cd $(d_base) && tar xpf -)
@@ -890,12 +938,36 @@
 	: # install debug package
 	rm -rf $(d)-dbg
 	$(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg
-	dh_installdirs -p$(p_dbg) \
+
+	mv $(d)-dbg/usr/lib/libpython*.a $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/
+
+
+	dh_installdirs -p$(p_ldbg) \
 		usr/bin \
 		usr/share/man/man1 \
 		$(scriptdir)/lib-dynload \
+		$(scriptdir)/plat-$(DEB_HOST_MULTIARCH) \
 		usr/include/$(PVER)_d \
-		usr/lib/pkgconfig \
+		usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)dm \
+		usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
+
+	cp -p $(d)-dbg/$(scriptdir)/lib-dynload/*.so \
+		$(d_ldbg)/$(scriptdir)/lib-dynload/
+	cp -p $(buildd_shdebug)/libpython$(VER)_d.so.1.0 \
+		$(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/
+	dh_link -p$(p_ldbg) \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1.0 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1 \
+	    /usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so.1 \
+		/usr/lib/$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so
+	sed -e '/^Libs:/s,-lpython$(VER),-lpython$(VER)_d,' \
+	  -e '/^Cflags:/s,python$(VER),python$(VER)_d,' \
+	  $(d)-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER).pc \
+	  > $(d_ldbg)/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-$(VER)-dbg.pc
+
+	dh_installdirs -p$(p_dbg) \
+		usr/bin \
+		usr/share/man/man1 \
 		usr/share/doc/$(p_base)
 	cp -p Misc/SpecialBuilds.txt $(d_dbg)/usr/share/doc/$(p_base)/
 	cp -p debian/$(PVER)-dbg.README.Debian \
@@ -907,13 +979,8 @@
 	chmod 755 $(d_dbg)/usr/bin/$(PVER)-dbg-config
 	cp -p $(buildd_debug)/build/lib*/*_d.so \
 		$(d_dbg)/$(scriptdir)/lib-dynload/
-	cp -p $(buildd_shdebug)/libpython$(VER)_d.so.1.0 $(d_dbg)/usr/lib/
-	ln -sf libpython$(VER)_d.so.1.0 $(d_dbg)/usr/lib/libpython$(VER)_d.so.1
-	ln -sf libpython$(VER)_d.so.1 $(d_dbg)/usr/lib/libpython$(VER)_d.so
-	sed -e '/^Libs:/s,-lpython$(VER),-lpython$(VER)_d,' \
-	  -e '/^Cflags:/s,python$(VER),python$(VER)_d,' \
-	  $(d)-dbg/usr/lib/pkgconfig/python-$(VER).pc \
-	  > $(d_dbg)/usr/lib/pkgconfig/python-$(VER)-dbg.pc
+	
+	
 ifneq ($(with_gdbm),yes)
 	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/gdbm_d.so
 	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/gdbm.so
@@ -924,20 +991,21 @@
 endif
 #	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/_bsddb_d.so
 
-	cp -a $(d)-dbg/$(scriptdir)/config_d $(d_dbg)/$(scriptdir)/
+	cp -a $(d)-dbg/$(scriptdir)/config_d-$(DEB_HOST_MULTIARCH) \
+		 $(d_ldbg)/$(scriptdir)/
 	ln -sf ../../libpython$(VER)_d.so \
-		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER)_d.so
+		$(d_dbg)/$(scriptdir)/config_d-$(DEB_HOST_MULTIARCH)/libpython$(VER)_d.so
 	ln -sf libpython$(VER)_d.so \
-		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER).so
+		$(d_dbg)/$(scriptdir)/config_d-$(DEB_HOST_MULTIARCH)/libpython$(VER).so
 	ln -sf libpython$(VER)_d.a \
-		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER).a
+		$(d_dbg)/$(scriptdir)/config_d-$(DEB_HOST_MULTIARCH)/libpython$(VER).a
 
-	for i in $(d_dev)/usr/include/$(PVER)/*; do \
+	for i in $(d_ldev)/usr/include/$(PVER)/*; do \
 	  i=$$(basename $$i); \
 	  case $$i in pyconfig.h) continue; esac; \
-	  ln -sf ../$(PVER)/$$i $(d_dbg)/usr/include/$(PVER)_d/$$i; \
+	  ln -sf ../$(PVER)/$$i $(d_ldbg)/usr/include/$(PVER)_d/$$i; \
 	done
-	cp -p $(buildd_debug)/pyconfig.h $(d_dbg)/usr/include/$(PVER)_d/
+	cp -p $(buildd_debug)/pyconfig.h $(d_ldbg)/usr/include/$(DEB_HOST_MULTIARCH)/$(PVER)_d/
 	ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz
 	ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
 
@@ -1010,10 +1078,18 @@
 	-dh_icons -a || dh_iconcache -a
 #	dh_installmime -a
 	dh_installchangelogs -a
-	for i in $(p_dev) $(p_dbg) $(p_lib); do \
+	for i in $(p_dev) $(p_dbg); do \
 	  rm -rf debian/$$i/usr/share/doc/$$i; \
 	  ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \
 	done
+	for i in $(p_lbase); do \
+	  rm -rf debian/$$i/usr/share/doc/$$i; \
+	  ln -s $(p_lmin) debian/$$i/usr/share/doc/$$i; \
+	done
+	for i in $(p_ldev) $(p_ldbg) $(p_lib); do \
+	  rm -rf debian/$$i/usr/share/doc/$$i; \
+	  ln -s $(p_lbase) debian/$$i/usr/share/doc/$$i; \
+	done
 	-find debian ! -perm -200 -print -exec chmod +w {} \;
 ifneq ($(with_tk),yes)
 	rm -f $(d_base)/$(scriptdir)/lib-dynload/_tkinter.so
@@ -1041,7 +1117,7 @@
 	done
 
 	dh_makeshlibs -p$(p_lib) -V '$(p_lib)'
-	dh_makeshlibs -p$(p_dbg) -V '$(p_dbg)'
+	dh_makeshlibs -p$(p_ldbg) -V '$(p_ldbg)'
 # don't include the following symbols, found in extensions
 # which either can be built as builtin or extension.
 	sed -ri '/^ (_check_|asdl_|fast_save_|init)/d' \

Reply via email to