From patchwork Thu Aug 1 08:02:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 1140564 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mind.be Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mind-be.20150623.gappssmtp.com header.i=@mind-be.20150623.gappssmtp.com header.b="cpAy4onj"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45zw176PM6z9sBF for ; Fri, 2 Aug 2019 01:57:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 59EBF881AB; Thu, 1 Aug 2019 15:57:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tAbRQsQZhBSV; Thu, 1 Aug 2019 15:57:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 4CAA98830C; Thu, 1 Aug 2019 15:56:45 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 933C11BF3BC for ; Thu, 1 Aug 2019 08:02:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 90BB222735 for ; Thu, 1 Aug 2019 08:02:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sd8HERE9Y3Pg for ; Thu, 1 Aug 2019 08:02:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by silver.osuosl.org (Postfix) with ESMTPS id 151B72033B for ; Thu, 1 Aug 2019 08:02:53 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id z1so72477838wru.13 for ; Thu, 01 Aug 2019 01:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind-be.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pWzeD4FzzefC9l21489mUAqzNS7dd5BRRIalWo3ShQk=; b=cpAy4onjiAL65kfuzEKSe5V7awj0YdAI17ansj1GG1YXIoPbUStTh1OT0ZUzvF3cv0 +o8vcZu/7U/p6J/Vo8IMHUu1yhNRejSTxwnBrBMR8VJFIJZGYI3TmBFhiCnV/egvOPYi TmHf2fGivHcsv3GtgiEuxmIKf7FEDtcEx5M8F0dRoXul9JmzcDgtO8uWCmADuZI1W7VR /B5CROFlZ8HKW1H7tw96R5KroOJVbOZD3u9lv3C43kVRVaY+NyeFAyaEl8u/rafnxb5Z 6n9DhPnEq5ETIS5nYlJiYXKRz2vRj+uJN93dV2plyZe7YTh+zxnKZhmdZy46Ia1NkKh/ RI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pWzeD4FzzefC9l21489mUAqzNS7dd5BRRIalWo3ShQk=; b=ucYpXINh9/jDjsBtV85xb4v2UFvoRLQ5aybiiJRxZppbok3/fsIgJVSQFAO+0SwjQb ho7Rep+HXAeVeCEr8wPvUf3vKCFPl+Zuq9GdGT0ppPM8es3/wOCa8MXeMPW3cTg0PyNF d6U6JR9wg+Hw8fmzamSYmcegFNxMEOjCqMuXfvQUUONjio2XYkqnp3zxxmJGEyco5H9N tFiFdo4oaDX/25gQuhbudt0TtmkUj7MprhfP6hq/Nh3tq4nRGaFH5j+pO6mPLaiIPnuI 8QGECjASUrAtynL9VS8Rr0zW8W+W+0eRRgIG5znrCsZsQLVmvXieWBSo5IDuSYlyUMYR N6mg== X-Gm-Message-State: APjAAAXySnu2SY4Pys/qhnflhu5rrm7uI4S5CzQds8J4XujWo+mC4f67 lhx5LS2Vzzg+CX3x8GAcR13DMfADCGJyWg== X-Google-Smtp-Source: APXvYqzF4sSHv99WuUl5VFqHz3PprLQTJykypAoIM+/FIigGrrbTY+5cGd/0wBqmRyUtHgC6Z0ZLRQ== X-Received: by 2002:a5d:53ca:: with SMTP id a10mr867544wrw.131.1564646571773; Thu, 01 Aug 2019 01:02:51 -0700 (PDT) Received: from arnoutx1.home (lfbn-1-2159-45.w90-76.abo.wanadoo.fr. [90.76.216.45]) by smtp.gmail.com with ESMTPSA id y10sm58248870wmj.2.2019.08.01.01.02.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 01:02:51 -0700 (PDT) From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@buildroot.org Date: Thu, 1 Aug 2019 10:02:35 +0200 Message-Id: <20190801080237.5462-2-arnout@mind.be> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190801080237.5462-1-arnout@mind.be> References: <20190801080237.5462-1-arnout@mind.be> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 1/3] utils/checkpackagelib: CommentsMenusPackagesOrder: fix 'menuconfig' handling X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The CommentsMenusPackagesOrder check builds the 'state' to track the depth of menus and conditions. However, a menuconfig doesn't create a menu by itself - it is always followed by a condition that implies the menu. As a result, when unwinding the 'state', the level will be wrong. Fix this by checking for menu followed by a space, so it no longer matches menuconfig. For consistency, do the same for comment and if as well. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Jerzy Grzegorek --- v3: use Jerzy's approach of adding a space after all conditions, not just menu. v2: Jerzy independently did a similar change. --- utils/checkpackagelib/lib_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py index 7d7567ac67..b42760396e 100644 --- a/utils/checkpackagelib/lib_config.py +++ b/utils/checkpackagelib/lib_config.py @@ -77,8 +77,8 @@ class CommentsMenusPackagesOrder(_CheckFunction): "package/Config.in.host"]: return - if text.startswith("comment") or text.startswith("if") or \ - text.startswith("menu"): + if text.startswith("comment ") or text.startswith("if ") or \ + text.startswith("menu "): if text.startswith("comment"): if not self.state.endswith("-comment"): From patchwork Thu Aug 1 08:02:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 1140575 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mind.be Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mind-be.20150623.gappssmtp.com header.i=@mind-be.20150623.gappssmtp.com header.b="lMIRtcHO"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45zw404cFtz9s00 for ; Fri, 2 Aug 2019 02:00:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 58B4F8769F; Thu, 1 Aug 2019 16:00:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o2vk9qigs4wX; Thu, 1 Aug 2019 16:00:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id CF45D875BB; Thu, 1 Aug 2019 15:56:46 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id C55171BF3BC for ; Thu, 1 Aug 2019 08:02:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C0DA6868F4 for ; Thu, 1 Aug 2019 08:02:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nSy-hCv1yyCe for ; Thu, 1 Aug 2019 08:02:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by whitealder.osuosl.org (Postfix) with ESMTPS id 6F9968589A for ; Thu, 1 Aug 2019 08:02:55 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id p13so72474149wru.10 for ; Thu, 01 Aug 2019 01:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind-be.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c2Ngg4Iel3G/0T3FVKUZIDWRfVxdiaGPwSw1vzHzRqY=; b=lMIRtcHOh/9kREvWuFc6PE2lPGrR6EPzrEnDpmNFTdPMrNq/hNL29IJ/8aAk4ogDCP s+TERlQ2keGXJo40g40zCGp5zIpiSf2EYfpCC6GrGxl8lJEI78zq/81pUAApm1oKNnsE zvEFVHyMGIS1l4pQmNpUhywnRUZnV0q43oSbtohPWDQ1IqNAffPXIW7pBkrE2Wc9aLOG bFANDCc+CVNOIpI1oRBEkDjUmuGe8JkcWKEIrWk72IadzKJAfx11MOki9XOVKe/YpH2W 2T7PYFvOvRtD63ZGrXaVkOjQsXJL6osETzoDxwvJiv90poFsD4dP10DhEYjynggP+rrT XrRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c2Ngg4Iel3G/0T3FVKUZIDWRfVxdiaGPwSw1vzHzRqY=; b=gaTPPqlj//qKGaHI0WzOAty3Us5nxk1QOwyMWZ7/9xfqj/Dvra+38KqaTHMShFXKSd vpV78camaI0KZ6v1VuC21cyNN/JAuvpoxhYovK5qDCLUN9vBYR8jyq2Iep1bDKrYSbLT kfI56fCuXOasyn61YcfXwl3SIFrk9dr0hd0GbVDe08iGZVQiTo5sM1q5CTrqZL17gVK1 C7iNooNbv9k0DhAHeb7FB5MrFGt8XuEe7byUS7Wp2xBVjNVYeg7EFQi86OXQAswWqMRU goGe0XJ3qk4R6O47hMJT4XyZjD+c1lCC08yYtgIKPQ3xQ0LAR8BGkyH20/QgA18SY2ZJ Z6WA== X-Gm-Message-State: APjAAAUWfjmtmwN7YpNwWcXR1hTr1NLnOTvg255S2+ztYp0ISZ9qQkJF +1U+WQ8Tj01GiqjFkENkpbcbUXzAalkFcQ== X-Google-Smtp-Source: APXvYqz8HDRdh0dQlXBmuB6O1xU46p2Sf4nL00IEND5lq/9H1hdplvZpxC1HhKrVo/VQtN+ZHawbgQ== X-Received: by 2002:adf:e708:: with SMTP id c8mr37576861wrm.25.1564646572975; Thu, 01 Aug 2019 01:02:52 -0700 (PDT) Received: from arnoutx1.home (lfbn-1-2159-45.w90-76.abo.wanadoo.fr. [90.76.216.45]) by smtp.gmail.com with ESMTPSA id y10sm58248870wmj.2.2019.08.01.01.02.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 01:02:52 -0700 (PDT) From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@buildroot.org Date: Thu, 1 Aug 2019 10:02:36 +0200 Message-Id: <20190801080237.5462-3-arnout@mind.be> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190801080237.5462-1-arnout@mind.be> References: <20190801080237.5462-1-arnout@mind.be> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 2/3] utils/checkpackagelib: CommentsMenusPackagesOrder: append elements to arrays if needed X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jerzy Grzegorek Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Jerzy Grzegorek In the future, the nesting level of menus, comments and conditions may increase. The fixed array length used now is not appropriate. Therefore, append elements to the arrays if needed. Also change order of variables. Signed-off-by: Jerzy Grzegorek Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- Changes v2 -> v3: - Initialize arrays to empty - Rewrite commit log Changes v1 -> v2: - use try/except statement instead of if one (Yann) At the beginning self.state is empty and variable level (index of arrays) is equal 0. We append elements to arrays for the first time when a line begining with "comment ", "if " or "menu ". At that moment level is equal 1 and each array should have two elements (index 0 and 1). To achieve this we can use empty arrays or arrays with an initial value (index 0). 1. Arrays with an initial value and if statement (previous version) ... if level > len(array) - 1 append elements ... 2. Empty arrays and while statement ... while level > len(array) - 1 append elements ... 3. Arrays with an initial value and try/except statement (this version) ... try: assigment staff except IndexError: append elements ... --- utils/checkpackagelib/lib_config.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py index b42760396e..6cbdc209c8 100644 --- a/utils/checkpackagelib/lib_config.py +++ b/utils/checkpackagelib/lib_config.py @@ -61,9 +61,9 @@ class AttributesOrder(_CheckFunction): class CommentsMenusPackagesOrder(_CheckFunction): - print_package_warning = [True, True, True, True, True, True] - menu_of_packages = ["", "", "", "", "", ""] - package = ["", "", "", "", "", ""] + menu_of_packages = [] + package = [] + print_package_warning = [] def before(self): self.state = "" @@ -92,9 +92,15 @@ class CommentsMenusPackagesOrder(_CheckFunction): self.state += "-menu" level = self.get_level() - self.package[level] = "" - self.print_package_warning[level] = True - self.menu_of_packages[level] = text[:-1] + + try: + self.menu_of_packages[level] = text[:-1] + self.package[level] = "" + self.print_package_warning[level] = True + except IndexError: + self.menu_of_packages.append(text[:-1]) + self.package.append("") + self.print_package_warning.append(True) elif text.startswith("endif") or text.startswith("endmenu"): if self.state.endswith("comment"): From patchwork Thu Aug 1 08:02:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 1140579 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mind.be Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mind-be.20150623.gappssmtp.com header.i=@mind-be.20150623.gappssmtp.com header.b="nG+e+06K"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45zw486y1wz9sDQ for ; Fri, 2 Aug 2019 02:00:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 432D387E77; Thu, 1 Aug 2019 16:00:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TmahC7CR4Dc4; Thu, 1 Aug 2019 16:00:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id AED77878BA; Thu, 1 Aug 2019 15:56:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 0CC381BF3BC for ; Thu, 1 Aug 2019 08:02:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 04D5622735 for ; Thu, 1 Aug 2019 08:02:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QHnFgummCYDk for ; Thu, 1 Aug 2019 08:02:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by silver.osuosl.org (Postfix) with ESMTPS id F0E3B2033B for ; Thu, 1 Aug 2019 08:02:55 +0000 (UTC) Received: by mail-wr1-f48.google.com with SMTP id p17so72484887wrf.11 for ; Thu, 01 Aug 2019 01:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind-be.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fkHnJY6oSksgm1TPZXZBBra0bTUPMdPysy5evgxeoXI=; b=nG+e+06KUV2+dXe/Oj30PAX12LLWRbrBkUGDXUGMDwnNOPJexJfYVE50GM6+wpqHdM o+hb6e5jHDqJlXs9/BNeyTHIUZBvM/tNPmZHax8FbOw7NCmvJYpDgwwVRqEjERfinU0F HCSMEL/nnT1OsjyhSuMegz1mXCoaW/9yvKKvswlYS9/1qAuCj6bqWUEGy0jG8JxYYwZD kbAgU2QaZcPJd+RHrV3juMAdidiu46yj8QB+oAChwSIuuP2+G2tWC2TCp6nDKHIZnC+6 EqimZFAvxyOJKv9R5LuX5q/MA7q21Cl03H+XgyrgXcCQ+v87wrOQIYOmGm1k86gZ4YEc W8+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fkHnJY6oSksgm1TPZXZBBra0bTUPMdPysy5evgxeoXI=; b=gfe/xG0YNetlqHRL46C3h0umikAMLvw2c60z8B66nfQXFg269ZfyggRhacH9jKFDu1 hvD99AaiC9k0YlrB2X77Z1myEOoF6SL1jHeRpBIcfJN2dZBhahD9708Z3CilCd9tcBk8 CzUw0GJhtrCRiJvxh7JM/nPo0JI4YiIkVSESy7ZwJ+0MDLXJz56iaJJ6gQiTUxiDsr4h b0QiDo+5OQY6mEEDtDd/ITSnZdWUkjn1WF3zKibtJxbCsoZeNvQT8MyoEmvheVtgIEij HFFhHyBsHt2aEhcqHUbq0vr7xLrSzAjtpQt+APV6gfCSBneREC2J7C+1vkG4Zp+TSKNl izpg== X-Gm-Message-State: APjAAAV6vvpBk8/K7ritX47D7w6k370LGQr0Xg6Hdqmrm419KoopmSIl svjq5iz5pxmmeUn2Bb/lH3uZlp+1HCcfQA== X-Google-Smtp-Source: APXvYqxuOSZNUKSphjUGQ59o6mLaDCZYhFZe60zKdyOvcngLLGE/l50Jma3p80wzmD+3EuEs2r6XcA== X-Received: by 2002:adf:eacf:: with SMTP id o15mr17198503wrn.171.1564646574013; Thu, 01 Aug 2019 01:02:54 -0700 (PDT) Received: from arnoutx1.home (lfbn-1-2159-45.w90-76.abo.wanadoo.fr. [90.76.216.45]) by smtp.gmail.com with ESMTPSA id y10sm58248870wmj.2.2019.08.01.01.02.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 01:02:53 -0700 (PDT) From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@buildroot.org Date: Thu, 1 Aug 2019 10:02:37 +0200 Message-Id: <20190801080237.5462-4-arnout@mind.be> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190801080237.5462-1-arnout@mind.be> References: <20190801080237.5462-1-arnout@mind.be> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 3/3] utils/checkpackagelib: CommentsMenusPackagesOrder: use regex for source X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The 'source' strings identify which package is incorrectly ordered. We need to extract the actual package name from that string, which is currently done with constants that assume the file is package/Config.in. In addition, only 'source' lines that are indented with a tab are checked. This kind of indentation is done in package/Config.in, but not e.g. boot/Config.in. Therefore, use a regular expression to match the 'source' lines, and to extract the directory part from it. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- v3: new patch --- utils/checkpackagelib/lib_config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py index 6cbdc209c8..26349fb681 100644 --- a/utils/checkpackagelib/lib_config.py +++ b/utils/checkpackagelib/lib_config.py @@ -77,6 +77,7 @@ class CommentsMenusPackagesOrder(_CheckFunction): "package/Config.in.host"]: return + m = re.match(r'^\s*source ".*/([^/]*)/Config.in(.host)?"', text) if text.startswith("comment ") or text.startswith("if ") or \ text.startswith("menu "): @@ -112,9 +113,9 @@ class CommentsMenusPackagesOrder(_CheckFunction): elif text.startswith("endmenu"): self.state = self.state[:-5] - elif text.startswith('\tsource "package/'): + elif m: level = self.get_level() - new_package = text[17: -(len(self.filename)-5):] + new_package = m.group(1) # We order _ before A, so replace it with . new_package_ord = new_package.replace('_', '.')