diff mbox series

[bug#35345,2/2] gnu: tlp: Add required x86-energy-perf-policy input dependency.

Message ID CAFBTj=gX01d7iKBRWhu3tw+Mao=WeoS6Sq5cDCuXX0dbragGRQ@mail.gmail.com
State Accepted
Headers show
Series Add missing run-time dependency for TLP (Power management tool for Linux). | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Stefan Stefanović April 20, 2019, 4:48 p.m. UTC

Comments

Ludovic Courtès May 27, 2019, 2:43 p.m. UTC | #1
Hi,

Stefan Stefanović <stefanx2ovic@gmail.com> skribis:

> From a7264289ba328478a1dab1978fe080a5b4f392c2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
> Date: Sat, 20 Apr 2019 16:13:37 +0200
> Subject: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input
>  dependency.
>
> * gnu/packages/linux.scm (tlp)
> [inputs]: Add system specific x86-energy-perf-policy dependency.
> [arguments]<#:phases>['wrap]:
> Adjust bin-directory procedure to return #f on missing input,
> a guard against system specific input dependencies.
> Filter only strings in the path list. Reformat for-each block.
> Add x86-energy-perf-policy in bin-directory input-name list.

I reworded it to use ‘filter-map’ intead of (filter string? …).

> +              ,@(if (member (or (%current-target-system) (%current-system))
> +                            (package-supported-systems x86-energy-perf-policy))

This would not work, because ‘%current-target-system’ returns a
“triplet”, not a “system type”, so I’ve also rephrased it.

Let me know if something’s broken!

Thanks,
Ludo’.
Stefan Stefanović May 28, 2019, 6:21 p.m. UTC | #2
Hi,

The patch you made works fine on my system.
Sorry for the late response.

Your work on correcting, improving and applying my original patch is
appreciated,
thank you.

Stefan.

On 5/27/19, Ludovic Courtès <ludo@gnu.org> wrote:
> Hi,
>
> Stefan Stefanović <stefanx2ovic@gmail.com> skribis:
>
>> From a7264289ba328478a1dab1978fe080a5b4f392c2 Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
>> Date: Sat, 20 Apr 2019 16:13:37 +0200
>> Subject: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input
>>  dependency.
>>
>> * gnu/packages/linux.scm (tlp)
>> [inputs]: Add system specific x86-energy-perf-policy dependency.
>> [arguments]<#:phases>['wrap]:
>> Adjust bin-directory procedure to return #f on missing input,
>> a guard against system specific input dependencies.
>> Filter only strings in the path list. Reformat for-each block.
>> Add x86-energy-perf-policy in bin-directory input-name list.
>
> I reworded it to use ‘filter-map’ intead of (filter string? …).
>
>> +              ,@(if (member (or (%current-target-system)
>> (%current-system))
>> +                            (package-supported-systems
>> x86-energy-perf-policy))
>
> This would not work, because ‘%current-target-system’ returns a
> “triplet”, not a “system type”, so I’ve also rephrased it.
>
> Let me know if something’s broken!
>
> Thanks,
> Ludo’.
>
diff mbox series

Patch

From a7264289ba328478a1dab1978fe080a5b4f392c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Stefanovi=C4=87?= <stefanx2ovic@gmail.com>
Date: Sat, 20 Apr 2019 16:13:37 +0200
Subject: [PATCH 2/2] gnu: tlp: Add required x86-energy-perf-policy input
 dependency.

* gnu/packages/linux.scm (tlp)
[inputs]: Add system specific x86-energy-perf-policy dependency.
[arguments]<#:phases>['wrap]:
Adjust bin-directory procedure to return #f on missing input,
a guard against system specific input dependencies.
Filter only strings in the path list. Reformat for-each block.
Add x86-energy-perf-policy in bin-directory input-name list.
---
 gnu/packages/linux.scm | 56 ++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 88905b6b74..aa0eeef1b0 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4451,7 +4451,11 @@  interface in sysfs, which can be accomplished with the included udev rules.")
               ("sed" ,sed)
               ("usbutils" ,usbutils)
               ("util-linux" ,util-linux)
-              ("wireless-tools" ,wireless-tools)))
+              ("wireless-tools" ,wireless-tools)
+              ,@(if (member (or (%current-target-system) (%current-system))
+                            (package-supported-systems x86-energy-perf-policy))
+                    `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
+                    '())))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -4488,31 +4492,35 @@  interface in sysfs, which can be accomplished with the included udev rules.")
              (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
                     (bin-files (find-files bin ".*")))
                (define (bin-directory input-name)
-                 (string-append (assoc-ref inputs input-name) "/bin"))
+                 (let ((p (assoc-ref inputs input-name)))
+                   (and p (string-append p "/bin"))))
                (define (sbin-directory input-name)
                  (string-append (assoc-ref inputs input-name) "/sbin"))
-               (for-each (lambda (program)
-                           (wrap-program program
-                             `("PATH" ":" prefix
-                               ,(append
-                                 (map bin-directory '("bash"
-                                                      "coreutils"
-                                                      "dbus"
-                                                      "eudev"
-                                                      "grep"
-                                                      "inetutils"
-                                                      "kmod"
-                                                      "perl"
-                                                      "sed"
-                                                      "usbutils"
-                                                      "util-linux"))
-                                 (map sbin-directory '("ethtool"
-                                                       "hdparm"
-                                                       "iw"
-                                                       "pciutils"
-                                                       "rfkill"
-                                                       "wireless-tools"))))))
-                         bin-files)
+               (for-each
+                (lambda (program)
+                  (wrap-program program
+                    `("PATH" ":" prefix
+                      ,(filter string?
+                               (append
+                                (map bin-directory '("bash"
+                                                     "coreutils"
+                                                     "dbus"
+                                                     "eudev"
+                                                     "grep"
+                                                     "inetutils"
+                                                     "kmod"
+                                                     "perl"
+                                                     "sed"
+                                                     "usbutils"
+                                                     "util-linux"
+                                                     "x86-energy-perf-policy"))
+                                (map sbin-directory '("ethtool"
+                                                      "hdparm"
+                                                      "iw"
+                                                      "pciutils"
+                                                      "rfkill"
+                                                      "wireless-tools")))))))
+                bin-files)
                #t))))))
     (home-page "http://linrunner.de/en/tlp/tlp.html")
     (synopsis "Power management tool for Linux")
-- 
2.21.0