diff mbox series

[bug#49577] Add python-pmbootstrap

Message ID -p1E1t5bZbM1CFVLmQ8v8VDEsQf-BOs5FP5kO69Mj5UqSwIMEpU1Y5wNexbx80wVoHo-t7g6eDhkj9p_u630_159NhbXcYYC1eWw_qBSK0E=@protonmail.com
State New
Headers show
Series [bug#49577] Add python-pmbootstrap | expand

Commit Message

phodina May 29, 2023, 10:31 a.m. UTC
Hi Jorge and Maxim,

unfreezing this patch. So I've modified the patch to list the tests that should not be run based on the Nix example.

The package is also updated to the latest version.

However, I'm struggling with the import of the `pmb_test` module.

I've modified the variable `PYTHONPATH` accordingly to fix the error:
```
E   ModuleNotFoundError: No module named 'pmb_test'
``` 

But now I get the following error:
```
wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f)
```

So it seems the `PYTHONPATH` env variable is not set. Do you know how to fix this?


----
Petr




Sent with Proton Mail secure email.

------- Original Message -------
On Thursday, May 25th, 2023 at 2:16 AM, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:


> tags 49577 +moreinfo
> quit
> 
> Hi Jorge,
> 
> Maxim Cournoyer maxim.cournoyer@gmail.com writes:
> 
> > Hi Petr,
> > 
> > phodina phodina@protonmail.com writes:
> > 
> > > Hi Maxim,
> > > 
> > > here's update of the package. I moved to git repo as it has test suite packaged.
> > 
> > Thank you!
> > 
> > > 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).
> > 
> > Oh. That's more than half the tests failing. I guess the whole test
> > suite could be disabled with a comment, if possible with a link
> > requesting upstream to make it easy to skip network-requiring tests via
> > a flag or something.
> 
> 
> The status is unchanged; the ball is in Petr's camp, or someone
> interested enough in the patch to make the changes suggested.
> 
> I'm using this opportunity to gently ping Petr :-).
> 
> --
> Thanks,
> Maxim

Comments

Maxim Cournoyer June 14, 2023, 2:46 a.m. UTC | #1
Hi Petr,

phodina <phodina@protonmail.com> writes:

> Hi Jorge and Maxim,
>
> unfreezing this patch. So I've modified the patch to list the tests that should not be run based on the Nix example.
>
> The package is also updated to the latest version.
>
> However, I'm struggling with the import of the `pmb_test` module.
>
> I've modified the variable `PYTHONPATH` accordingly to fix the error:
> ```
> E   ModuleNotFoundError: No module named 'pmb_test'
> ``` 
>
> But now I get the following error:
> ```
> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f)
> ```
>
> So it seems the `PYTHONPATH` env variable is not set. Do you know how to fix this?

Maybe because we've moved to use GUIX_PYTHONPATH and not PYTHONPATH?
jgart June 14, 2023, 3:06 a.m. UTC | #2
Hi phodina,

I would try Maxim's suggestion. 

Otherwise, that might be a good Lars question... CC'ing

I would have to read through more code to affirm that for you and I don't have the time at the moment to read down that particular rabbit hole.

Maybe a this weekend project.

There's also a pmbootstrap in guixrus if that helps to crosscheck anything useful or not for this patch:

https://toys.whereis.みんな/?search=pmbootstrap

hope this helps and excuse the lack of further investigation at this moment on my end,

jgart
diff mbox series

Patch

From ec3193bfa3320b6b282926807bfb2501362fe11d Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Sun, 18 Jul 2021 12:33:07 +0200
Subject: [PATCH v2] 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 f7e3f6f538..b14637af73 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -158,6 +158,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)
@@ -1744,6 +1745,115 @@  (define-public python-shortuuid
 module and then similar looking characters are removed.")
     (license license:bsd-3)))
 
+(define-public pmbootstrap
+  (package
+    (name "pmbootstrap")
+    (version "1.53.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pmbootstrap" version))
+              (sha256
+               (base32
+                "13nyjrwi5r8ma9i58cz6qbgy2xyjzs708nq65kdmhrw3ba5z3jgj"))))
+    (build-system python-build-system)
+    (arguments
+     (list #: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?
+                              (setenv "PYTHONPATH"
+                                      (string-append (getcwd) "/test:"
+                                                     (getenv "PYTHONPATH")))
+                              (invoke "pytest" "-k"
+                                      (string-append "not test_apk_static"
+                                       " and not test_aportgen"
+                                       "test_aportgen_device_wizard"
+                                       " and not test_bootimg"
+                                       " and not test_build_depends_binary_outdated"
+                                       " and not test_build_depends_high_level"
+                                       " and not test_build_depends_no_binary_error"
+                                       " and not test_build_is_necessary"
+                                       " and not test_build_local_source_high_level"
+                                       " and not test_build_src_invalid_path"
+                                       " and not test_can_fast_forward"
+                                       " and not test_check_build_for_arch"
+                                       " and not test_chroot_arguments"
+                                       " and not test_chroot_interactive_shell"
+                                       " and not test_chroot_interactive_shell_user"
+                                       " and not test_clean_worktree"
+                                       " and not test_config_user"
+                                       " and not test_cross_compile_distcc"
+                                       " and not test_crossdirect"
+                                       " and not test_file"
+                                       " and not test_filter_aport_packages"
+                                       " and not test_filter_missing_packages_binary_exists"
+                                       " and not test_filter_missing_packages_invalid"
+                                       " and not test_filter_missing_packages_pmaports"
+                                       " and not test_finish"
+                                       " and not test_folder_size"
+                                       " and not test_get_apkbuild"
+                                       " and not test_get_depends"
+                                       " and not test_get_upstream_remote"
+                                       " and not test_helpers_lint"
+                                       " and not test_helpers_package_get_apkindex"
+                                       " and not test_helpers_repo"
+                                       " and not test_helpers_ui"
+                                       " and not test_init_buildenv"
+                                       " and not test_kconfig_check"
+                                       " and not test_keys"
+                                       " and not test_newapkbuild"
+                                       " and not test_package"
+                                       " and not test_package_from_aports"
+                                       " and not test_pkgrel_bump"
+                                       " and not test_pmbootstrap_status"
+                                       " and not test_print_checks_git_repo"
+                                       " and not test_pull"
+                                       " and not test_qemu_running_processes"
+                                       " and not test_questions_additional_options"
+                                       " and not test_questions_bootimg"
+                                       " and not test_questions_channel"
+                                       " and not test_questions_keymaps"
+                                       " and not test_questions_work_path"
+                                       " and not test_read_config_channel"
+                                       " and not test_recurse_invalid"
+                                       " and not test_run_abuild"
+                                       " and not test_run_core"
+                                       " and not test_shell_escape"
+                                       " and not test_skip_already_built"
+                                       " and not test_switch_to_channel_branch"
+                                       " and not test_version")))))
+                        ;; Circular dependency with pmbootstrap
+                        (delete 'sanity-check))))
+    (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.39.1