[PATCH] gnu: Add rpi-imager.

  • Done
  • quality assurance status badge
Details
2 participants
  • ???
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 30 Nov 2022 02:28
(address . guix-patches@gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221130012828.31669-1-maxim.cournoyer@gmail.com
* gnu/packages/flashing-tools.scm (rpi-imager): New variable.
---
gnu/packages/flashing-tools.scm | 88 +++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)

Toggle diff (139 lines)
diff --git a/gnu/packages/flashing-tools.scm b/gnu/packages/flashing-tools.scm
index 08300cb860..4bbcd9c4f6 100644
--- a/gnu/packages/flashing-tools.scm
+++ b/gnu/packages/flashing-tools.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -29,6 +30,7 @@
(define-module (gnu packages flashing-tools)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix download)
+ #:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (guix utils)
@@ -36,21 +38,26 @@ (define-module (gnu packages flashing-tools)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
+ #:use-module (guix build-system qt)
#:use-module (gnu packages autotools)
#:use-module (gnu packages admin)
+ #:use-module (gnu packages backup)
#:use-module (gnu packages base)
#:use-module (gnu packages bison)
#:use-module (gnu packages boost)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages curl)
#:use-module (gnu packages elf)
#:use-module (gnu packages flex)
#:use-module (gnu packages ghostscript)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages groff)
+ #:use-module (gnu packages guile)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages libusb)
#:use-module (gnu packages libftdi)
+ #:use-module (gnu packages linux)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages qt)
#:use-module (gnu packages tls))
@@ -295,6 +302,87 @@ (define-public rkflashtool
RK3036, RK3066, RK312X, RK3168, RK3188, RK3288, RK3368.")
(license license:bsd-2))))
+(define-public rpi-imager
+ (package
+ (name "rpi-imager")
+ (version "1.7.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/raspberrypi/rpi-imager")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (modules '((guix build utils)
+ (ice-9 ftw)
+ (srfi srfi-26)))
+ (snippet '(begin
+ ;; Remove all but the following bundled libraries,
+ ;; which are not yet packaged in Guix.
+ (define keep '("." ".."
+ "drivelist"
+ "mountutils"
+ "sha256crypt"))
+ (with-directory-excursion "src/dependencies"
+ (for-each delete-file-recursively
+ (scandir "." (negate
+ (cut member <> keep)))))))
+ (sha256
+ (base32
+ "0i7r1myhinhlgispq92nzvrjvbc48l87z8xfwc038l44qj1lsq8g"))))
+ (build-system qt-build-system)
+ (arguments
+ (list
+ #:tests? #f ;no test suite
+ #:configure-flags #~(list "-DENABLE_TELEMETRY=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'chdir
+ (lambda _
+ (chdir "src")))
+ (add-after 'chdir 'customize-os-list.json
+ ;; The default operating system JSON list contains non-FSDG
+ ;; systems.
+ (lambda _
+ (let* ((datadir (string-append #$output
+ "/share/rpi-imager"))
+ (os-list.json (string-append datadir "/os-list.json")))
+ (mkdir-p datadir)
+ #$(with-extensions (list guile-json-4)
+ #~(begin
+ (use-modules (json))
+ (call-with-output-file os-list.json
+ ;; TODO: Register FSDG and RPi compatible OS
+ ;; images here.
+ (lambda (port)
+ (scm->json '() port)))))
+ (substitute* "config.h"
+ (("#define OSLIST_URL.*")
+ (string-append "#define OSLIST_URL \"file:///"
+ os-list.json "\"\n"))))))
+ (add-after 'chdir 'patch-cmake
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ ;; lsblk expects to have access to /sys/dev/block,
+ ;; which doesn't exist in the build container;
+ ;; prevent the check to fail the build.
+ (("ret EQUAL \"1\"")
+ "FALSE")))))))
+ (inputs
+ (list gnutls
+ curl
+ libarchive
+ qtdeclarative-5
+ qtquickcontrols2-5
+ qtsvg-5
+ qttools-5
+ util-linux))
+ (home-page "https://github.com/raspberrypi/rpi-imager/")
+ (synopsis "Raspberry Pi Imaging Utility")
+ (description "A graphical utility to easily provision and flash a memory
+card with an operating system image suitable for the Raspberry Pi single board
+computer.")
+ (license license:asl2.0)))
+
(define-public heimdall
(package
(name "heimdall")

base-commit: b4be83b6ac7e2139bec5d3eaafcf8af6cbe50856
--
2.38.1
?
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 59709@debbugs.gnu.org)
87tu25i919.fsf@envs.net
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (7 lines)
> * gnu/packages/flashing-tools.scm (rpi-imager): New variable.
> [...]
> + (synopsis "Raspberry Pi Imaging Utility")
> + (description "A graphical utility to easily provision and flash a memory
> +card with an operating system image suitable for the Raspberry Pi single board
> +computer.")

Doesn't we require description to be a full sentence? Like:
"@command{rpi-imager} is a graphical utility to ..."

Otherwise looks good to me.
M
M
Maxim Cournoyer wrote on 9 Dec 2022 21:01
(name . ???)(address . iyzsong@envs.net)(address . 59709@debbugs.gnu.org)
87pmcs5osx.fsf@gmail.com
Hi,

??? <iyzsong@envs.net> writes:

Toggle quote (14 lines)
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> * gnu/packages/flashing-tools.scm (rpi-imager): New variable.
>> [...]
>> + (synopsis "Raspberry Pi Imaging Utility")
>> + (description "A graphical utility to easily provision and flash a memory
>> +card with an operating system image suitable for the Raspberry Pi single board
>> +computer.")
>
> Doesn't we require description to be a full sentence? Like:
> "@command{rpi-imager} is a graphical utility to ..."
>
> Otherwise looks good to me.

Oh, indeed. Copy/paste gone wrong. Thanks for the review. I was also
wondering if perhaps (gnu packages raspberry-pi) would be a better home,
given its name. What do you think?

--
Thanks,
Maxim
?
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 59709@debbugs.gnu.org)
87mt7rj014.fsf_-_@envs.net
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (3 lines)
> I was also wondering if perhaps (gnu packages raspberry-pi) would be a
> better home, given its name. What do you think?

Yes, I think raspberry-pi.scm is better too!
M
M
Maxim Cournoyer wrote on 13 Dec 2022 16:15
(name . ???)(address . iyzsong@envs.net)(address . 59709-done@debbugs.gnu.org)
878rjbnxlt.fsf@gmail.com
Hi,

??? <iyzsong@envs.net> writes:

Toggle quote (7 lines)
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> I was also wondering if perhaps (gnu packages raspberry-pi) would be a
>> better home, given its name. What do you think?
>
> Yes, I think raspberry-pi.scm is better too!

OK! I've moved the package there and adjusted the description to start
with a complete sentence, and pushed as 93b0c1e35e.

Closing!

--
Thanks,
Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 59709@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 59709
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch