[PATCH 1/4] New package: bird bgp daemon, versions 1 and 2

OpenSubmitted by Ryan Sundberg.
Details
2 participants
  • Maxime Devos
  • Ryan Sundberg
Owner
unassigned
Severity
normal
R
R
Ryan Sundberg wrote on 6 Jun 2021 20:52
(address . guix-patches@gnu.org)(name . Ryan Sundberg)(address . ryan@arctype.co)
20210606185204.17617-1-ryan@arctype.co
Adds the bird BGP daemon to gnu/packages/bird.scm
---
gnu/packages/bird.scm | 74 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
create mode 100644 gnu/packages/bird.scm

Toggle diff (82 lines)
diff --git a/gnu/packages/bird.scm b/gnu/packages/bird.scm
new file mode 100644
index 0000000000..5fac395906
--- /dev/null
+++ b/gnu/packages/bird.scm
@@ -0,0 +1,74 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages bird)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages bison)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages readline)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix licenses))
+
+(define-public bird-1
+  (package
+    (name "bird")
+    (version "1.6.7")
+    (source 
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://gitlab.nic.cz/labs/bird.git")
+               (commit (string-append "v" version))))
+        (sha256 (base32 "0vbjp42c2zqmcrqcwm4g4fq1v93l6rlk0c27i0k08f3v07w75cih"))))
+    (build-system gnu-build-system)
+    (arguments
+      `(#:configure-flags '("--enable-ipv6")
+        #:tests? #f
+        #:phases (modify-phases %standard-phases
+                                ; Fix "cc not found" in tools/mergedirs
+                                (add-after 'bootstrap 'set-cc
+                                           (lambda _ 
+                                             (setenv "CPP" "gcc -E")
+                                             #t)))))
+    (inputs
+      `(("autoconf" ,autoconf)
+        ("bison" ,bison)
+        ("flex" ,flex)
+        ("ncurses" ,ncurses)
+        ("readline" ,readline)))
+    (home-page "http://bird.network.cz/")
+    (synopsis "BIRD Internet Routing Daemon")
+    (description "The BIRD project aims to develop a dynamic IP routing daemon with full support of all modern routing protocols, easy to use configuration interface and powerful route filtering language, primarily targeted on (but not limited to) Linux and other UNIX-like systems and distributed under the GNU General Public License.")
+    (license gpl2+)))
+
+(define-public bird
+  (package
+    (inherit bird-1)
+    (version "2.0.8")
+    (source 
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://gitlab.nic.cz/labs/bird.git")
+               (commit (string-append "v" version))))
+        (sha256 (base32 "07mh41hsmkcpf6f6lnygzp6g59jma542pcqdkl54ysiqnjmi5zz1"))))
+    (arguments
+      `(#:configure-flags '("--enable-ipv6")))))
-- 
2.31.1
R
R
Ryan Sundberg wrote on 6 Jun 2021 20:52
[PATCH 2/4] Ceph: patch rbd to use $PATH lookups for modprobe
(address . guix-patches@gnu.org)(name . Ryan Sundberg)(address . ryan@arctype.co)
20210606185204.17617-2-ryan@arctype.co
Removes hardcoded paths assumed in /sbin and /bin compiled into the
`rbd` tool.

Patch originally discussed at https://github.com/ceph/ceph/pull/20938
and rejected by upstream for ambiguous security concerns related to
relative paths.
---
.../patches/ceph-relative-paths.patch | 22 +++++++++++++++++++
gnu/packages/storage.scm | 2 +-
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/ceph-relative-paths.patch

Toggle diff (43 lines)
diff --git a/gnu/packages/patches/ceph-relative-paths.patch b/gnu/packages/patches/ceph-relative-paths.patch
new file mode 100644
index 0000000000..e1b1d3599f
--- /dev/null
+++ b/gnu/packages/patches/ceph-relative-paths.patch
@@ -0,0 +1,22 @@
+diff --git a/src/common/module.c b/src/common/module.c
+index f19f74324c..53355b8185 100644
+--- a/src/common/module.c
++++ b/src/common/module.c
+@@ -66,7 +66,7 @@ int module_has_param(const char *module, const char *param)
+ 	char command[128];
+ 
+ 	snprintf(command, sizeof(command),
+-		 "/sbin/modinfo -F parm %s | /bin/grep -q ^%s:",
++		 "modinfo -F parm %s | grep -q ^%s:",
+ 		 module, param);
+ 
+ 	return run_command(command) == 0;
+@@ -76,7 +76,7 @@ int module_load(const char *module, const char *options)
+ {
+ 	char command[128];
+ 
+-	snprintf(command, sizeof(command), "/sbin/modprobe %s %s",
++	snprintf(command, sizeof(command), "modprobe %s %s",
+ 		 module, (options ? options : ""));
+ 
+ 	return run_command(command);
diff --git a/gnu/packages/storage.scm b/gnu/packages/storage.scm
index d53327df75..b4f7d5e301 100644
--- a/gnu/packages/storage.scm
+++ b/gnu/packages/storage.scm
@@ -64,7 +64,7 @@
                (base32
                 "0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh"))
               (patches
-               (search-patches "ceph-disable-cpu-optimizations.patch"))
+               (search-patches "ceph-disable-cpu-optimizations.patch" "ceph-relative-paths.patch"))
               (modules '((guix build utils)))
               (snippet
                '(begin
-- 
2.31.1
R
R
Ryan Sundberg wrote on 6 Jun 2021 20:52
[PATCH 4/4] bpftool: new package
(address . guix-patches@gnu.org)(name . Ryan Sundberg)(address . ryan@arctype.co)
20210606185204.17617-4-ryan@arctype.co
Adds the bpftool package from the Linux kernel source tree.
---
gnu/packages/linux.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Toggle diff (57 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c8ec310665..06bb344475 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -54,6 +54,7 @@
 ;;; Copyright © 2020 David Dashyan <mail@davie.li>
 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
 ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8108,3 +8109,42 @@ Availability and Serviceability} reports from Linux kernel trace events.
 These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
 through standard log mechanisms like syslog.")
     (license license:gpl2)))
+
+(define-public bpftool
+  (package
+    (name "bpftool")
+    (version (package-version linux-libre))
+    (source (package-source linux-libre))
+    (build-system gnu-build-system)
+    (arguments
+      `(#:tests? #f
+        #:phases 
+        (modify-phases %standard-phases
+          (add-before 'configure 'chdir 
+            (lambda _ (chdir "tools/bpf") #t))
+          (delete 'configure)
+          (replace 'build 
+            (lambda _ (invoke "make" "CC=gcc" "bpftool") #t))
+          (replace 'install 
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))) 
+                (mkdir-p (string-append out "/sbin"))
+                (mkdir-p (string-append out "/share/bash-completion/completions"))
+                (invoke "make" 
+                        (string-append "prefix=" out)
+                        (string-append "bash_compdir=" out "/share/bash-completion/completions")
+                        "-C" "bpftool"
+                        "install")
+                #t))))))
+    (inputs
+      `(("bison" ,bison)
+        ("python" ,python-3)
+        ("readline" ,readline)))
+    (propagated-inputs
+      `(("libcap" ,libcap)
+        ("libelf" ,libelf)
+        ("zlib" ,zlib)))
+    (home-page (package-home-page linux-libre))
+    (synopsis "bpftool is a tool for inspection and simple manipulation of eBPF programs and maps")
+    (description "*bpftool* allows for inspection and simple modification of BPF objects on the system.  Note that format of the output of all tools is not guaranteed to be stable and should not be depended upon.")
+    (license (package-license linux-libre))))
-- 
2.31.1
R
R
Ryan Sundberg wrote on 6 Jun 2021 20:52
[PATCH 3/4] Ceph: upgrade minor version to latest stable release (14.2.21)
(address . guix-patches@gnu.org)(name . Ryan Sundberg)(address . ryan@arctype.co)
20210606185204.17617-3-ryan@arctype.co
---
gnu/packages/storage.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/storage.scm b/gnu/packages/storage.scm
index b4f7d5e301..9e64b9417f 100644
--- a/gnu/packages/storage.scm
+++ b/gnu/packages/storage.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,14 +56,14 @@
 (define-public ceph
   (package
     (name "ceph")
-    (version "14.2.16")
+    (version "14.2.21")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://download.ceph.com/tarballs/ceph-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh"))
+                "1hhdxrmp7a8n00kmx9s4bib84dvfal98x7i9c65p4q6nknlcdvdw"))
               (patches
                (search-patches "ceph-disable-cpu-optimizations.patch" "ceph-relative-paths.patch"))
               (modules '((guix build utils)))
@@ -76,7 +77,6 @@
                               ;"src/zstd"
                               ;"src/civetweb"
                               ;"src/seastar/fmt"
-                              "src/test/downloads"
                               "src/c-ares"
                               "src/googletest"
                               "src/rapidjson"
-- 
2.31.1
M
M
Maxime Devos wrote on 7 Jun 2021 11:35
Re: [bug#48889] [PATCH 1/4] New package: bird bgp daemon, versions 1 and 2
aa14f41eefafa12b086fd826ce65730174d0ba69.camel@telenet.be
Hi,

Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]:
Toggle quote (2 lines)
> Adds the bird BGP daemon to gnu/packages/bird.scm

See commits (e.g. git log -n9) for how to format commit messages.

Toggle quote (11 lines)
> ---
> gnu/packages/bird.scm | 74 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 74 insertions(+)
> create mode 100644 gnu/packages/bird.scm
>
> diff --git a/gnu/packages/bird.scm b/gnu/packages/bird.scm
> new file mode 100644
> index 0000000000..5fac395906
> --- /dev/null
> +++ b/gnu/packages/bird.scm

Maybe gnu/packages/networking.scm, instead of creating a new
module for a single package.

Toggle quote (7 lines)
> + #:phases (modify-phases %standard-phases
> + ; Fix "cc not found" in tools/mergedirs
> + (add-after 'bootstrap 'set-cc
> + (lambda _
> + (setenv "CPP" "gcc -E")
> + #t)))))

This most likely should be ,(string-append (cc-for-target) " -E"), to
make sure cross-compiling works. Also, the more declarative #:make-flags
is preferred above imperative setenv.

Toggle quote (5 lines)
> + (inputs
> + `(("autoconf" ,autoconf)
> + ("bison" ,bison)
> + ("flex" ,flex)

autoconf, bison & flex most likely should be native inputs.

Toggle quote (7 lines)
> + ("ncurses" ,ncurses)
> + ("readline" ,readline)))
> + (home-page "http://bird.network.cz/")
> + (synopsis "BIRD Internet Routing Daemon")
> + (description "The BIRD project aims to develop a dynamic IP routing daemon with full support of all modern routing protocols, easy to use configuration interface and powerful route filtering language, primarily targeted on (but not limited to) Linux and other UNIX-like systems and distributed under the GNU General Public License.")
> + (license gpl2+)))

The description line is too long.
./pre-inst-env guix lint bird@1.6.7 should detect that.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYL3oWRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hR6AQCtuGRi57sjeXSEode7Xks0lOAB
iIUpDETJIxT52t3utQD/YNCV+cZP1Z7rVh3LpCznYZ0Uy2QRs26cEYmjWaUhZw0=
=bTxw
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 7 Jun 2021 11:40
Re: [bug#48889] [PATCH 2/4] Ceph: patch rbd to use $PATH lookups for modprobe
cc3784abbd2d48a1749209ef18eb41b206d62761.camel@telenet.be
Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]:
Toggle quote (29 lines)
> Removes hardcoded paths assumed in /sbin and /bin compiled into the
> `rbd` tool.
>
> Patch originally discussed at https://github.com/ceph/ceph/pull/20938
> and rejected by upstream for ambiguous security concerns related to
> relative paths.
> ---
> .../patches/ceph-relative-paths.patch | 22 +++++++++++++++++++
> gnu/packages/storage.scm | 2 +-
> 2 files changed, 23 insertions(+), 1 deletion(-)
> create mode 100644 gnu/packages/patches/ceph-relative-paths.patch
>
> diff --git a/gnu/packages/patches/ceph-relative-paths.patch b/gnu/packages/patches/ceph-relative-paths.patch
> new file mode 100644
> index 0000000000..e1b1d3599f
> --- /dev/null
> +++ b/gnu/packages/patches/ceph-relative-paths.patch
> @@ -0,0 +1,22 @@
> +diff --git a/src/common/module.c b/src/common/module.c
> +index f19f74324c..53355b8185 100644
> +--- a/src/common/module.c
> ++++ b/src/common/module.c
> +@@ -66,7 +66,7 @@ int module_has_param(const char *module, const char *param)
> + char command[128];
> +
> + snprintf(command, sizeof(command),
> +- "/sbin/modinfo -F parm %s | /bin/grep -q ^%s:",
> ++ "modinfo -F parm %s | grep -q ^%s:",

modinfo is not necessarily in the profile. I'd recommend
using substitute* from a build phase to replace
/sbin/modinfo with the appropriate /gnu/store path.
((string-append (assoc-ref inputs "???") "/sbin/modinfo")
or something like that, were you'll need to replace "???")

Toggle quote (4 lines)
> +- snprintf(command, sizeof(command), "/sbin/modprobe %s %s",
> ++ snprintf(command, sizeof(command), "modprobe %s %s",
> + module, (options ? options : ""));

Likewise.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYL3prBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qdpAQCk3YWvoRgiWH0OwYgPtRrv1gSk
UEFjwdHwxn7+VpGC3gEA+NdZ567jcb/wuiG6e3kN5dxib7UE1eIredi6tMpueAs=
=YRN8
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 7 Jun 2021 11:50
Re: [bug#48889] [PATCH 4/4] bpftool: new package
95c21dc7fa0e9c6864df06b307f3375d511847a8.camel@telenet.be
Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]:
Toggle quote (31 lines)
> Adds the bpftool package from the Linux kernel source tree.
> ---
> gnu/packages/linux.scm | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
> index c8ec310665..06bb344475 100644
> --- a/gnu/packages/linux.scm
> +++ b/gnu/packages/linux.scm
> @@ -54,6 +54,7 @@
> ;;; Copyright © 2020 David Dashyan <mail@davie.li>
> ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
> ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
> +;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -8108,3 +8109,42 @@ Availability and Serviceability} reports from Linux kernel trace events.
> These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
> through standard log mechanisms like syslog.")
> (license license:gpl2)))
> +
> +(define-public bpftool
> + (package
> + (name "bpftool")
> + (version (package-version linux-libre))
> + (source (package-source linux-libre))
> + (build-system gnu-build-system)
> + (arguments
> + `(#:tests? #f

Why are tests disabled?

Toggle quote (8 lines)
> + #:phases
> + (modify-phases %standard-phases
> + (add-before 'configure 'chdir
> + (lambda _ (chdir "tools/bpf") #t))
> + (delete 'configure)
> + (replace 'build
> + (lambda _ (invoke "make" "CC=gcc" "bpftool") #t))

Use ,(string-append "CC=" (cc-for-target)), to make sure cross-compiling bpftools
works.

Toggle quote (14 lines)
> + (replace 'install
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out")))
> + (mkdir-p (string-append out "/sbin"))
> + (mkdir-p (string-append out "/share/bash-completion/completions"))
> + (invoke "make"
> + (string-append "prefix=" out)
> + (string-append "bash_compdir=" out "/share/bash-completion/completions")
> + "-C" "bpftool"
> + "install")
> + #t))))))
> + (inputs
> + `(("bison" ,bison)

Bison looks like a native input to me.

Toggle quote (2 lines)
> + ("python" ,python-3)

Could be input, could be native-input. I don't know what's appropriate for bpftools.

You can check with
./pre-inst-env guix build bpftools --target=aarch64-linux-gnu

If there is "command not found: python" or something like that,
you'll need to move python to native-inputs.

Toggle quote (6 lines)
> + ("readline" ,readline)))
> + (propagated-inputs
> + `(("libcap" ,libcap)
> + ("libelf" ,libelf)
> + ("zlib" ,zlib)))

bpftool is a tool, and not a library, right?
Then these libraries should be in inputs, not propagated-inputs,
to avoid polluting the profile.

bpftool should still have access to these libraries by ELF's RPATH
or something like that.

Toggle quote (2 lines)
> + (home-page (package-home-page linux-libre))

I don't see anything about bpftools on https://www.gnu.org/software/linux-libre/.
Maybe bpftools has a wiki somewhere?

Toggle quote (3 lines)
> + (synopsis "bpftool is a tool for inspection and simple manipulation of eBPF programs and maps")
> + (description "*bpftool* allows for inspection and simple modification of BPF objects on the system. Note that format of the output of all tools is not guaranteed to be stable and should not be depended upon.")

Line is too long. Also, what's up with surrounding bpftools with *asterisks*?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYL3r5xccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7tZnAP4w6ax7410R6Llv1PpzKReLDD3a
lB81L0kxY+3VXGUu3wEA+vWAOWv438Hb78+9uF8U80TqowvR014O3Yghk4U6GwI=
=yDST
-----END PGP SIGNATURE-----


R
R
Ryan Sundberg wrote on 9 Jun 2021 08:50
Re: [bug#48889] [PATCH 1/4] New package: bird bgp daemon, versions 1 and 2
d25c44db-259e-fed6-73a9-ac6d0ed536f8@arctype.co
Hi Maxime, thanks for the good feedback. Please see the revised patch here.

--
Sincerely,
Ryan Sundberg

On 6/7/21 2:35 AM, Maxime Devos wrote:
Toggle quote (52 lines)
> Hi,
>
> Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]:
>> Adds the bird BGP daemon to gnu/packages/bird.scm
>
> See commits (e.g. git log -n9) for how to format commit messages.
>
>> ---
>> gnu/packages/bird.scm | 74 +++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 74 insertions(+)
>> create mode 100644 gnu/packages/bird.scm
>>
>> diff --git a/gnu/packages/bird.scm b/gnu/packages/bird.scm
>> new file mode 100644
>> index 0000000000..5fac395906
>> --- /dev/null
>> +++ b/gnu/packages/bird.scm
>
> Maybe gnu/packages/networking.scm, instead of creating a new
> module for a single package.
>
>> + #:phases (modify-phases %standard-phases
>> + ; Fix "cc not found" in tools/mergedirs
>> + (add-after 'bootstrap 'set-cc
>> + (lambda _
>> + (setenv "CPP" "gcc -E")
>> + #t)))))
>
> This most likely should be ,(string-append (cc-for-target) " -E"), to
> make sure cross-compiling works. Also, the more declarative #:make-flags
> is preferred above imperative setenv.
>
>> + (inputs
>> + `(("autoconf" ,autoconf)
>> + ("bison" ,bison)
>> + ("flex" ,flex)
>
> autoconf, bison & flex most likely should be native inputs.
>
>> + ("ncurses" ,ncurses)
>> + ("readline" ,readline)))
>> + (home-page "http://bird.network.cz/")
>> + (synopsis "BIRD Internet Routing Daemon")
>> + (description "The BIRD project aims to develop a dynamic IP routing daemon with full support of all modern routing protocols, easy to use configuration interface and powerful route filtering language, primarily targeted on (but not limited to) Linux and other UNIX-like systems and distributed under the GNU General Public License.")
>> + (license gpl2+)))
>
> The description line is too long.
> ./pre-inst-env guix lint bird@1.6.7 should detect that.
>
> Greetings,
> Maxime.
>
From 4cff7f7e80dd2e46705675aa14d14d95a7ee9a9d Mon Sep 17 00:00:00 2001
From: Ryan Sundberg <ryan@arctype.co>
Date: Fri, 4 Jun 2021 20:53:11 -0700
Subject: [PATCH 1/5] gnu: Add bird versions 1.6.7 and 2.0.8

* gnu/packages/networking.scm (bird): New variable.
{bird-1}: New variable.

Signed-off-by: Ryan Sundberg <ryan@arctype.co>
---
gnu/packages/networking.scm | 52 +++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 462215c0f1..6ab23f4ae3 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -43,6 +43,7 @@
 ;;; Copyright © 2020 Hamzeh Nasajpour <h.nasajpour@pantherx.org>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4196,3 +4197,54 @@ 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 bird-1
+  (package
+    (name "bird")
+    (version "1.6.7")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://gitlab.nic.cz/labs/bird.git")
+               (commit (string-append "v" version))))
+        (sha256 (base32 "0vbjp42c2zqmcrqcwm4g4fq1v93l6rlk0c27i0k08f3v07w75cih"))))
+    (build-system gnu-build-system)
+    (arguments
+      `(#:configure-flags '("--enable-ipv6")
+        #:tests? #f ; No tests defined for bird 1
+        #:phases
+        (modify-phases
+          %standard-phases
+          ; Fix "cc not found" in tools/mergedirs
+          (add-after 'bootstrap 'set-cc
+                     (lambda _
+                       (setenv "CPP" ,(string-append (cc-for-target) " -E"))
+                       #t)))))
+    (inputs
+      `(("ncurses" ,ncurses)
+        ("readline" ,readline)))
+    (native-inputs
+      `(("autoconf" ,autoconf)
+        ("bison" ,bison)
+        ("flex" ,flex)))
+    (home-page "http://bird.network.cz/")
+    (synopsis "BIRD Internet Routing Daemon")
+    (description "The BIRD project aims to develop a dynamic IP routing daemon
+with full support of all modern routing protocols, easy to use configuration
+interface and powerful route filtering language.")
+    (license license:gpl2+)))
+
+(define-public bird
+  (package
+    (inherit bird-1)
+    (version "2.0.8")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://gitlab.nic.cz/labs/bird.git")
+               (commit (string-append "v" version))))
+        (sha256 (base32 "07mh41hsmkcpf6f6lnygzp6g59jma542pcqdkl54ysiqnjmi5zz1"))))
+    (arguments
+      `(#:configure-flags '("--enable-ipv6")))))
-- 
2.31.1
Attachment: OpenPGP_signature
R
R
Ryan Sundberg wrote on 9 Jun 2021 09:06
Re: [bug#48889] [PATCH 4/4] bpftool: new package
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 48889@debbugs.gnu.org)
9f6bfb31-ad8a-a45f-2c80-e4423647aa28@arctype.co
Here is the revised bpftool patch. Responses below.

--
Sincerely,
Ryan Sundberg

On 6/7/21 2:50 AM, Maxime Devos wrote:
Toggle quote (20 lines)
> Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]:
>> Adds the bpftool package from the Linux kernel source tree.
>> ---
>> gnu/packages/linux.scm | 40 ++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 40 insertions(+)
>>
>> diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
>> index c8ec310665..06bb344475 100644
>> --- a/gnu/packages/linux.scm
>> +++ b/gnu/packages/linux.scm
>> @@ -54,6 +54,7 @@
>> ;;; Copyright © 2020 David Dashyan <mail@davie.li>
>> ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
>> ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
>> +;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
>> ;;;
>> ;;; This file is part of GNU Guix.
>> ;;;
>> @@ -8108,3 +8109,42 @@ Availability and Serviceability} reports from Linux kernel trace events.
>> These trace events are logged in @file{/sys/kernel/debug/tracing} and
reported
Toggle quote (13 lines)
>> through standard log mechanisms like syslog.")
>> (license license:gpl2)))
>> +
>> +(define-public bpftool
>> + (package
>> + (name "bpftool")
>> + (version (package-version linux-libre))
>> + (source (package-source linux-libre))
>> + (build-system gnu-build-system)
>> + (arguments
>> + `(#:tests? #f
>
> Why are tests disabled?
This program has no tests. I commented as such in the new patch.
Toggle quote (31 lines)
>
>> + #:phases
>> + (modify-phases %standard-phases
>> + (add-before 'configure 'chdir
>> + (lambda _ (chdir "tools/bpf") #t))
>> + (delete 'configure)
>> + (replace 'build
>> + (lambda _ (invoke "make" "CC=gcc" "bpftool") #t))
>
> Use ,(string-append "CC=" (cc-for-target)), to make sure cross-compiling bpftools
> works.
>
>> + (replace 'install
>> + (lambda* (#:key outputs #:allow-other-keys)
>> + (let* ((out (assoc-ref outputs "out")))
>> + (mkdir-p (string-append out "/sbin"))
>> + (mkdir-p (string-append out "/share/bash-completion/completions"))
>> + (invoke "make"
>> + (string-append "prefix=" out)
>> + (string-append "bash_compdir=" out "/share/bash-completion/completions")
>> + "-C" "bpftool"
>> + "install")
>> + #t))))))
>> + (inputs
>> + `(("bison" ,bison)
>
> Bison looks like a native input to me.
>
>> + ("python" ,python-3)
>
> Could be input, could be native-input. I don't know what's appropriate for bpftools.
You are right, python should be a native-input.

Toggle quote (3 lines)
>
> You can check with
> ./pre-inst-env guix build bpftools --target=aarch64-linux-gnu
Cross-compiling produced this linker error I'm not sure how to deal with
right now:

ld: staticobjs/libbpf.o: error adding symbols: file in wrong format

Toggle quote (21 lines)
>
> If there is "command not found: python" or something like that,
> you'll need to move python to native-inputs.
>
>> + ("readline" ,readline)))
>> + (propagated-inputs
>> + `(("libcap" ,libcap)
>> + ("libelf" ,libelf)
>> + ("zlib" ,zlib)))
>
> bpftool is a tool, and not a library, right?
> Then these libraries should be in inputs, not propagated-inputs,
> to avoid polluting the profile.
>
> bpftool should still have access to these libraries by ELF's RPATH
> or something like that.
>
>> + (home-page (package-home-page linux-libre))
>
> I don't see anything about bpftools on <https://www.gnu.org/software/linux-libre/>.
> Maybe bpftools has a wiki somewhere?
I linked https://lwn.net/Articles/739357/as the new home-page, which is
the closest this program gets to online documentation that I could find.

Toggle quote (3 lines)
>
>> + (synopsis "bpftool is a tool for inspection and simple manipulation of eBPF programs and maps")
>> + (description "*bpftool* allows for inspection and simple modification of BPF objects on the system. Note that format of the output of all
tools is not guaranteed to be stable and should not be depended upon.")
Toggle quote (2 lines)
>
> Line is too long. Also, what's up with surrounding bpftools with *asterisks*?
Copy-paste error
Toggle quote (4 lines)
>
> Greetings,
> Maxime.
>
From 87104ca47671801f34848326a17f4eb453dc3c9a Mon Sep 17 00:00:00 2001
From: Ryan Sundberg <ryan@arctype.co>
Date: Sun, 6 Jun 2021 09:53:43 -0700
Subject: [PATCH] gnu: Add bpftool in sync with the Linux kernel version.

* gnu/packages/linux.scm (bpftool): New variable

Signed-off-by: Ryan Sundberg <ryan@arctype.co>
---
gnu/packages/linux.scm | 46 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

Toggle diff (63 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c8ec310665..5d4d1669c2 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -54,6 +54,7 @@
 ;;; Copyright © 2020 David Dashyan <mail@davie.li>
 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
 ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8108,3 +8109,48 @@ Availability and Serviceability} reports from Linux kernel trace events.
 These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
 through standard log mechanisms like syslog.")
     (license license:gpl2)))
+
+(define-public bpftool
+  (package
+    (name "bpftool")
+    (version (package-version linux-libre))
+    (source (package-source linux-libre))
+    (build-system gnu-build-system)
+    (arguments
+      `(#:tests? #f ; This package has no tests.
+        #:phases
+        (modify-phases %standard-phases
+          (add-before 'configure 'chdir
+            (lambda _ (chdir "tools/bpf") #t))
+          (delete 'configure)
+          (replace 'build
+            (lambda _ (invoke "make"
+                              ,(string-append "CC=" (cc-for-target))
+                              "bpftool")
+              #t))
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out")))
+                (mkdir-p (string-append out "/sbin"))
+                (mkdir-p (string-append out "/share/bash-completion/completions"))
+                (invoke "make"
+                        (string-append "prefix=" out)
+                        (string-append "bash_compdir=" out
+                                       "/share/bash-completion/completions")
+                        "-C" "bpftool"
+                        "install")
+                #t))))))
+    (inputs
+      `(("readline" ,readline)
+        ("libcap" ,libcap)
+        ("libelf" ,libelf)
+        ("zlib" ,zlib)))
+    (native-inputs
+      `(("bison" ,bison)
+        ("python" ,python-3)))
+    ; This tool does not have a proper web page.
+    (home-page "https://lwn.net/Articles/739357/")
+    (synopsis "Tool for inspection and simple manipulation of eBPF programs and maps")
+    (description "bpftool allows for inspection and simple modification of BPF
+objects on the system.")
+    (license (package-license linux-libre))))
-- 
2.31.1
Attachment: OpenPGP_signature
R
R
Ryan Sundberg wrote on 18 Jun 2021 17:40
Re: [bug#48889] [PATCH 1/4] New package: bird bgp daemon, versions 1 and 2
(address . guix-patches@gnu.org)
121011e9-4626-bdd1-ab77-cfef163b903e@arctype.co
Hello Guix, here is one more version of this patch to add the bird
daemon. This time it builds both bird and bird6 individually for bird
version 1.x, since --enable-ipv6 is a mutually exclusive config
option,the binaries have to be built separately.



--
Sincerely,
Ryan Sundberg

On 6/8/21 11:50 PM, Ryan Sundberg via Guix-patches via wrote:
Toggle quote (51 lines)
> Hi Maxime, thanks for the good feedback. Please see the revised patch here.
>
> --
> Sincerely,
> Ryan Sundberg
>
> On 6/7/21 2:35 AM, Maxime Devos wrote:
>> Hi,
>>
>> Ryan Sundberg via Guix-patches via schreef op zo 06-06-2021 om 11:52 [-0700]:
>>> Adds the bird BGP daemon to gnu/packages/bird.scm
>>
>> See commits (e.g. git log -n9) for how to format commit messages.
>>
>>> ---
>>> gnu/packages/bird.scm | 74 +++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 74 insertions(+)
>>> create mode 100644 gnu/packages/bird.scm
>>>
>>> diff --git a/gnu/packages/bird.scm b/gnu/packages/bird.scm
>>> new file mode 100644
>>> index 0000000000..5fac395906
>>> --- /dev/null
>>> +++ b/gnu/packages/bird.scm
>>
>> Maybe gnu/packages/networking.scm, instead of creating a new
>> module for a single package.
>>
>>> + #:phases (modify-phases %standard-phases
>>> + ; Fix "cc not found" in tools/mergedirs
>>> + (add-after 'bootstrap 'set-cc
>>> + (lambda _
>>> + (setenv "CPP" "gcc -E")
>>> + #t)))))
>>
>> This most likely should be ,(string-append (cc-for-target) " -E"), to
>> make sure cross-compiling works. Also, the more declarative #:make-flags
>> is preferred above imperative setenv.
>>
>>> + (inputs
>>> + `(("autoconf" ,autoconf)
>>> + ("bison" ,bison)
>>> + ("flex" ,flex)
>>
>> autoconf, bison & flex most likely should be native inputs.
>>
>>> + ("ncurses" ,ncurses)
>>> + ("readline" ,readline)))
>>> + (home-page "http://bird.network.cz/")
>>> + (synopsis "BIRD Internet Routing Daemon")
>>> + (description "The BIRD project aims to develop a dynamic IP routing daemon with full support of all modern routing protocols, easy to use
configuration interface and powerful route filtering language, primarily targeted on (but not limited to) Linux and other UNIX-like systems and distributed under the GNU General Public License.")
Toggle quote (8 lines)
>>> + (license gpl2+)))
>>
>> The description line is too long.
>> ./pre-inst-env guix lint bird@1.6.7 should detect that.
>>
>> Greetings,
>> Maxime.
>>
From ed01b4254a54e43ce66d910c780b5a1ee885e243 Mon Sep 17 00:00:00 2001
From: Ryan Sundberg <ryan@arctype.co>
Date: Fri, 4 Jun 2021 20:53:11 -0700
Subject: [PATCH] gnu: Add bird versions 1.6.7 and 2.0.8

* gnu/packages/networking.scm (bird): New variable.
{bird-1}: New variable.
---
gnu/packages/networking.scm | 63 +++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)

Toggle diff (81 lines)
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index f7357a263b..0c14331a5b 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -43,6 +43,7 @@
 ;;; Copyright © 2020 Hamzeh Nasajpour <h.nasajpour@pantherx.org>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4199,3 +4200,65 @@ 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 configure-bird6
+  `(lambda* (#:key #:allow-other-keys #:rest args)
+     (let ((configure-phase (assoc-ref %standard-phases 'configure)))
+       (apply 
+         configure-phase 
+         (append args '(#:configure-flags ("--enable-ipv6")))))))
+
+(define-public bird-1
+  (package
+    (name "bird")
+    (version "1.6.7")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://gitlab.nic.cz/labs/bird.git")
+               (commit (string-append "v" version))))
+        (sha256 (base32 "0vbjp42c2zqmcrqcwm4g4fq1v93l6rlk0c27i0k08f3v07w75cih"))))
+    (build-system gnu-build-system)
+    (arguments
+      `(#:tests? #f ;; No tests defined for bird 1
+        #:phases
+        (modify-phases
+          %standard-phases
+          ;; Fix "cc not found" in tools/mergedirs
+          (add-after 'bootstrap 'set-cc
+            (lambda _
+              (setenv "CPP" ,(string-append (cc-for-target) " -E"))))
+          ;; Build bird6 after building bird.
+          ;; bird6 and bird are configured independently.
+          (add-after 'install 'configure-bird6 ,configure-bird6)
+          (add-after 'configure-bird6 'build-bird6 
+                     (assoc-ref %standard-phases 'build))
+          (add-after 'build-bird6 'install-bird6 
+                     (assoc-ref %standard-phases 'install)))))
+    (inputs
+      `(("ncurses" ,ncurses)
+        ("readline" ,readline)))
+    (native-inputs
+      `(("autoconf" ,autoconf)
+        ("bison" ,bison)
+        ("flex" ,flex)))
+    (home-page "http://bird.network.cz/")
+    (synopsis "BIRD Internet Routing Daemon")
+    (description "The BIRD project aims to develop a dynamic IP routing daemon
+with full support of all modern routing protocols, easy to use configuration
+interface and powerful route filtering language.")
+    (license license:gpl2+)))
+
+(define-public bird
+  (package
+    (inherit bird-1)
+    (version "2.0.8")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://gitlab.nic.cz/labs/bird.git")
+               (commit (string-append "v" version))))
+        (sha256 (base32 "07mh41hsmkcpf6f6lnygzp6g59jma542pcqdkl54ysiqnjmi5zz1"))))
+    (arguments `())))
-- 
2.31.1
Attachment: OpenPGP_signature
?