diff mbox series

[bug#37853] gnu: Add ddcci-driver-linux.

Message ID 20191021151628.28632-1-brice@waegenei.re
State Accepted
Headers show
Series [bug#37853] gnu: Add ddcci-driver-linux. | expand

Commit Message

Brice Waegeneire Oct. 21, 2019, 3:16 p.m. UTC
* gnu/packages/linux.scm (ddcci-driver-linux): Add variable.
---
 gnu/packages/linux.scm | 59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

Comments

Mathieu Othacehe Oct. 22, 2019, 9:42 a.m. UTC | #1
Hello Brice,

> +             (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")

This line is too long. You can add a line break after "uri" so that it
fits under 78 columns.

> +         (replace 'build
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (for-each (lambda (module)
> +                         (invoke "make" "-C"
> +                                 (string-append (assoc-ref inputs "linux-module-builder")
> +                                                "/lib/modules/build")
> +                                 (string-append "M=" (getcwd) "/" module)))
> +                       (list "ddcci" "ddcci-backlight"))

It is a bit sad that we have to replicate 'build and 'install phases
because of those two subfolders. However, I can't see an easy way to
overcome this. Anyone?

> +a character device for each DDC/CI monitors in @file{/dev/bus/ddcci/[I²C bus number]}.
> +ddcci-backlight allow the control of the backlight level or luminance property when supported

As reported by guix lint, this line is too long. Also make sure that the
description starts by a full sentence, for instance: "This package
provides a pair of ...".

Can you send an updated patch?

Thanks,

Mathieu
Danny Milosavljevic Oct. 22, 2019, 1:06 p.m. UTC | #2
Hi,

On Tue, 22 Oct 2019 11:42:58 +0200
Mathieu Othacehe <m.othacehe@gmail.com> wrote:

> It is a bit sad that we have to replicate 'build and 'install phases
> because of those two subfolders. However, I can't see an easy way to
> overcome this. Anyone?

You could get the existing phase via (assoc-ref %standard-phases 'build) and call
it twice (and I would).

Also, you could create two packages and chdir in an extra phase before "build"
(I wouldn't do that).

The former:

(define-public ddcci-driver-linux
  (package
    (name "ddcci-driver-linux")
    (version "0.3.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f"))))
    (build-system linux-module-build-system)
    (arguments
     `(#:tests? #f                               ; no tests
       #:phases
       (modify-phases %standard-phases
         (replace 'build
           (lambda args
             (for-each (lambda (module)
                         (with-directory-excursion module
                           (apply (assoc-ref %standard-phases 'build) args)))
                       '("ddcci" "ddcci-backlight"))
             #t))
         (replace 'install
           (lambda args
             (for-each (lambda (module)
                         (with-directory-excursion module
                           (apply (assoc-ref %standard-phases 'install) args)))
                       '("ddcci" "ddcci-backlight"))
             #t)))))
    (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
    (synopsis "Linux kernel drivers for DDC/CI monitors")
    (description "Two Linux kernel drivers, ddcci and ddcci-backlight, that
allow the control of DDC/CI monitors through the sysfs interface. ddcci create
a character device for each DDC/CI monitors in @file{/dev/bus/ddcci/[I²C bus number]}.
ddcci-backlight allow the control of the backlight level or luminance property when supported
under @file{/sys/class/backlight/}.")
    (license license:gpl2+)))

@Brice:

Could you send an updated patch along those lines?
Brice Waegeneire Oct. 25, 2019, 9:32 a.m. UTC | #3
In this patch version I have taken into account the remarks of Mathieu on
line lenght and description phrasing. And followed Danny's take on the
modified phases; it's *much* nicer than my copy/paste from the
linux-module-build-system.
Brice Waegeneire Oct. 25, 2019, 10:24 a.m. UTC | #4
Hopefully this version is the last one needed.

Sorry for the trivial lint issue Mathieu. I have troble running it on my
forgin distro (NixOS), it always complain about certificates and stop
abruptly without reporting relevant information.
Mathieu Othacehe Oct. 25, 2019, 11:34 a.m. UTC | #5
> Sorry for the trivial lint issue Mathieu. I have troble running it on my
> forgin distro (NixOS), it always complain about certificates and stop
> abruptly without reporting relevant information.

No problem, I fixed some typos in description and pushed this patch.

Thanks,

Mathieu
diff mbox series

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 989d55f8aa..4a98c9e60e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -968,6 +968,65 @@  and should be used with caution, especially on untested models.")
 between the CDemu userspace daemon and linux kernel.")
     (license license:gpl2+)))
 
+
+(define-public ddcci-driver-linux
+  (package
+    (name "ddcci-driver-linux")
+    (version "0.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f"))))
+    (build-system linux-module-build-system)
+    (arguments
+     `(#:tests? #f                               ; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (for-each (lambda (module)
+                         (invoke "make" "-C"
+                                 (string-append (assoc-ref inputs "linux-module-builder")
+                                                "/lib/modules/build")
+                                 (string-append "M=" (getcwd) "/" module)))
+                       (list "ddcci" "ddcci-backlight"))
+             #t))
+         (replace 'install
+           (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (moddir (string-append out "/lib/modules"))
+                    (kmod (assoc-ref (or native-inputs inputs) "kmod")))
+               ;; Install kernel modules
+               (mkdir-p moddir)
+               (for-each (lambda (module)
+                           (invoke "make" "-C"
+                                   (string-append
+                                    (assoc-ref inputs "linux-module-builder")
+                                    "/lib/modules/build")
+                                   (string-append "M=" (getcwd) "/" module)
+                                   (string-append "DEPMOD=" kmod "/bin/depmod")
+                                   (string-append "MODULE_DIR=" moddir)
+                                   (string-append "INSTALL_PATH=" out)
+                                   (string-append "INSTALL_MOD_PATH=" out)
+                                   "INSTALL_MOD_STRIP=1"
+                                   "modules_install"))
+                         (list "ddcci" "ddcci-backlight")))
+             #t)))))
+    (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
+    (synopsis "A pair of Linux kernel drivers for DDC/CI monitors")
+    (description "Two Linux kernel drivers, ddcci and ddcci-backlight, that
+allow the control of DDC/CI monitors through the sysfs interface. ddcci create
+a character device for each DDC/CI monitors in @file{/dev/bus/ddcci/[I²C bus number]}.
+ddcci-backlight allow the control of the backlight level or luminance property when supported
+under @file{/sys/class/backlight/}.")
+    (license license:gpl2+)))
+
 
 ;;;
 ;;; Pluggable authentication modules (PAM).