From patchwork Thu Jan 31 15:46:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1034330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43r4N939Dlz9sBQ; Fri, 1 Feb 2019 02:46:33 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gpEXq-0007Ci-37; Thu, 31 Jan 2019 15:46:26 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gpEXo-0007Ca-9L for kernel-team@lists.ubuntu.com; Thu, 31 Jan 2019 15:46:24 +0000 Received: from mail-qk1-f198.google.com ([209.85.222.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gpEXo-0001fx-0C for kernel-team@lists.ubuntu.com; Thu, 31 Jan 2019 15:46:24 +0000 Received: by mail-qk1-f198.google.com with SMTP id u197so3569567qka.8 for ; Thu, 31 Jan 2019 07:46:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=HRF2eew2uU90IBgweN2c8NJzs74xDXr38bUC9/F1Rnw=; b=XI6Khz95CEF2y69SEnt/w1ZGvnoS4bZtg8GWy6SwhR0zfrGlUWLti/Kq5t2JGYFUwJ ew2HSF6UcY8fapK8ToOL20Cs0O9mMiL9S8bth+DgOBaVM4gVSnFqGx5N6J5hd3sOPD1s E6oltt51RLW3zO+p3p5pvQzN11xzAKWXAEDh23b3utw/qkqUepFPzkrvWD3EjRmjiPa2 lMMGZ2N7vqwg/5SZI+ZqrCZYoN9NQ89l63r7jmih03MN5w2MsthPQUV9jbOrBY4pYLJR HKEE1M6l5mLtkVdTbYTFBvWiUWy9yuS/Nkakob1Kf8b5HRpILK8JqDpT5SRTI7+fppPF my6Q== X-Gm-Message-State: AJcUukc3rRcPFJ1hep1ynK8LRTdlnhCReTNKsLRrbPe54L8kens4/nZI vdXav+d/ZcVoNgXn0ej7cjm/LHRQqlcRommaM/vBbGUczIYlMH06q6tA6qMPcmvsvdRL93U07gy Y8XK/nt18x+mtEWpVEIgOQOjAbnX04FiEdEE4p/kx X-Received: by 2002:ac8:2368:: with SMTP id b37mr34393488qtb.203.1548949582672; Thu, 31 Jan 2019 07:46:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN5EXCiiu5uzWq215gvIBA1s9c36iYi4b8mkcEVyU9RyMt5/D3JrCf11t1PWIukh6tyYjuVi9A== X-Received: by 2002:ac8:2368:: with SMTP id b37mr34393464qtb.203.1548949582348; Thu, 31 Jan 2019 07:46:22 -0800 (PST) Received: from gallifrey.lan ([189.61.208.219]) by smtp.gmail.com with ESMTPSA id v32sm5321333qta.37.2019.01.31.07.46.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 07:46:20 -0800 (PST) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [X, B, C, D, unstable][PATCH] UBUNTU: [Packaging] config-check: allow overlay annotations files Date: Thu, 31 Jan 2019 13:46:17 -0200 Message-Id: <20190131154617.24363-1-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" 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 Will cause any line related to CONFIG_X in the original annotations file to be ignored. Signed-off-by: Marcelo Henrique Cerri Acked-by: Kamal Mostafa --- 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 () { - 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 () { + 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) {