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

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Mon Nov 1 13:16:05 UTC 2021


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 at 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.



More information about the kernel-team mailing list