ACK: [X, B, C, D, unstable][PATCH] UBUNTU: [Packaging] config-check: allow overlay annotations files

Kamal Mostafa kamal at canonical.com
Thu Jan 31 15:51:54 UTC 2019


Great idea!

Acked-by: Kamal Mostafa <kamal at canonical.com>

 -Kamal

On Thu, Jan 31, 2019 at 01:46:17PM -0200, Marcelo Henrique Cerri wrote:
> BugLink: http://bugs.launchpad.net/bugs/1752072
> 
> Update the config-check script to parse additional annotations files
> that can overlay the original annotations on a config basis. The overlay
> files are read from "$DEBIAN/config/*.annotations".
> 
> Since the overlay works on a config basis, any mention to a config in
> the overlay file will cause the entry for that config on the original
> file to be ignore.
> 
> For instance, the following line in the overlay file:
> 
> CONFIG_X note<some note>
> 
> Will cause any line related to CONFIG_X in the original annotations file
> to be ignored.
> 
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
> ---
> 
> I intend to use this patch to better handle config annotations for
> custom, and specially cloud, kernels. That way we can keep
> "debian.$BRANCH/config/annotations" as a symlink to the base kernel
> (usually "debian.master/config/annotations") and keep the
> customizations for the custom kernel on a separate file (ie:
> "debian.$BRANCH/config/$BRANCH.annotations").
> 
> With this patch applied I'm planning to extract all the configs
> requirements for the cloud kernel on a separate file. That should help
> us to have a clear perspect of the the customizations made to a kernel.
> 
> ---
>  debian/scripts/config-check | 45 ++++++++++++++++++++-----------------
>  1 file changed, 25 insertions(+), 20 deletions(-)
> 
> diff --git a/debian/scripts/config-check b/debian/scripts/config-check
> index 07958556e58e..e28d28153c4b 100755
> --- a/debian/scripts/config-check
> +++ b/debian/scripts/config-check
> @@ -41,33 +41,38 @@ close(CONFIG);
>  # ANNOTATIONS: check any annotations marked for enforcement
>  my $pass = 0;
>  my $total = 0;
> -my $annotations = "$commonconfig/annotations";
>  my ($config, $value, $options, $option, $value, $check, $policy);
> -print "$P: $annotations loading annotations\n";
> +
>  my %annot;
> -my $form = 1;
> -open(ANNOTATIONS, "<$annotations") || die "$P: $annotations: open failed -- $! -- aborting\n";
> -while (<ANNOTATIONS>) {
> -	if (/^# FORMAT: (\S+)/) {
> -		die "$P: $1: unknown annotations format\n" if ($1 != 2);
> -		$form = $1;
> -	}
> +my @annotations_list = ("$commonconfig/annotations", glob("$commonconfig/*.annotations"));
> +for my $annotations (@annotations_list) {
> +	print "$P: $annotations loading annotations\n";
> +	my %current_annot;
> +	my $form = 1;
> +	open(ANNOTATIONS, "<$annotations") || die "$P: $annotations: open failed -- $! -- aborting\n";
> +	while (<ANNOTATIONS>) {
> +		if (/^# FORMAT: (\S+)/) {
> +			die "$P: $1: unknown annotations format\n" if ($1 != 2);
> +			$form = $1;
> +		}
>  
> -	/^#/ && next;
> -	chomp;
> -	/^$/ && next;
> +		/^#/ && next;
> +		chomp;
> +		/^$/ && next;
>  
> -	/^CONFIG_/ || next;
> +		/^CONFIG_/ || next;
>  
> -	if ($form == 1) {
> -		($config, $value, $options) = split(' ', $_, 3);
> -	} elsif ($form == 2) {
> -		($config, $options) = split(' ', $_, 2);
> -	}
> +		if ($form == 1) {
> +			($config, $value, $options) = split(' ', $_, 3);
> +		} elsif ($form == 2) {
> +			($config, $options) = split(' ', $_, 2);
> +		}
>  
> -	$annot{$config} = $annot{$config} . ' ' . $options;
> +		$current_annot{$config} = $current_annot{$config} . ' ' . $options;
> +	}
> +	close(ANNOTATIONS);
> +	%annot = ( %annot, %current_annot );
>  }
> -close(ANNOTATIONS);
>  
>  my $config;
>  for $config (keys %annot) {
> -- 
> 2.17.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