From 8be287f598f59042a3dc9227b0d60119ab92f96f Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 1 Mar 2024 15:09:13 +0900 Subject: [PATCH] UBUNTU: [packaging] remove debian/stamps/keep-dir Ubuntu kernel touches a stamp file in debian/stamps/ without creating the directory. Since git cannot track an empty directory, debian/stamps/keep-dir was added to keep the debian/stamps/ directory. Import the 'stamp' macro from Debian kernel to create the stamps directory. [1]: https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.5.10-1/debian/rules.real#L40 Signed-off-by: Masahiro Yamada Signed-off-by: Paolo Pisati --- debian/rules | 3 +-- debian/rules.d/0-common-vars.mk | 2 ++ debian/rules.d/2-binary-arch.mk | 14 +++++++------- debian/rules.d/3-binary-indep.mk | 4 ++-- debian/stamps/keep-dir | 1 - 5 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 debian/stamps/keep-dir diff --git a/debian/rules b/debian/rules index 85af06c7f560..303e8fcec153 100755 --- a/debian/rules +++ b/debian/rules @@ -137,8 +137,7 @@ clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs. # normal build junk rm -rf $(DEBIAN)/abi - rm -rf $(builddir) - rm -f $(stampdir)/stamp-* + rm -rf $(builddir) $(stampdir) rm -rf debian/linux-*/ cp $(DEBIAN)/changelog debian/changelog diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk index 46eca410341c..c3c794214dab 100644 --- a/debian/rules.d/0-common-vars.mk +++ b/debian/rules.d/0-common-vars.mk @@ -32,6 +32,8 @@ define if_package $(if $(filter $(1),$(packages_enabled)),$(2)) endef +stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@ + # # do_full_build -- are we doing a full buildd style build, i.e., are we # building in a PPA diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index 510103d1b5b0..9191fc0e3508 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -9,7 +9,8 @@ debian/scripts/fix-filenames: debian/scripts/fix-filenames.c $(stampdir)/stamp-prepare-%: config-prepare-check-% @echo Debug: $@ - @touch $@ + $(stamp) + $(stampdir)/stamp-prepare-tree-%: target_flavour = $* $(stampdir)/stamp-prepare-tree-%: debian/scripts/fix-filenames @echo Debug: $@ @@ -23,7 +24,7 @@ $(stampdir)/stamp-prepare-tree-%: debian/scripts/fix-filenames find $(builddir)/build-$* -name "*.ko" | xargs rm -f $(kmake) O=$(builddir)/build-$* $(conc_level) rustavailable || true $(kmake) O=$(builddir)/build-$* $(conc_level) olddefconfig - touch $@ + $(stamp) # Used by developers as a shortcut to prepare a tree for compilation. prepare-%: $(stampdir)/stamp-prepare-% @@ -45,8 +46,7 @@ ifeq ($(do_dbgsym_package),true) $(kmake) O=$(builddir)/build-$* $(conc_level) scripts_gdb ; \ fi endif - - @touch $@ + $(stamp) define build_dkms_sign = $(shell set -x; if grep -q CONFIG_MODULE_SIG=y $(1)/.config; then @@ -495,7 +495,7 @@ ifneq ($(do_full_build),false) # Clean out this flavours build directory. rm -rf $(builddir)/build-$* endif - @touch $@ + $(stamp) headers_tmp := $(CURDIR)/debian/tmp-headers headers_dir := $(CURDIR)/debian/linux-libc-dev @@ -629,7 +629,7 @@ ifeq ($(do_any_tools),true) install -d $(builddirpa) rsync -a --exclude debian --exclude debian.master --exclude $(DEBIAN) --exclude .git -a ./ $(builddirpa)/ endif - touch $@ + $(stamp) $(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch install-arch-headers build-arch @echo Debug: $@ @@ -677,7 +677,7 @@ ifeq ($(do_tools_hyperv),true) cd $(builddirpa)/tools/hv && make CFLAGS="-I$(headers_dir)/usr/include -I$(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)" CROSS_COMPILE=$(CROSS_COMPILE) hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon endif endif - @touch $@ + $(stamp) .PHONY: install-perarch install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name) diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk index 8959f0dd6905..c34161332257 100644 --- a/debian/rules.d/3-binary-indep.mk +++ b/debian/rules.d/3-binary-indep.mk @@ -29,7 +29,7 @@ ifeq ($(do_flavour_header_package),true) # Do not ship .o and .cmd artifacts in headers find $(indep_hdrdir) -name \*.o -or -name \*.cmd -exec rm -f {} \; endif - @touch $@ + $(stamp) srcpkg = linux-source-$(release) srcdir = $(CURDIR)/debian/$(srcpkg)/usr/src/$(srcpkg) @@ -145,7 +145,7 @@ endif $(stampdir)/stamp-prepare-indep: @echo Debug: $@ dh_prep -i - @touch $@ + $(stamp) .PHONY: install-indep install-indep: $(stampdir)/stamp-install-headers install-source install-tools diff --git a/debian/stamps/keep-dir b/debian/stamps/keep-dir deleted file mode 100644 index 5c38d4a5c411..000000000000 --- a/debian/stamps/keep-dir +++ /dev/null @@ -1 +0,0 @@ -Place holder