diff mbox series

[bug#59709] gnu: Add rpi-imager.

Message ID 20221130012828.31669-1-maxim.cournoyer@gmail.com
State New
Headers show
Series [bug#59709] gnu: Add rpi-imager. | expand

Commit Message

Maxim Cournoyer Nov. 30, 2022, 1:28 a.m. UTC
* gnu/packages/flashing-tools.scm (rpi-imager): New variable.
---
 gnu/packages/flashing-tools.scm | 88 +++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)


base-commit: b4be83b6ac7e2139bec5d3eaafcf8af6cbe50856

Comments

宋文武 Dec. 9, 2022, 2:51 a.m. UTC | #1
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.
Maxim Cournoyer Dec. 9, 2022, 8:01 p.m. UTC | #2
Hi,

宋文武 <iyzsong@envs.net> writes:

> 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?
宋文武 Dec. 13, 2022, 6:22 a.m. UTC | #3
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!
Maxim Cournoyer Dec. 13, 2022, 3:15 p.m. UTC | #4
Hi,

宋文武 <iyzsong@envs.net> writes:

> 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!
diff mbox series

Patch

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")