all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ryan Sundberg via Guix-patches via <guix-patches@gnu.org>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 48889@debbugs.gnu.org
Subject: [bug#48889] [PATCH 4/4] bpftool: new package
Date: Wed, 9 Jun 2021 00:06:04 -0700	[thread overview]
Message-ID: <9f6bfb31-ad8a-a45f-2c80-e4423647aa28@arctype.co> (raw)
In-Reply-To: <95c21dc7fa0e9c6864df06b307f3375d511847a8.camel@telenet.be>


[-- Attachment #1.1.1: Type: text/plain, Size: 4410 bytes --]

Here is the revised bpftool patch. Responses below.

--
Sincerely,
Ryan Sundberg

On 6/7/21 2:50 AM, Maxime Devos wrote:
> 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
>>  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.
> 
>> +        #: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.

> 
> 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

> 
> 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.

> 
>> +    (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*?
Copy-paste error
> 
> Greetings,
> Maxime.
> 

[-- Attachment #1.1.2: 0001-gnu-Add-bpftool-in-sync-with-the-Linux-kernel-versio.patch --]
[-- Type: text/x-patch, Size: 2999 bytes --]

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(+)

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2021-06-09  7:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 18:52 [bug#48889] [PATCH 1/4] New package: bird bgp daemon, versions 1 and 2 Ryan Sundberg via Guix-patches via
2021-06-06 18:52 ` [bug#48889] [PATCH 2/4] Ceph: patch rbd to use $PATH lookups for modprobe Ryan Sundberg via Guix-patches via
2021-06-07  9:40   ` Maxime Devos
2021-06-06 18:52 ` [bug#48889] [PATCH 3/4] Ceph: upgrade minor version to latest stable release (14.2.21) Ryan Sundberg via Guix-patches via
2021-06-06 18:52 ` [bug#48889] [PATCH 4/4] bpftool: new package Ryan Sundberg via Guix-patches via
2021-06-07  9:50   ` Maxime Devos
2021-06-09  7:06     ` Ryan Sundberg via Guix-patches via [this message]
2021-06-07  9:35 ` [bug#48889] [PATCH 1/4] New package: bird bgp daemon, versions 1 and 2 Maxime Devos
2021-06-09  6:50   ` Ryan Sundberg via Guix-patches via
2021-06-18 15:40     ` Ryan Sundberg via Guix-patches via

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

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

  git send-email \
    --in-reply-to=9f6bfb31-ad8a-a45f-2c80-e4423647aa28@arctype.co \
    --to=guix-patches@gnu.org \
    --cc=48889@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    --cc=ryan@arctype.co \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.