diff mbox series

[Unstable] UBUNTU: [Packaging] Replace Perl oneliner with Bash statements

Message ID 20211101091614.19875-1-juergh@canonical.com
State New
Headers show
Series [Unstable] UBUNTU: [Packaging] Replace Perl oneliner with Bash statements | expand

Commit Message

Juerg Haefliger Nov. 1, 2021, 9:16 a.m. UTC
Replace the only Perl oneliner in the Ubuntu Makefiles with Bash
statements. This brings us one step closer to dropping Perl as a build
dependency for the Ubuntu kernel.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 debian/rules.d/1-maintainer.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Thadeu Lima de Souza Cascardo Nov. 1, 2021, 1:16 p.m. UTC | #1
On Mon, Nov 01, 2021 at 10:16:14AM +0100, Juerg Haefliger wrote:
> Replace the only Perl oneliner in the Ubuntu Makefiles with Bash
> statements. This brings us one step closer to dropping Perl as a build
> dependency for the Ubuntu kernel.
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> ---
>  debian/rules.d/1-maintainer.mk | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
> index 8216524fbd18..7c13fcdaa98a 100644
> --- a/debian/rules.d/1-maintainer.mk
> +++ b/debian/rules.d/1-maintainer.mk
> @@ -143,8 +143,12 @@ startnewrelease:
>  			ver="$${ver%.*}.$$(( $${prev_ver##*.} +1 ))"; \
>  		fi; \
>  	else \
> -		ver="$(release)-$$(echo "$(revision)" | \
> -			perl -ne 'if (/^(\d*)\.(\d*)(.*)?$$/) { printf("%d.%d%s\n", $$1 + 1, $$2 +1, $$3) }')"; \
> +		rev=$(revision); \
> +		suffix=$$(echo "$${rev}" | sed 's/^[0-9]*\.[0-9]*//'); \
> +		abi=$${rev%%.*}; \
> +		upload=$${rev#*.}; \
> +		upload=$${upload%$${suffix}}; \
> +		ver=$(release)-$$((abi + 1)).$$((upload + 1))$${suffix}; \
>  	fi; \
>  	now="$(shell date -R)"; \
>  	echo "Creating new changelog set for $$ver..."; \
> -- 
> 2.30.2

It works. Now, I wonder if we should be doing statnewrelease outside of the
makefile. The whole make command takes more than half a second, while doing it
entirely on the shell would take less than 20ms.

Cascardo.
Tim Gardner Nov. 1, 2021, 5:50 p.m. UTC | #2
Acked-by: Tim Gardner <tim.gardner@canonical.com>

On 11/1/21 3:16 AM, Juerg Haefliger wrote:
> Replace the only Perl oneliner in the Ubuntu Makefiles with Bash
> statements. This brings us one step closer to dropping Perl as a build
> dependency for the Ubuntu kernel.
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> ---
>   debian/rules.d/1-maintainer.mk | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
> index 8216524fbd18..7c13fcdaa98a 100644
> --- a/debian/rules.d/1-maintainer.mk
> +++ b/debian/rules.d/1-maintainer.mk
> @@ -143,8 +143,12 @@ startnewrelease:
>   			ver="$${ver%.*}.$$(( $${prev_ver##*.} +1 ))"; \
>   		fi; \
>   	else \
> -		ver="$(release)-$$(echo "$(revision)" | \
> -			perl -ne 'if (/^(\d*)\.(\d*)(.*)?$$/) { printf("%d.%d%s\n", $$1 + 1, $$2 +1, $$3) }')"; \
> +		rev=$(revision); \
> +		suffix=$$(echo "$${rev}" | sed 's/^[0-9]*\.[0-9]*//'); \
> +		abi=$${rev%%.*}; \
> +		upload=$${rev#*.}; \
> +		upload=$${upload%$${suffix}}; \
> +		ver=$(release)-$$((abi + 1)).$$((upload + 1))$${suffix}; \
>   	fi; \
>   	now="$(shell date -R)"; \
>   	echo "Creating new changelog set for $$ver..."; \
>
Andrea Righi Nov. 2, 2021, 6:51 a.m. UTC | #3
On Mon, Nov 01, 2021 at 10:16:14AM +0100, Juerg Haefliger wrote:
> Replace the only Perl oneliner in the Ubuntu Makefiles with Bash
> statements. This brings us one step closer to dropping Perl as a build
> dependency for the Ubuntu kernel.
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Applied to unstable 5.15.

Thanks,
-Andrea
diff mbox series

Patch

diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index 8216524fbd18..7c13fcdaa98a 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -143,8 +143,12 @@  startnewrelease:
 			ver="$${ver%.*}.$$(( $${prev_ver##*.} +1 ))"; \
 		fi; \
 	else \
-		ver="$(release)-$$(echo "$(revision)" | \
-			perl -ne 'if (/^(\d*)\.(\d*)(.*)?$$/) { printf("%d.%d%s\n", $$1 + 1, $$2 +1, $$3) }')"; \
+		rev=$(revision); \
+		suffix=$$(echo "$${rev}" | sed 's/^[0-9]*\.[0-9]*//'); \
+		abi=$${rev%%.*}; \
+		upload=$${rev#*.}; \
+		upload=$${upload%$${suffix}}; \
+		ver=$(release)-$$((abi + 1)).$$((upload + 1))$${suffix}; \
 	fi; \
 	now="$(shell date -R)"; \
 	echo "Creating new changelog set for $$ver..."; \