Subject: bug#36518: [core-updates] python-boot0 fails to build on armhf and aarch64

From: Marius Bakke <[email-masked]>
Date: Sat, 06 Jul 2019 01:44:50 +0200

On the core-updates branch, since commit
5f3f70391809f8791c55c05bd1646bc58508fa2c, bootstrapping fails early for
armhf-linux and aarch64 when trying to build pkg-config (for
python-boot0).  That can be easily worked around with this patch:

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index d28296449d..183536d0b4 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1866,6 +1866,7 @@ the bootstrap environment."
                   (inherit python-minimal)
                   (inputs
                    `(("expat" ,expat-sans-tests))) ;remove OpenSSL, zlib, etc.
+                  (native-inputs '())              ;and pkg-config
                   (arguments
                    (substitute-keyword-arguments (package-arguments
                                                   python-minimal)

But then Python fails at the configure stage because pthreads is not
working with the bootstrap compiler on those platforms.

I'm not sure what to do about it.  I tried using 'python-on-guile' with
this patch:

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index f26145cb0b..747ec7c594 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -816,6 +816,33 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "https://www.gnu.org/software/libc/")))
 
+(define-public glibc-sans-python
+  (package
+    (inherit glibc)
+    (name "glibc-with-guile-python")
+    (arguments
+     (substitute-keyword-arguments (package-arguments glibc)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'patch-configure
+             (lambda _
+               ;; Relax Python version check.
+               (substitute* "configure"
+                 (("\\$critic_missing python") "")
+                 (("\\$PYTHON_PROG -B") "$PYTHON_PROG"))
+               #t))))))
+    (native-inputs `(("texinfo" ,texinfo)
+                     ("perl" ,perl)
+                     ("bison" ,bison)
+                     ("gettext" ,gettext-minimal)
+                     ("python" ,(@ (gnu packages guile-xyz) python-on-guile))
+                     ,@(if (hurd-target?)
+                           `(("mig" ,mig)
+                             ("perl" ,perl))
+                           '())))))
+
+
+
 ;; Below are old libc versions, which we use mostly to build locale data in
 ;; the old format (which the new libc cannot cope with.)

But the interpreter fails with 'unbound variable: this' upon running
glibcs Python scripts.

Until python-on-guile is complete enough to run the glibc scripts, I
think we'll have to insert an older version of glibc into the
bootstrap graph, so that Python can be built with pthreads on all
platforms.  WDYT?