diff mbox series

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

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

Commit Message

Juerg Haefliger Jan. 25, 2023, 9:27 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 | 38 +++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 19 deletions(-)

Comments

Andrea Righi Jan. 25, 2023, 9:53 a.m. UTC | #1
On Wed, Jan 25, 2023 at 10:27:49AM +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>

It doesn't apply cleanly to the latest lunar/linux-unstable, am I
missing any other additional patches?

Thanks,
-Andrea
Juerg Haefliger Jan. 25, 2023, 9:59 a.m. UTC | #2
On Wed, 25 Jan 2023 10:53:04 +0100
Andrea Righi <andrea.righi@canonical.com> wrote:

> On Wed, Jan 25, 2023 at 10:27:49AM +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>  
> 
> It doesn't apply cleanly to the latest lunar/linux-unstable, am I
> missing any other additional patches?

Probably the previous 'editconfigs' patch.

...Juerg


> Thanks,
> -Andrea
Andrea Righi Jan. 25, 2023, 11:02 a.m. UTC | #3
On Wed, Jan 25, 2023 at 10:59:19AM +0100, Juerg Haefliger wrote:
> On Wed, 25 Jan 2023 10:53:04 +0100
> Andrea Righi <andrea.righi@canonical.com> wrote:
> 
> > On Wed, Jan 25, 2023 at 10:27:49AM +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>  
> > 
> > It doesn't apply cleanly to the latest lunar/linux-unstable, am I
> > missing any other additional patches?
> 
> Probably the previous 'editconfigs' patch.
> 
> ...Juerg

Nope, tried that already. Anyway, I think I can adjust it manually and
apply it.

-Andrea
Juerg Haefliger Jan. 26, 2023, 10:49 a.m. UTC | #4
Doesn't apply cleanly and has wrong subject. Will send a v2.

...Juerg


> 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 | 38 +++++++++++++++++-----------------
>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
> index 239af468df5d..e90d4792ce58 100644
> --- a/debian/rules.d/1-maintainer.mk
> +++ b/debian/rules.d/1-maintainer.mk
> @@ -27,31 +27,31 @@ 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 \
> -		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
> +	conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/kernelconfig $@
> +endif
>  
>  .PHONY: printenv
>  printenv:
diff mbox series

Patch

diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 239af468df5d..e90d4792ce58 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -27,31 +27,31 @@  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 \
-		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
+	conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/kernelconfig $@
+endif
 
 .PHONY: printenv
 printenv: