mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
bpftools: strip path to the binary from prints
Otherwise meson's find_program() can get confused by the output; now in case of systemd build: meson.build:1059:16: ERROR: Invalid version of program, need 'bpftool' ['>= 5.6.0'] found '01'.
This commit is contained in:
parent
d700d8e8a2
commit
f831be559a
@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-xDalSMcxLOb8WjRyy+rYle749ShB++fHH9jki9/isLo=";
|
||||
};
|
||||
|
||||
patches = [ ./strip-binary-name.patch ];
|
||||
|
||||
nativeBuildInputs = [ python3 bison flex ];
|
||||
buildInputs = (if (lib.versionAtLeast version "5.20")
|
||||
then [ libopcodes libbfd ]
|
||||
|
15
pkgs/os-specific/linux/bpftools/strip-binary-name.patch
Normal file
15
pkgs/os-specific/linux/bpftools/strip-binary-name.patch
Normal file
@ -0,0 +1,15 @@
|
||||
Strip path to the binary from prints.
|
||||
|
||||
I see no sense in including the full path in outputs like bpftool --version
|
||||
Especially as argv[0] may not include it, based on calling via $PATH or not.
|
||||
--- a/tools/bpf/bpftool/main.c
|
||||
+++ b/tools/bpf/bpftool/main.c
|
||||
@@ -443 +443,7 @@
|
||||
- bin_name = argv[0];
|
||||
+ /* Strip the path if any. */
|
||||
+ const char *bin_name_slash = strrchr(argv[0], '/');
|
||||
+ if (bin_name_slash) {
|
||||
+ bin_name = bin_name_slash + 1;
|
||||
+ } else {
|
||||
+ bin_name = argv[0];
|
||||
+ }
|
Loading…
Reference in New Issue
Block a user