From patchwork Sun Jul 8 05:17:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Martincoski X-Patchwork-Id: 940898 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="O2i+M8Sd"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41NcFK4DZhz9s3q for ; Sun, 8 Jul 2018 15:18:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EA14F87A77; Sun, 8 Jul 2018 05:18:43 +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 pXTM0iXy5gJ6; Sun, 8 Jul 2018 05:18:43 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 55F4F8794A; Sun, 8 Jul 2018 05:18:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 3454D1C25F0 for ; Sun, 8 Jul 2018 05:18:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D9A278626D for ; Sun, 8 Jul 2018 05:18:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8xutOS1Wntpm for ; Sun, 8 Jul 2018 05:18:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 3149085E65 for ; Sun, 8 Jul 2018 05:18:41 +0000 (UTC) Received: by mail-qt0-f194.google.com with SMTP id f18-v6so13093681qtp.10 for ; Sat, 07 Jul 2018 22:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=djMOciDwUnlEaBlijSZQlPi2+yyPRoM0Pza0HIG2YCs=; b=O2i+M8SdEuNaSSsej8kexf9YhtTapDixgbdKbZRmCMsBkkoxyzorY4JUlEjXcKR51P nxWn0eCyCklWaDG89L1ehN7k/MZY6sVf+tRs2ikLqmpp4mvTUmuVzesQwVwdZqSdN/0O SjoV2+qAVx6zZSXn5ByFRlS6ciM1w1jFhPTKsdApJXJqRWvy1rUvPEi5zmF8pIDLkV0e en4JRqAJiQK8qbeO18WtQsPGLJOs4sWIQKeuRfeKFvAU7krHxaLKfbrObK4DYAtikCEi AgQa9KHrBWo5pi/vESgj++MG1RAxmHyRfgHQdgIaGeU7ThOWEW3BChcu6pe5z7SDY+ef TKhQ== 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; bh=djMOciDwUnlEaBlijSZQlPi2+yyPRoM0Pza0HIG2YCs=; b=eErxA/3+8icEacdxbRCwpzF26DwKRo27OBM54FSc+UO9K6PAXUbC6I2FxqteyMJR1p HzBeZI0bH3qB8Y3uKp6/1GVUri0NKL5kDfzb9+rU/ILAkSnqurv636YIR2Y+RkxM7hdC FNr0DkyY7m9ykNyBOJSyeiJz8txZjamCyydAEVmYwAwhXNVFPdLquanvGh7s9CZ5hd48 n8OC1qeYQh0ZyP1Gm76yYPzMA4x/VWc3fqIhy0Kqw7skO+HLENXxXnpfMbxFN6Ryq9Jz lUKpio0XslP3dzYXkQl5eenS99OuU64I0hDmZ7sxYgdSIMNilp6FlNgQjCfJUJar8kWH xc8w== X-Gm-Message-State: APt69E2ttSVD2Q0zthgL+/YAgVJe9qGzmYXyegDXmVKsikZWBQieZaR7 e5Pu55lSFkapaVuKM2v4+eWpzg== X-Google-Smtp-Source: AAOMgpc6AA/fO48VslY3N+/d9vMMV0DJdiB63y5iAyDRCFSzM+VMlDBVftjJ0bkZS8xVy4/kPNsj8Q== X-Received: by 2002:aed:3ccf:: with SMTP id e15-v6mr15007823qtf.59.1531027120216; Sat, 07 Jul 2018 22:18:40 -0700 (PDT) Received: from ultri5.home ([177.134.40.140]) by smtp.gmail.com with ESMTPSA id f64-v6sm12255313qkf.2.2018.07.07.22.18.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jul 2018 22:18:39 -0700 (PDT) From: Ricardo Martincoski To: buildroot@buildroot.org Date: Sun, 8 Jul 2018 02:17:01 -0300 Message-Id: <20180708051701.3153-5-ricardo.martincoski@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180708051701.3153-1-ricardo.martincoski@gmail.com> References: <20180708051701.3153-1-ricardo.martincoski@gmail.com> Subject: [Buildroot] [PATCH 5/5] check-package: detect the use of ${} in .mk files X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Ricardo Martincoski MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" And warn to use $() instead. For examples see [1] and [2]. In the regexp, search for ${VARIABLE} but: - ignore comments; - ignore variables to be expanded by the shell "$${}"; - do not use \w as it would give false warnings for this sed contruct in mesa3d-headers.mk: 's:@includedir@:${prefix}/include:'. [1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html [2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381 Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Cc: Thomas Petazzoni --- With only this patch applied: https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/80161018 --- utils/checkpackagelib/lib_mk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py index 86e9aa2d97..423e592de1 100644 --- a/utils/checkpackagelib/lib_mk.py +++ b/utils/checkpackagelib/lib_mk.py @@ -251,3 +251,13 @@ class UselessFlag(_CheckFunction): "({}#_infrastructure_for_autotools_based_packages)" .format(self.filename, lineno, self.url_to_manual), text] + + +class VariableWithBraces(_CheckFunction): + VARIABLE_WITH_BRACES = re.compile(r"^[^#].*[^$]\${[A-Z0-9_]+}") + + def check_line(self, lineno, text): + if self.VARIABLE_WITH_BRACES.match(text.rstrip()): + return ["{}:{}: use $() to delimit variables, not ${{}}" + .format(self.filename, lineno), + text]