Skip to contentSkip to conversation

bpftool: Fix version string in recursive builds

PATCH In review Ben Hutchings 2 participants 4 messages Aug 13, 2020 – Aug 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpftool: Fix version string in recursive builds

When bpftool is built as part of a Debian package build, which itself uses make, "bpftool version" shows:

bpftool vmake[4]: Entering directory /build/linux-5.8/tools/bpf/bpftool 5.8.8.0 make[4]: Leaving directory /build/linux-5.8

Although we pass the "--no-print-directory" option, this is overridden by the environment variable "MAKEFLAGS=w". Clear MAKEFLAGS for the "make kernelversion" command.

I have no explanation for the doubled ".8" in the version string, but this seems to fix that as well.

---
 tools/bpf/bpftool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/Makefile +1 -1
index 9e85f101be85..7fbad8cbd171 100644
@@ -25,7 +25,7 @@ endif
 
 LIBBPF = $(LIBBPF_PATH)libbpf.a
 
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
+BPFTOOL_VERSION := $(shell MAKEFLAGS= make -rR --no-print-directory -sC ../../.. kernelversion)
 
 $(LIBBPF): FORCE
 	$(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))
#1 lore raw
Quoted 22 lines · Ben Hutchings

When bpftool is built as part of a Debian package build, which itself uses make, "bpftool version" shows:

bpftool vmake[4]: Entering directory /build/linux-5.8/tools/bpf/bpftool 5.8.8.0 make[4]: Leaving directory /build/linux-5.8

Although we pass the "--no-print-directory" option, this is overridden by the environment variable "MAKEFLAGS=w". Clear MAKEFLAGS for the "make kernelversion" command.

I have no explanation for the doubled ".8" in the version string, but this seems to fix that as well.

---
  tools/bpf/bpftool/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/Makefile +0 -0
index 9e85f101be85..7fbad8cbd171 100644

tools/bpf/bpftool/Makefile endif · line 28

Quoted 5 lines
tools/bpf/bpftool/Makefile +1 -1
@@ -25,7 +25,7 @@ endif
 
  LIBBPF = $(LIBBPF_PATH)libbpf.a
 
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
+BPFTOOL_VERSION := $(shell MAKEFLAGS= make -rR --no-print-directory -sC ../../.. kernelversion)

I tried the following

tools/bpf/bpftool/Makefile +1 -2
@@ -25,7 +25,7 @@ endif
 
 LIBBPF = $(LIBBPF_PATH)libbpf.a
 
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
+BPFTOOL_VERSION := $(shell MAKEFLAGS=w make -rR --no-print-directory -sC ../../.. kernelversion)
 
-bash-4.4$ ./bpftool version

./bpftool v5.8.0

I set env variable MAKEFLAGS=w, and build bpftool it works fine too. Maybe I miss something or debian changed top level Makefile?

I am testing against latest bpf tree.

Quoted 4 lines
tools/bpf/bpftool/Makefile +0 -0
  $(LIBBPF): FORCE
  	$(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))
 
#2 lore raw

On Fri, 2020-08-14 at 08:43 -0700, Yonghong Song wrote:
[...]

Quoted 16 lines

I tried the following

tools/bpf/bpftool/Makefile +1 -3
@@ -25,7 +25,7 @@ endif
 
  LIBBPF = $(LIBBPF_PATH)libbpf.a
 
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. 
 kernelversion)
+BPFTOOL_VERSION := $(shell MAKEFLAGS=w make -rR --no-print-directory 
-sC ../../.. kernelversion)
 
-bash-4.4$ ./bpftool version

./bpftool v5.8.0

Quoted 2 lines

I set env variable MAKEFLAGS=w, and build bpftool it works fine too. Maybe I miss something or debian changed top level Makefile?

Yes, but we don't change MAKEFLAGS or any of the logic around quietness or verbosity.

I assume there are other factors involved, as I've also been unable to construct a simple reproducer.

Ben.

Quoted 6 lines

I am testing against latest bpf tree.

Quoted 4 lines
  
  $(LIBBPF): FORCE
  	$(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))
Signature · 1 line
Ben Hutchings - Debian developer, member of kernel, installer and LTS teams
#3 lore raw
Quoted 18 lines · Ben Hutchings

On Fri, 2020-08-14 at 08:43 -0700, Yonghong Song wrote:
[...]

Quoted 16 lines

I tried the following

tools/bpf/bpftool/Makefile +1 -3
@@ -25,7 +25,7 @@ endif
 
   LIBBPF = $(LIBBPF_PATH)libbpf.a
 
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../..
 kernelversion)
+BPFTOOL_VERSION := $(shell MAKEFLAGS=w make -rR --no-print-directory
-sC ../../.. kernelversion)
 
-bash-4.4$ ./bpftool version

./bpftool v5.8.0

Quoted 8 lines
Quoted 2 lines

I set env variable MAKEFLAGS=w, and build bpftool it works fine too. Maybe I miss something or debian changed top level Makefile?

Yes, but we don't change MAKEFLAGS or any of the logic around quietness or verbosity.

I assume there are other factors involved, as I've also been unable to construct a simple reproducer.

It would be good to know what is the exact problem, and then we can decide whether this patch is the most appropriate fix or not.

Quoted 9 lines

Ben.

Quoted 6 lines

I am testing against latest bpf tree.

Quoted 4 lines
   
   $(LIBBPF): FORCE
   	$(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))