diff mbox series

[Plucky/Unstable,v2] UBUNTU: [Packaging] replace $(DROOT) with debian

Message ID 20241105085147.2799045-1-masahiro.yamada@canonical.com
State New
Headers show
Series [Plucky/Unstable,v2] UBUNTU: [Packaging] replace $(DROOT) with debian | expand

Commit Message

Masahiro Yamada Nov. 5, 2024, 8:51 a.m. UTC
Our expection is that DROOT is always set to 'debian'.
This variable is therefore not useful.

Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
Acked-by: Agathe Porte <agathe.porte@canonical.com>
Acked-by: You-Sheng Yang <vicamo.yang@canonical.com>
---

Changes for v2:
  - rebased onto unstable/master

 debian/rules                    | 33 +++++++++++++++------------------
 debian/rules.d/1-maintainer.mk  | 10 +++++-----
 debian/rules.d/2-binary-arch.mk | 20 ++++++++++----------
 debian/rules.d/4-checks.mk      |  8 ++++----
 4 files changed, 34 insertions(+), 37 deletions(-)

Comments

Paolo Pisati Nov. 5, 2024, 9:04 a.m. UTC | #1
On Tue, Nov 05, 2024 at 05:51:46PM +0900, Masahiro Yamada wrote:
> Our expection is that DROOT is always set to 'debian'.
> This variable is therefore not useful.

Applied.
diff mbox series

Patch

diff --git a/debian/rules b/debian/rules
index b9909ac9c071..c6facd5717c6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,15 +26,12 @@  unexport LDFLAGS
 export LC_ALL=C
 export SHELL=/bin/bash -e
 
-# Where do we find the common configuration.
-export DROOT=debian
-
 # Temporary workaround to fix build issues if only python2 runtime is installed
 # (without python3-dev).
 export PYTHON=python3
 
 # Common variables for all architectures
-include $(DROOT)/rules.d/0-common-vars.mk
+include debian/rules.d/0-common-vars.mk
 
 # Pull in some arch specific stuff
 -include $(DEBIAN)/rules.d/$(arch).mk
@@ -43,7 +40,7 @@  include $(DROOT)/rules.d/0-common-vars.mk
 -include $(DEBIAN)/rules.d/hooks.mk
 
 # Maintainer targets
-include $(DROOT)/rules.d/1-maintainer.mk
+include debian/rules.d/1-maintainer.mk
 
 do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_bpftool) $(do_tools_x86)))
 do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
