Subject: Re: [bug#62640] [PATCH] gnu: Add pmbootstrap.

From: André Batista <[email-masked]>
Date: Thu, 29 May 2025 16:39:37 -0300

Quite a lot of improvements!

sáb 24 mai 2025 às 18:52:18 (1748123538), [email-masked] enviou:
> (...)
> +    (arguments
> +     (list
> +       #:modules `((guix build pyproject-build-system)
> +                   (guix build utils)
> +                   (ice-9 match))
> +       #:phases #~(modify-phases %standard-phases
> +                    (add-after 'unpack 'set-sudo
> +                      (lambda _
> +                        (substitute* "pmb/config/sudo.py"
> +                          (("sudo\"") "/run/privileged/bin/sudo\""))))
> +                    (add-after 'wrap 'wrap-required-programs
> +                      (lambda* (#:key inputs outputs #:allow-other-keys)
> +                        (wrap-program (string-append (assoc-ref outputs "out")
> +                                                     "/bin/pmbootstrap")
> +                          `("PATH" ":" prefix
> +                            ,(map (match-lambda
> +                                    ((input directory)
> +                                     (string-append (assoc-ref inputs input)

Even though this is fine, maintainers have been favoring the usage of
'this-package-inputs' and related functions that improve code semantics
and readability.  The same goes for gexps in place for the usual quote
unquote dance.  See:

<https://guix.gnu.org/en/blog/2021/the-big-change> and
<https://lists.gnu.org/archive/html/guix-commits/2022-09/msg00511.html>

Also, a bit above, instead of 'assoc-ref outputs "out"', you may use
 #$output.

Incidentally, the first link shows that I was really in the wrong as
to the indentation comments in the previous mail.

> +                                                    "/" directory)))
> +                                  '(("bash"            "bin")
> +                                    ("coreutils"       "bin")
> +                                    ("git"             "bin")
> +                                    ("openssl"         "bin")
> +                                    ("procps"          "bin")
> +                                    ("multipath-tools" "sbin")

Breaks alphabetical order, which was consistently respected otherwise.

> +                                    ("tar"             "bin")
> +                                    ("util-linux"      "bin")
> +                                    ("util-linux"      "sbin"))))))))
> +       ;; The first two tests require a pmaports git repository in the workdir.
> +       #:test-flags #~(list (string-append "--deselect=test/core/test_pkgrepo"
> +                                           ".py::test_pkgrepo_pmaports")
> +                            (string-append "--deselect=test/parse/test_bootimg"
> +                                           ".py::test_bootimg")
> +                            ;; RuntimeError: No package repositories specified?
> +                            (string-append "--deselect=test/parse/"
> +                                           "test_deviceinfo.py::"
> +                                           "test_random_valid_deviceinfos"))))

But this is way clearer to me, thanks.. :)

> +    (native-inputs (list mkbootimg
> +                         python-pytest
> +                         python-setuptools
> +                         python-wheel
> +                         util-linux)) ; for losetup
> +    (inputs (list bash-minimal
> +                  coreutils
> +                  git
> +                  multipath-tools
> +                  openssl
> +                  procps
> +                  tar
> +                  util-linux))

I could not check this, so more of a question: are this new inputs
required for what?  They seem to enlarge the package size quite a bit
according to guix size.

Cheers!