[Mantic 3/6] UBUNTU: [Packaging] Fix File exists error in install-arch-headers

Masahiro Yamada masahiro.yamada at canonical.com
Fri Jul 28 13:38:14 UTC 2023

Our debian build scripts only work in a pristine source tree.

If you build the packages second time, the following code

    mkdir $(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)

... will fail with this message:

    mkdir: cannot create directory '...': File exists

Irrespective of the error, $(headers_dir) should be removed because
garbage files from the previous build might be remaining.

Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
 debian/rules.d/2-binary-arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 1f77a787000e..7af0287b6535 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -561,7 +561,7 @@ install-arch-headers:
 ifeq ($(do_libc_dev_package),true)
 	dh_prep -plinux-libc-dev
-	rm -rf $(headers_tmp)
+	rm -rf $(headers_tmp) $(headers_dir)
 	install -d $(headers_tmp) $(headers_dir)/usr/include/
 	$(hmake) $(conc_level) headers_install
 	( cd $(headers_tmp)/install/include/ && \

More information about the kernel-team mailing list