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.
@@ -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