Subject: [bug#49577] [PATCH] Add python-pmbootstrap

From: phodina <[email-masked]>
Date: Thu, 15 Dec 2022 21:51:11 +0000

Hi Maxim,

here's update of the package. I moved to git repo as it has test suite packaged.

However, currently 44 tests fail, 80 pass.

The reason is they require network connectivity (mostly git tests, can be added to list of dependencies), then some require chroot (that might be dropped and run in guix isolated environment), sudo (again remove and use TMP location).

The tool is able to produce working PostmarketOS image which can be run on mobile device.

Not sure about the time it will take to patch all the tests. What do you think?

----
Petr

From 5443a12dc08936a7facab4b1b85953624a29df24 Mon Sep 17 00:00:00 2001
From: Petr Hodina <[email-masked]>
Date: Sun, 18 Jul 2021 12:33:07 +0200
Subject: [PATCH v4] gnu: Add pmbootstrap.

* gnu/packages/python-xyz.scm (pmbootstrap): New variable.

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 17fbd9de9e..7f409cf118 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -153,6 +153,7 @@ (define-module (gnu packages python-xyz)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages adns)
+  #:use-module (gnu packages admin)
   #:use-module (gnu packages aidc)
   #:use-module (gnu packages attr)
   #:use-module (gnu packages backup)
@@ -1458,6 +1459,56 @@ (define-public python-shortuuid
 module and then similar looking characters are removed.")
     (license license:bsd-3)))
 
+(define-public pmbootstrap
+  (package
+    (name "pmbootstrap")
+    (version "1.50.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://gitlab.com/postmarketOS/pmbootstrap")
+                    (commit version)))
+              (sha256
+               (base32
+                "0n26zbpw7nhyh9gq0ydgij7m4pgv2n5wlmyc7g2sr7gqhqv04j2j"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:tests? #f ; TODO: many test fail
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'install 'fix-paths
+                          (lambda* _
+                            (let ((git (string-append #$git "/bin/"))
+                                  (procps (string-append #$procps "/bin"))
+                                  (openssl (string-append #$openssl "/bin"))
+                                  (sudo "/run/setuid-programs"))
+                              (wrap-program (string-append #$output
+                                                           "/bin/pmbootstrap")
+                                            `("PATH" ":" suffix
+                                              ,(list git procps openssl sudo))))))
+                        (replace 'check
+                          (lambda* (#:key tests? #:allow-other-keys)
+                            (when tests?
+                              (invoke "pytest")))))))
+    (native-inputs (list python-pytest python-pyopenssl))
+    (inputs (list git procps openssl sudo))
+    (home-page "https://postmarketos.org")
+    (synopsis "Build and flash tool for postmarketOS")
+    (description
+     "Bootstrap program that abstracts everything in chroots and therefore
+basically runs on top of any Linux distribution. Features:
+@enumerate
+@item chroot setup (distro-independent QEMU user emulation
+@item clean chroot shutdown (umount) and zapping
+@item build software as packages
+@item cross-compile all armhf-packages
+@item effective caching out of the box (survives chroot zaps)
+@item installation targets
+@item flasher abstractions
+@item logging
+@item security
+@end enumerate")
+    (license license:gpl3+)))
+
 (define-public python-logwrap
   (package
     (name "python-logwrap")
-- 
2.37.2