GNU bug report logs - #49254
[PATCH 1/4] gnu: Add wondershaper.

Previous Next

Package: guix-patches;

Reported by: Aljosha Papsch <ep <at> stern-data.com>

Date: Mon, 28 Jun 2021 15:25:01 UTC

Severity: normal

Tags: patch

Merged with 49255, 49256, 49257, 49258

To reply to this bug, email your comments to 49254 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#49254; Package guix-patches. (Mon, 28 Jun 2021 15:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aljosha Papsch <ep <at> stern-data.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 28 Jun 2021 15:25:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Aljosha Papsch <ep <at> stern-data.com>
To: guix-patches <at> gnu.org
Cc: Aljosha Papsch <ep <at> stern-data.com>
Subject: [PATCH 1/4] gnu: Add wondershaper.
Date: Mon, 28 Jun 2021 17:22:29 +0200
* gnu/packages/networking.scm (wondershaper): New variable.
---
 gnu/packages/networking.scm | 45 +++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 82c7a0161a..7374ad5dbc 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -65,6 +65,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -4196,3 +4197,47 @@ IPv6 Internet connectivity - it also works over IPv4.")
      ;; version. This exception does not (and cannot) modify any license terms
      ;; which apply to the Application, with which you must still comply
      license:lgpl3)))
+
+(define-public wondershaper
+  (package
+    (name "wondershaper")
+    (version "1.4.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/apapsch/wondershaper")
+         (commit "0987dbb0c360184b8aacf391646e19ea9ee78b10")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1hyivkpvr5pv8wg64i7vgpxib4allbp4v1ahp3qhc1d88rkw7gjs"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan '(("./wondershaper" "./bin/"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-shebangs 'patch-invoked-commands
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let* ((out          (assoc-ref outputs "out"))
+                    (bin          (string-append out "/bin")))
+               (substitute* (string-append bin "/wondershaper")
+                 (("^\\s*ip ")
+                  (string-append (which "ip") " "))
+                 (("^\\s*modprobe ")
+                  (string-append (which "modprobe") " "))
+                 (("^\\s*tc ")
+                  (string-append (which "tc") " "))))
+             #t)))))
+    (inputs
+     `(("iproute2" ,iproute)
+       ("kmod"     ,kmod)))
+    (synopsis "Command-line utility for limiting an adapter's bandwidth")
+    (description "Wonder Shaper allows the user to limit the bandwidth of one
+or more network adapters.  It does so by using iproute's tc command, but
+greatly simplifies its operation.  Wonder Shaper was first released by Bert
+Hubert in 2002.  A subsequent release added a command-line interface.  Wonder
+Shaper makes use of tc's Hierarchical Token Bucket (HTB) queue, ensuring good
+bandwidth management on high speed (above ten megabits) links.")
+    (home-page "https://github.com/magnific0/wondershaper")
+    (license license:gpl2)))
-- 
2.32.0





Merged 49254 49255 49256 49257 49258. Request was from Leo Prikler <leo.prikler <at> student.tugraz.at> to control <at> debbugs.gnu.org. (Mon, 28 Jun 2021 15:37:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#49254; Package guix-patches. (Wed, 30 Jun 2021 20:16:02 GMT) Full text and rfc822 format available.

Message #10 received at 49254 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Aljosha Papsch <ep <at> stern-data.com>, 49254 <at> debbugs.gnu.org
Subject: Re: [bug#49254] [PATCH 1/4] gnu: Add wondershaper.
Date: Wed, 30 Jun 2021 22:15:26 +0200
[Message part 1 (text/plain, inline)]
Aljosha Papsch schreef op ma 28-06-2021 om 17:22 [+0200]:
> +        (git-reference
> +         (url "https://github.com/apapsch/wondershaper")
> +         (commit "0987dbb0c360184b8aacf391646e19ea9ee78b10")))

Best add a comment like

  ;; Use a fork that allows overriding the configuration file

‘We’ usually try to use upstream versions.

> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "1hyivkpvr5pv8wg64i7vgpxib4allbp4v1ahp3qhc1d88rkw7gjs"))))
> +    (build-system copy-build-system)
> +    (arguments
> +     `(#:install-plan '(("./wondershaper" "./bin/"))
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'patch-shebangs 'patch-invoked-commands
> +           (lambda* (#:key outputs inputs #:allow-other-keys)
> +             (let* ((out          (assoc-ref outputs "out"))
> +                    (bin          (string-append out "/bin")))
> +               (substitute* (string-append bin "/wondershaper")
> +                 (("^\\s*ip ")
> +                  (string-append (which "ip") " "))

Using (which "blabla") is not correct when cross-compiling, as
"which" looks in $PATH, but "iproute2" (and "kmod") won't be
in $PATH when cross-compiling as they are 'inputs', not 'native-inputs'

You'd need (search-input-file inputs "/bin/ip")
(or maybe "/sbin/ip", I dunno). Actually, search-input-file is
in core-updates, but not yet on 'master', so instead do

  (string-append (assoc-ref inputs "iproute2") "/bin/ip")

or something like that.

Looking at the source code, I see

usage(){
cat  << EOF

so it seems you need to substitute "cat" as well (it is from coreutils).

I'd recommend copying "wondershaper.conf" somewhere
as well, and substituting "/etc/conf.d/wondershaper.conf" and "/etc/systemd/wondershaper.conf"
in 'wondershaper' appropriately, so it will have some defaults.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 4 years and 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.