guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49934] Hw-Probe


From: Ricardo Wurmus
Subject: [bug#49934] Hw-Probe
Date: Thu, 16 Dec 2021 06:53:22 +0100
User-agent: mu4e 1.6.10; emacs 28.0.50

Thanks for the patch!

I’m afraid the 'patch build phase is much too repetitive.  You can
greatly simplify it by doing a substitution like this:

--8<---------------cut here---------------start------------->8---
(substitute* "hw-probe.pl"
  (("Cmd\\(\"([^\"]+)" _ command)
   (string-append "Cmd(\"" (which command))))
--8<---------------cut here---------------end--------------->8---

The regular expression has a sub-group that matches everything after the
opening double quote until it hits another double quote.  That group is
captured as “command”.  We then look up that string in the build
environment with “which” (not the executable of the same name), which
returns the absolute file name corresponding to the command.

-- 
Ricardo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]