unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Bug reports for GNU Guix <bug-guix@gnu.org>
To: "Lenny Händler" <lenny@lennyhaendler.com>, 51798@debbugs.gnu.org
Cc: Josselin Poiret <dev@jpoiret.xyz>
Subject: bug#51798: [PATCH] gnu: bashtop: Add dependencies and wrap program with PATH
Date: Sun, 14 Nov 2021 14:01:37 +0000	[thread overview]
Message-ID: <20211114140137.13868-1-dev@jpoiret.xyz> (raw)
In-Reply-To: <0fe8420a-dae9-92e8-5dfb-b52260a7c669@lennyhaendler.com>

You're right, none of the needed dependencies of bashtop were
actually present in the package definition.  Here is a patch that
does work on my machine using `guix shell --pure bashtop -- bashtop`.

Best,
Josselin Poiret
-- >8 --

* gnu/packages/admin.scm (bashtop): Add dependencies, wrap the script
so that it can access the commands it needs.
---
 gnu/packages/admin.scm | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 2a7b0f310d..8f9125212c 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -71,6 +71,7 @@ (define-module (gnu packages admin)
   #:use-module (guix build-system python)
   #:use-module (guix build-system ruby)
   #:use-module (guix build-system trivial)
+  #:use-module (guix build-system copy)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -670,11 +671,29 @@ (define-public bashtop
               (sha256
                (base32
                 "07nlr6vmyb7yihaxj1fp424lmhwkdjl6mls92v90f6gsvikpa13v"))))
-    (build-system gnu-build-system)
+    (build-system copy-build-system)
     (arguments
-     '(#:make-flags (list (string-append "PREFIX=" %output))
-       #:tests? #f      ; bats test fails with loading load.bash
-       #:phases (modify-phases %standard-phases (delete 'configure))))
+     '(#:install-plan '(("./bashtop" "./bin/bashtop"))
+       #:phases (modify-phases %standard-phases
+		  (add-after 'install 'wrap
+	            (lambda* (#:key outputs #:allow-other-keys)
+		      (let ((paths (map (lambda (program)
+					  (dirname (which program)))
+					'("awk" "dd" "grep" "ip"
+					  "locale" "ps" "sed")))
+			    (bashtop (string-append (assoc-ref outputs
+							       "out")
+						    "/bin/bashtop")))
+			(wrap-program bashtop
+				      `("PATH" ":" = ,paths))))))))
+    (inputs
+     `(("coreutils" ,coreutils)
+       ("gawk" ,gawk)
+       ("glibc" ,glibc) ; for 'locale'
+       ("grep" ,grep)
+       ("iproute" ,iproute)
+       ("procps" ,procps)
+       ("sed" ,sed)))
     (home-page "https://github.com/aristocratos/bashtop")
     (synopsis "Linux/OSX/FreeBSD resource monitor")
     (description "Resource monitor that shows usage and stats for processor,
-- 
2.33.1





  reply	other threads:[~2021-11-14 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 22:55 bug#51798: bashtop does not run without glibc installed in profile Lenny Händler
2021-11-14 14:01 ` Josselin Poiret via Bug reports for GNU Guix [this message]
2021-11-14 15:19   ` bug#51798: [PATCH v2] gnu: bashtop: Add dependencies and wrap program with PATH Josselin Poiret via Bug reports for GNU Guix
2021-11-14 21:33     ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211114140137.13868-1-dev@jpoiret.xyz \
    --to=bug-guix@gnu.org \
    --cc=51798@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=lenny@lennyhaendler.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).