diff mbox series

[noble,v2,1/3] UBUNTU: SAUCE: make $(stampdir)/stamp-build-perarch depend on build-arch

Message ID 20231204014949.2034062-2-masahiro.yamada@canonical.com
State New
Headers show
Series Add support for rootless builds (Hackathon: KERNTT-669) | expand

Commit Message

Masahiro Yamada Dec. 4, 2023, 1:49 a.m. UTC
Since commit ("UBUNTU: [Packaging] bpftool: always use vmlinux to
generate headers"), tools/bpf/bpftool/vmlinux must be created before
building the bpftool.

This is not guaranteed because the $(stampdir)/stamp-build-perarch
target does not depend on build-arch.

Running 'debian/rules binary' results in the following build error:

  mv [...]/linux/debian/build/tools-perarch/tools/bpf/bpftool/vmlinux [...]/linux/debian/build/tools-perarch/vmlinux
  mv: cannot stat '[...]/linux/debian/build/tools-perarch/tools/bpf/bpftool/vmlinux': No such file or directory

This potential issue has been hidden, relying on build drivers such as
dpkg-buildpackage running 'debian/rules build' and 'debian/rules binary'
as separate steps.

Without rootless builds, the (fake) root privilege is required for the
binary target, hence dpkg-buildpackage splits the build process into
three stages:

  - fakeroot debian/rules clean
  - debian/rules build
  - fakeroot debian/rules binary

To support rootless builds, you need to specify all dependencies
correctly without such an assumption.

Once we transition to rootless builds, the 'binary' target will not
require the root privilege any more, so dpkg-buildpackage will merge
'build' and 'binary' into a single step. We need to assume only the
following two will be executed:

  - debian/rules clean
  - debian/rules binary

Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
---

Changes in v2:
  - new patch

 debian/rules.d/2-binary-arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index f89efd270e1c..b281428d3462 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -695,7 +695,7 @@  ifeq ($(do_any_tools),true)
 endif
 	touch $@
 
-$(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch install-arch-headers
+$(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch install-arch-headers build-arch
 	@echo Debug: $@
 ifeq ($(do_linux_tools),true)
 ifeq ($(do_tools_usbip),true)