[RFC Unstable/Noble][PATCH] UBUNTU: [Packaging] Add debian/control sanity check

Andrea Righi andrea.righi at canonical.com
Tue Jan 2 12:16:20 UTC 2024


On Mon, Nov 20, 2023 at 04:34:19PM +0100, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net.bugs/2043994
> 
> Only the main linux source packages should produce linux-source-PKGVER
> binary packages. Add a simple check that fails if debian/control looks
> fishy.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>

It looks like a good idea to me! Should I just apply it to unstable? Or
are we waiting for more comments about this?

Thanks,
-Andrea

> ---
>  debian/rules                        |  1 +
>  debian/scripts/checks/control-check | 36 +++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+)
>  create mode 100755 debian/scripts/checks/control-check
> 
> diff --git a/debian/rules b/debian/rules
> index b78aff60ce24..3f09305eeba8 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -219,6 +219,7 @@ $(DEBIAN)/control.stub: 				\
>  .PHONY: debian/control
>  debian/control: $(DEBIAN)/control.stub
>  	cp $(DEBIAN)/control.stub debian/control
> +	debian/scripts/checks/control-check
>  
>  debian/canonical-certs.pem: $(wildcard $(DROOT)/certs/*-all.pem) $(wildcard $(DROOT)/certs/*-$(arch).pem) $(wildcard $(DEBIAN)/certs/*-all.pem) $(wildcard $(DEBIAN)/certs/*-$(arch).pem)
>  	for cert in $(sort $(notdir $^));					\
> diff --git a/debian/scripts/checks/control-check b/debian/scripts/checks/control-check
> new file mode 100755
> index 000000000000..51e1c91f5502
> --- /dev/null
> +++ b/debian/scripts/checks/control-check
> @@ -0,0 +1,36 @@
> +#!/bin/bash -eu
> +#
> +# debian/control sanity checks
> +#
> +
> +echo "II: Checking debian/control"
> +
> +. debian/debian.env
> +
> +source_name=$(dpkg-parsechangelog -l"${DEBIAN}"/changelog -SSource)
> +linux_source=$(grep -P '^Package:\s*linux.*-source-\d+\.\d+\.\d+' debian/control | sed 's/^Package:\s*//')
> +
> +case "${source_name}___${linux_source}" in
> +	linux___linux-source-*)
> +		# Main kernel package produces linux-source
> +		true
> +		;;
> +	linux-*___)
> +		# Non-main kernel package must *not* produce linux-source
> +		true
> +		;;
> +	*)
> +		# All other combinations are packaging mistakes
> +		if [ -n "${linux_source}" ] ; then
> +			echo "EE: debian/control contains invalid package stanza:" >&2
> +			echo "Package: ${linux_source}" >&2
> +		else
> +			echo "EE: debian/control is missing package stanza:" >&2
> +			echo "Package: linux-source-PKGVER" >&2
> +		fi
> +		exit 1
> +		;;
> +esac
> +
> +echo "II: Done"
> +exit 0
> -- 
> 2.40.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



More information about the kernel-team mailing list