@@ -150,22 +147,22 @@  clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs.
 	[ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct || true
 
 	# Remove generated intermediate files
-	rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
-	rm -f $(DROOT)/scripts/fix-filenames
+	rm -f debian/control.stub $(DEBIAN)/control.stub
+	rm -f debian/scripts/fix-filenames
 
 .PHONY: distclean
 distclean: clean
-	rm -rf $(DROOT)/control debian/changelog \
+	rm -rf debian/control debian/changelog \
 		debian/control debian/control.stub debian/copyright
 
 # Builds the image, arch headers and debug packages
-include $(DROOT)/rules.d/2-binary-arch.mk
+include debian/rules.d/2-binary-arch.mk
 
 # Builds the source and linux-headers indep packages
-include $(DROOT)/rules.d/3-binary-indep.mk
+include debian/rules.d/3-binary-indep.mk
 
 # Various checks to be performed on builds
-include $(DROOT)/rules.d/4-checks.mk
+include debian/rules.d/4-checks.mk
 
 control_files := $(DEBIAN)/control.stub.in
 ifeq ($(DEB_SOURCE),linux)
@@ -184,10 +181,10 @@  UBUNTU_COMPATIBLE_SIGNING=$(shell grep -qx ' *Subject: C = GB, ST = Isle of Man,
 # Misc stuff
 .PHONY: $(DEBIAN)/control.stub
 $(DEBIAN)/control.stub: 				\
-		$(DROOT)/scripts/control-create		\
+		debian/scripts/control-create		\
 		$(control_files)			\
 		debian/canonical-revoked-certs.pem	\
-		$(DROOT)/control.d/flavour-module.stub	\
+		debian/control.d/flavour-module.stub	\
 		$(DEBIAN)/changelog			\
 		$(wildcard $(DEBIAN)/control.d/*)
 	for i in $(control_files); do                                           \
@@ -203,7 +200,7 @@  $(DEBIAN)/control.stub: 				\
 	  > $(DEBIAN)/control.stub;
 	flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.*))";\
 	for i in $$flavours; do							\
-	  $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" |	\
+	  $(SHELL) debian/scripts/control-create $$i "$(any_signed)" |		\
 		sed -e 's/PKGVER/$(DEB_VERSION_UPSTREAM)/g'                     \
 		-e 's/ABINUM/$(abinum)/g'                                       \
 		-e 's/SRCPKGNAME/$(DEB_SOURCE)/g'                               \
@@ -216,10 +213,10 @@  $(DEBIAN)/control.stub: 				\
 debian/control: $(DEBIAN)/control.stub
 	cp $(DEBIAN)/control.stub debian/control
 
-debian/canonical-certs.pem: $(wildcard $(DROOT)/certs/*-all.pem) $(wildcard $(DROOT)/certs/*-$(arch).pem) $(wildcard $(DEBIAN)/certs/*-all.pem) $(wildcard $(DEBIAN)/certs/*-$(arch).pem)
+debian/canonical-certs.pem: $(wildcard debian/certs/*-all.pem) $(wildcard debian/certs/*-$(arch).pem) $(wildcard $(DEBIAN)/certs/*-all.pem) $(wildcard $(DEBIAN)/certs/*-$(arch).pem)
 	for cert in $(sort $(notdir $^));					\
 	do									\
-		for dir in $(DEBIAN) $(DROOT);					\
+		for dir in $(DEBIAN) debian;					\
 		do								\
 			if [ -f "$$dir/certs/$$cert" ]; then			\
 				cat "$$dir/certs/$$cert";			\
@@ -228,10 +225,10 @@  debian/canonical-certs.pem: $(wildcard $(DROOT)/certs/*-all.pem) $(wildcard $(DR
 		done;								\
 	done >"$@"
 
-debian/canonical-revoked-certs.pem: $(wildcard $(DROOT)/revoked-certs/*-all.pem) $(wildcard $(DROOT)/revoked-certs/*-$(arch).pem) $(wildcard $(DEBIAN)/revoked-certs/*-all.pem) $(wildcard $(DEBIAN)/revoked-certs/*-$(arch).pem)
+debian/canonical-revoked-certs.pem: $(wildcard debian/revoked-certs/*-all.pem) $(wildcard debian/revoked-certs/*-$(arch).pem) $(wildcard $(DEBIAN)/revoked-certs/*-all.pem) $(wildcard $(DEBIAN)/revoked-certs/*-$(arch).pem)
 	for cert in $(sort $(notdir $^));					\
 	do									\
-		for dir in $(DEBIAN) $(DROOT);					\
+		for dir in $(DEBIAN) debian;					\
 		do								\
 			if [ -f "$$dir/revoked-certs/$$cert" ]; then		\
 				cat "$$dir/revoked-certs/$$cert";		\
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 193343376d23..62d6eb7303c0 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -29,7 +29,7 @@  configs-targets := updateconfigs defaultconfigs genconfigs editconfigs
 $(configs-targets):
 	dh_testdir
 	kmake='$(kmake)' skip_checks=$(do_skip_checks) conc_level=$(conc_level) \
-		$(SHELL) $(DROOT)/scripts/misc/kernelconfig $@
+		$(SHELL) debian/scripts/misc/kernelconfig $@
 
 .PHONY: printenv
 printenv:
@@ -104,11 +104,11 @@  printchanges:
 			gawk '/UBUNTU:\s*Ubuntu-.*$$/ { print $$1; exit }'); \
 	fi; \
 	git log "$$baseCommit"..HEAD | \
-	$(DROOT)/scripts/misc/git-ubuntu-log
+	debian/scripts/misc/git-ubuntu-log
 
 .PHONY: insertchanges
 insertchanges: autoreconstruct finalchecks
-	$(DROOT)/scripts/misc/insert-changes $(DROOT) $(DEBIAN)
+	debian/scripts/misc/insert-changes debian $(DEBIAN)
 
 .PHONY: autoreconstruct
 autoreconstruct:
@@ -117,12 +117,12 @@  autoreconstruct:
 	if grep -q "^EXTRAVERSION = -rc[0-9]\+$$" Makefile; then \
 		echo "exit 0" >$(DEBIAN)/reconstruct; \
 	else \
-		$(DROOT)/scripts/misc/gen-auto-reconstruct $(upstream_tag) $(DEBIAN)/reconstruct $(DROOT)/source/options; \
+		debian/scripts/misc/gen-auto-reconstruct $(upstream_tag) $(DEBIAN)/reconstruct debian/source/options; \
 	fi
 
 .PHONY: finalchecks
 finalchecks: debian/control
-	$(DROOT)/scripts/checks/final-checks "$(DEBIAN)" "$(DEB_VERSION_PREV)" $(do_skip_checks)
+	debian/scripts/checks/final-checks "$(DEBIAN)" "$(DEB_VERSION_PREV)" $(do_skip_checks)
 
 .PHONY: compileselftests
 compileselftests:
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 435c70df686f..b17db81dc7d8 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -62,14 +62,14 @@  define build_dkms_sign =
 	)
 endef
 define build_dkms =
-	rc=0; unset MAKEFLAGS; ARCH=$(build_arch) CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5) || rc=$$?; if [ "$$rc" = "9" -o "$$rc" = "77" ]; then echo do_$(4)_$*=false >> $(builddir)/skipped-dkms.mk; rc=0; fi; if [ "$$rc" != "0" ]; then exit $$rc; fi
+	rc=0; unset MAKEFLAGS; ARCH=$(build_arch) CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) debian/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5) || rc=$$?; if [ "$$rc" = "9" -o "$$rc" = "77" ]; then echo do_$(4)_$*=false >> $(builddir)/skipped-dkms.mk; rc=0; fi; if [ "$$rc" != "0" ]; then exit $$rc; fi
 endef
 
 define install_control =
 	for which in $(3);							\
 	do									\
-		template="$(DROOT)/templates/$(2).$$which.in";			\
-		script="$(DROOT)/$(1).$$which";					\
+		template="debian/templates/$(2).$$which.in";			\
+		script="debian/$(1).$$which";					\
 		sed -e 's/@abiname@/$(abi_release)/g'				\
 		    -e 's/@localversion@/-$*/g'					\
 		    -e 's/@image-stem@/$(instfile)/g'				\
@@ -199,7 +199,7 @@  ifeq ($(do_extras_package),true)
 		mkdir -p $(pkgdir_ex)/lib/modules/$(abi_release)-$*; \
 		mv $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
 			$(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel; \
-		$(SHELL) $(DROOT)/scripts/module-inclusion --master \
+		$(SHELL) debian/scripts/module-inclusion --master \
 			$(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel \
 			$(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
 			$(DEBIAN)/control.d/$(target_flavour).inclusion-list \
@@ -229,7 +229,7 @@  endif
 		$(pkgdir)/lib/modules/$(abi_release)-$*/initrd/; \
 	fi
 
-	echo "interest linux-update-$(abi_release)-$*" >"$(DROOT)/$(bin_pkg_name)-$*.triggers"
+	echo "interest linux-update-$(abi_release)-$*" >"debian/$(bin_pkg_name)-$*.triggers"
 	install -d $(pkgdir_bin)/usr/lib/linux/triggers
 	$(call install_control,$(bin_pkg_name)-$*,image,postinst postrm preinst prerm)
 	install -d $(pkgdir)/usr/lib/linux/triggers
@@ -303,7 +303,7 @@  endif
 	# Copy over scripts/module.lds for building external modules
 	cp $(builddir)/build-$*/scripts/module.lds $(hdrdir)/scripts
 	# Script to symlink everything up
-	$(SHELL) $(DROOT)/scripts/link-headers "$(hdrdir)" "$(indeppkg)" "$*"
+	$(SHELL) debian/scripts/link-headers "$(hdrdir)" "$(indeppkg)" "$*"
 	# The build symlink
 	install -d debian/$(basepkg)-$*/lib/modules/$(abi_release)-$*
 	$(LN) /usr/src/$(basepkg)-$* \
@@ -321,7 +321,7 @@  endif
 	 PREV_REVISION="$(prev_revision)" ABI_NUM="$(abinum)"		\
 	 PREV_ABI_NUM="$(prev_abinum)" BUILD_DIR="$(builddir)/build-$*"	\
 	 INSTALL_DIR="$(pkgdir)" SOURCE_DIR="$(CURDIR)"			\
-	 run-parts -v $(DROOT)/tests-build
+	 run-parts -v debian/tests-build
 
 	#
 	# Remove files which are generated at installation by postinst,
@@ -485,8 +485,8 @@  endif
 		install -m644 $(abidir)/$*.fwinfo.builtin \
 			$(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/fwinfo.builtin; \
 	fi
-	install -m644 $(DROOT)/canonical-certs.pem $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/canonical-certs.pem
-	install -m644 $(DROOT)/canonical-revoked-certs.pem $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/canonical-revoked-certs.pem
+	install -m644 debian/canonical-certs.pem $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/canonical-certs.pem
+	install -m644 debian/canonical-revoked-certs.pem $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/canonical-revoked-certs.pem
 	# List of source files used for this build
 	install -m644 $(builddir)/build-$*/sources.list $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/sources
 
@@ -500,7 +500,7 @@  ifeq ($(do_lib_rust),true)
 	install -d -m755 $(rustdir)
 	mv $(hdrdir)/rust $(rustdir)
 	# Generate symlink for Rust lib directory in headers
-	$(SHELL) $(DROOT)/scripts/link-lib-rust "$(hdrdir)" "$(indeppkg)" "$*"
+	$(SHELL) debian/scripts/link-lib-rust "$(hdrdir)" "$(indeppkg)" "$*"
 endif
 
 ifneq ($(do_full_build),false)
diff --git a/debian/rules.d/4-checks.mk b/debian/rules.d/4-checks.mk
index 7cb84e9f71e5..9c840af3698e 100644
--- a/debian/rules.d/4-checks.mk
+++ b/debian/rules.d/4-checks.mk
@@ -1,9 +1,9 @@ 
 # Check the signature of staging modules
 module-signature-check-%: $(stampdir)/stamp-install-%
 	@echo Debug: $@
-	$(DROOT)/scripts/checks/module-signature-check "$*" \
-		"$(DROOT)/$(mods_pkg_name)-$*" \
-		"$(DROOT)/$(mods_extra_pkg_name)-$*" \
+	debian/scripts/checks/module-signature-check "$*" \
+		"debian/$(mods_pkg_name)-$*" \
+		"debian/$(mods_extra_pkg_name)-$*" \
 		$(do_skip_checks)
 
 checks-%: module-signature-check-%
@@ -13,6 +13,6 @@  checks-%: module-signature-check-%
 config-prepare-check-%: $(stampdir)/stamp-prepare-tree-%
 	@echo Debug: $@
 ifneq ($(do_skip_checks),true)
-	python3 $(DROOT)/scripts/misc/annotations -f $(commonconfdir)/annotations \
+	python3 debian/scripts/misc/annotations -f $(commonconfdir)/annotations \
 		--arch $(arch) --flavour $* --check $(builddir)/build-$*/.config
 endif