diff mbox series

[Unstable/Lunar,v2] UBUNTU: [Packaging] debian/rules: 1-maintainer.mk -- Use make's if-else

Message ID 20230126105835.1450432-1-juerg.haefliger@canonical.com
State New
Headers show
Series [Unstable/Lunar,v2] UBUNTU: [Packaging] debian/rules: 1-maintainer.mk -- Use make's if-else | expand

Commit Message

Juerg Haefliger Jan. 26, 2023, 10:58 a.m. UTC
Use make's built-in if-else conditional rather than the shell's so we
can drop multi-line shell statements and make the code more readable.

While at it, don't purge the 'build' directory at the end of the config
operations. That's a directory used internally by the kernelconfig script
which handles the cleanup.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 debian/rules.d/1-maintainer.mk | 40 +++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 20 deletions(-)

Comments

Andrea Righi Jan. 26, 2023, 11:04 a.m. UTC | #1
On Thu, Jan 26, 2023 at 11:58:35AM +0100, Juerg Haefliger wrote:
> Use make's built-in if-else conditional rather than the shell's so we
> can drop multi-line shell statements and make the code more readable.
> 
> While at it, don't purge the 'build' directory at the end of the config
> operations. That's a directory used internally by the kernelconfig script
> which handles the cleanup.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>

This one looks good to me, applied both to lunar/linux and
lunar/linux-unstable.

Thanks!
-Andrea
diff mbox series

Patch

diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index b18f9d225ff1..c7224301d525 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -27,32 +27,32 @@  printdebian:
 
 .PHONY: migrateconfigs
 migrateconfigs:
-	dh_testdir;
-	if [ -e "$(DEBIAN)/config/config.common.ubuntu" ]; then \
-		conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig genconfigs; \
-		mkdir build; \
-		mv $(DEBIAN)/config/annotations build/.annotations ; \
-		mv $(DEBIAN)/config/README.rst build/.README.rst 2>/dev/null || true; \
-		rm -rf $(DEBIAN)/config; \
-		mkdir -p $(DEBIAN)/config; \
-		debian/scripts/misc/migrate-annotations < build/.annotations > $(DEBIAN)/config/annotations; \
-		mv build/.README.rst $(DEBIAN)/config/README.rst 2>/dev/null || true; \
-		conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/kernelconfig updateconfigs; \
-	fi
+ifneq ($(wildcard $(DEBIAN)/config/config.common.ubuntu),)
+	dh_testdir
+	conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig genconfigs
 	rm -rf build
+	mkdir build
+	mv $(DEBIAN)/config/annotations build/.annotations
+	mv $(DEBIAN)/config/README.rst build/.README.rst 2>/dev/null || true
+	rm -rf $(DEBIAN)/config
+	mkdir -p $(DEBIAN)/config
+	debian/scripts/misc/migrate-annotations < build/.annotations > $(DEBIAN)/config/annotations
+	mv build/.README.rst $(DEBIAN)/config/README.rst 2>/dev/null || true
+	rm -rf build
+	conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/kernelconfig updateconfigs
+endif
 
 configs-targets := updateconfigs defaultconfigs genconfigs editconfigs
 
 .PHONY: $(configs-targets)
 $(configs-targets):
-	dh_testdir;
-	if [ -e "$(DEBIAN)/config/config.common.ubuntu" ]; then \
-		conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig $@; \
-	else \
-		skip_checks=$(do_skip_checks) conc_level=$(conc_level) \
-			$(SHELL) $(DROOT)/scripts/misc/kernelconfig $@; \
-	fi;
-	rm -rf build
+	dh_testdir
+ifneq ($(wildcard $(DEBIAN)/config/config.common.ubuntu),)
+	conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig $@
+else
+	skip_checks=$(do_skip_checks) conc_level=$(conc_level) \
+		$(SHELL) $(DROOT)/scripts/misc/kernelconfig $@
+endif
 
 .PHONY: printenv
 printenv: