diff mbox series

[bug#64527,2/2] gnu: bees: Wrap script.

Message ID c9914a2d174b23191f969cccd2f04e0a2a39fa9e.1688787928.git.hako@ultrarare.space
State New
Headers show
Series [bug#64527,1/2] gnu: bees: Update to 0.10. | expand

Commit Message

Hilton Chain July 8, 2023, 3:49 a.m. UTC
* gnu/packages/file-systems.scm (bees)[arguments]<#:phases>: Remove 'fixpath.
Add 'wrap.
[inputs]: Add guile-3.0.
---
 gnu/packages/file-systems.scm | 38 +++++++++++++----------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

Comments

宋文武 July 18, 2023, 11:42 a.m. UTC | #1
Hilton Chain <hako@ultrarare.space> writes:

> * gnu/packages/file-systems.scm (bees)[arguments]<#:phases>: Remove 'fixpath.
> Add 'wrap.
> -                   (substitute* "scripts/beesd.in"
> [...]
> +                   (wrap-script (string-append #$output "/sbin/beesd")
> [...]

Hello, does the 'substitute*' broken?  or why should we prefer
wrap-script over hardcode paths in the original executables?

Also bee was updated to 0.10 already in commit 34d7eb9721.
Hilton Chain July 19, 2023, 1:44 p.m. UTC | #2
Hi,

On Tue, 18 Jul 2023 19:42:15 +0800,
宋文武 wrote:
> Hello, does the 'substitute*' broken?  or why should we prefer
> wrap-script over hardcode paths in the original executables?

Nevermind, I'm still confused about whether to make a wrapper or not.
But since it's not the preferred way (I thought it was), I'll reduce
its use in the future.

Thanks
diff mbox series

Patch

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index 0b024d6b92..52c8224ec1 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -1982,31 +1982,21 @@  (define-public bees
            #:phases
            #~(modify-phases %standard-phases
                (delete 'configure)
-               (add-after 'unpack 'fixpath
+               (add-after 'install 'wrap
                  (lambda* (#:key inputs #:allow-other-keys)
-                   (substitute* "scripts/beesd.in"
-                     (((string-append "\\<(" (string-join (list "realpath"
-                                                                "uuidparse"
-                                                                "grep"
-                                                                "false"
-                                                                "sed"
-                                                                "true"
-                                                                "head"
-                                                                "mkdir"
-                                                                "mount"
-                                                                "touch"
-                                                                "du"
-                                                                "cut"
-                                                                "rm"
-                                                                "truncate"
-                                                                "chmod")
-                                                          "|") ")\\>") command)
-                      (search-input-file inputs (string-append "/bin/" command)))
-
-                     (("btrfs sub")
-                      (string-append (search-input-file inputs "/bin/btrfs")
-                                     " sub"))))))))
-    (inputs (list btrfs-progs cityhash util-linux))
+                   (wrap-script (string-append #$output "/sbin/beesd")
+                     `("PATH" suffix
+                       ,(map (lambda (program)
+                               (dirname (search-input-file
+                                         inputs (string-append "/bin/" program))))
+                             '("btrfs" "grep" "sed"
+                               ;; Provided by `util-linux`:
+                               "uuidparse"
+                               ;; Provided by `coreutils`:
+                               ;;  "chmod" "cut" "du" "false" "head" "mkdir"
+                               ;;  "mount" "realpath" "rm" "touch" "true"
+                               "truncate")))))))))
+    (inputs (list btrfs-progs cityhash guile-3.0 util-linux))
     (home-page "https://github.com/Zygo/bees")
     (synopsis "Deduplication agent for btrfs file systems")
     (description