From patchwork Mon Feb 6 07:14:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1738038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) 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: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=rUKa/7PH; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P9HZs0f60z23r4 for ; Mon, 6 Feb 2023 18:15:01 +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 1pOviI-0002fs-WF; Mon, 06 Feb 2023 07:14:54 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pOviF-0002fP-MY for kernel-team@lists.ubuntu.com; Mon, 06 Feb 2023 07:14:51 +0000 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9CEF13F2F8 for ; Mon, 6 Feb 2023 07:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675667690; bh=xLJDT9XYFNlV/jLsQ/4Ds3K23rrab9y2lKY+GLsqDF4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rUKa/7PH8mrV0UKN0v52xkprWrLWPs/gaf0RBsiXRsK8Ovts/qQGOiY/HdQsy7nfH QGmvZ2iJqun++Kc5bPLU2V14hHvh/s0HIjR9GDRGH5QhajoW9J5ZORqSIu0ak+cow7 TH/I7Nq2FGKb0Uqrfg8exd5HomPJ+v4+aItcyjkMNBWW2OPrrhmvgt061EyVPSRw35 3TsL0kL0p3A4IvFUlSowMtC/IbyNUvB0XtHcXVv0ztI86C1I3h7KbN7oixEFPwJw/g IbTzOrCrx7tW+QFh4s/N/6VfkZAzNAkTLZ7E4vMD9lse4RZyjEtPrNTP0HsHItI9if zt2fukBFlXfiQ== Received: by mail-ed1-f69.google.com with SMTP id w3-20020a056402268300b00487e0d9b53fso7118853edd.10 for ; Sun, 05 Feb 2023 23:14:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xLJDT9XYFNlV/jLsQ/4Ds3K23rrab9y2lKY+GLsqDF4=; b=raiPXuqz8kfBBa+GTi4t1Gg2IMA6Hb1ajeF6TDYwfC7kXW3E9FaV9iBFvYp3dL42Q/ fpV4//1TICEIic+g/HVfN/BEqs9Rl7GGpwhaXF0WQuI+XjFDt33oF5OAiaYLHdMUc7hD W33QcpA8KupzUR/t+CHfLoNW+OLJKHz1M4CI6kOZG5bwWYKmxTOh3wcu9hmEcDk2jNfR eSs1Yjr/lKRKt+z1Eopd63Tsldm8Dua7iUXhA6pJRtOX3qmhIjLMx1K9frWA+3ewe30Z JQwaocPtihnG09jEq1TZ6wmlFqErPKfF0LKDe3EO+HYoq7XzZJW5eWxSbzfxUGmlsQd0 wBPQ== X-Gm-Message-State: AO0yUKVvT5fJ0TBjmLPtEwT8vLMcaE3c6dGNX34gT2Dy7Z/aCwo8/TcO MTLhbzCNYRSbExqu2bubMBSB6kLO/sQcBwZI/FlmsePXgBbKgW73SLGrqpHSHE/caJD4o4LdgzL f5ZVdKcWE4gmHenkpdSTl29Wij+s6UAdokiS7H3ENAg== X-Received: by 2002:a17:907:3f83:b0:88a:d760:19ac with SMTP id hr3-20020a1709073f8300b0088ad76019acmr22357089ejc.1.1675667690424; Sun, 05 Feb 2023 23:14:50 -0800 (PST) X-Google-Smtp-Source: AK7set9FszoMyPhG6m3BtfrdxVgROzV3jyJICxD6HBmaN7pA+HaKjHz5LIQfmIYvvxxXzt/PVhWk5A== X-Received: by 2002:a17:907:3f83:b0:88a:d760:19ac with SMTP id hr3-20020a1709073f8300b0088ad76019acmr22357078ejc.1.1675667690232; Sun, 05 Feb 2023 23:14:50 -0800 (PST) Received: from gollum.fritz.box ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id l2-20020a170906a40200b0084d35ffbc20sm5084180ejz.68.2023.02.05.23.14.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Feb 2023 23:14:49 -0800 (PST) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [Unstable/Lunar][PATCH v2 1/2] UBUNTU: [Packaging] annotations: Handle single-line annoation rules Date: Mon, 6 Feb 2023 08:14:47 +0100 Message-Id: <20230206071448.713716-2-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230206071448.713716-1-juerg.haefliger@canonical.com> References: <20230206071448.713716-1-juerg.haefliger@canonical.com> MIME-Version: 1.0 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: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" The old annotations file allowed single-line rules such as: CONFIG_FOO policy<'amd64': 'n'> note The new annotations parser doesn't support that, so add it. Signed-off-by: Juerg Haefliger --- debian/scripts/misc/kconfig/annotations.py | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py index df3bf11e7320..cb73232b01e7 100644 --- a/debian/scripts/misc/kconfig/annotations.py +++ b/debian/scripts/misc/kconfig/annotations.py @@ -56,8 +56,8 @@ class Annotation(Config): # Convert multiple spaces to single space to simplifly parsing data = re.sub(r' *', ' ', data) - # Handle includes (recursively) for line in data.splitlines(): + # Handle includes (recursively) m = re.match(r'^include\s+"?([^"]*)"?', line) if m: self.include.append(m.group(1)) @@ -65,24 +65,28 @@ class Annotation(Config): include_data = self._load(include_fname) self._parse_body(include_data) else: - # Skip empty, non-policy and non-note lines - if re.match('.* policy<', line) or re.match('.* note<', line): + # Handle policy and note lines + if re.match(r'.* (policy|note)<', line): try: - # Parse single policy or note rule conf = line.split(' ')[0] if conf in self.config: entry = self.config[conf] else: entry = {'policy': {}} - m = re.match(r'.*policy<(.*)>', line) + + match = False + m = re.match(r'.* policy<(.*?)>', line) if m: + match = True entry['policy'] |= literal_eval(m.group(1)) - else: - m = re.match(r'.*note<(.*?)>', line) - if m: - entry['note'] = "'" + m.group(1).replace("'", '') + "'" - else: - raise Exception('syntax error') + + m = re.match(r'.* note<(.*?)>', line) + if m: + match = True + entry['note'] = "'" + m.group(1).replace("'", '') + "'" + + if not match: + raise Exception('syntax error') self.config[conf] = entry except Exception as e: raise Exception(str(e) + f', line = {line}')