From patchwork Fri Oct 25 08:15:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1183894 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.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="CI4jNLwU"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46zxkW5v87z9sPL for ; Fri, 25 Oct 2019 19:15:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A23BA86A4F; Fri, 25 Oct 2019 08:15:28 +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 I9iOV_4Kul01; Fri, 25 Oct 2019 08:15:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6BD9C85F4D; Fri, 25 Oct 2019 08:15:26 +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 8D9F71BF2B7 for ; Fri, 25 Oct 2019 08:15:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7F165876FD for ; Fri, 25 Oct 2019 08:15:24 +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 Sh5c+RqylZQz for ; Fri, 25 Oct 2019 08:15:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by whitealder.osuosl.org (Postfix) with ESMTPS id 9684D876F7 for ; Fri, 25 Oct 2019 08:15:23 +0000 (UTC) Received: by mail-wm1-f48.google.com with SMTP id g7so1048807wmk.4 for ; Fri, 25 Oct 2019 01:15:23 -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:mime-version :content-transfer-encoding; bh=opEFsko+vuXVhz4hqPMWc4vt5j/hOcEv32aP1HW+Sa8=; b=CI4jNLwUDfu+CEqxx8HR7juTvsB5V5drq/mG0eGYkB8An39EZ3SZpq5X5q2EEb6m7l 5GM08I/GRaxlddWwG3s4evRXzEx9yc7v1hx8Gc4WO2u8qXyV6VDBDfbTUV4mbAYSjJa1 HHc/cBZnKLISyX28Lj13Hu3NJ2KoY8SrqAgmt6PezCHlZ5GNlZQaeaznj2PwE0OlmzLO leZdl422PW29gkiqW2Spa8oNetgZ1oiApi1OxmbHpbCdhm+kFlPMiXzXLSS39Kdxnp+K +VXT4SrafW/Td2K3z8PiRCyThICbyTlP9pLbT/lvjaXrjeIR8kBatFRljrOXLR6PgfgH UvlA== 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:mime-version :content-transfer-encoding; bh=opEFsko+vuXVhz4hqPMWc4vt5j/hOcEv32aP1HW+Sa8=; b=hRdEnJ+sWDl7zEQMOSRWLWRSu/8JnEq56IJ8HcU5aEPjUhRJXHg2vFQf2w3R0JaUzo oRwqwxvXLAMtknVOngX1J57WDTxq333canD4LegZyr9yNDg2g1G2D07EAmtuT+XYhzJl VcSssh5WQHHkiAZqEh1HP2yj2G5acmJgqFtklagx7njTAYojJunAZp7zTTlUzXaF/LWr t7yHmxBjsMSejrR9ma6VzQNE4IYzyKhU5P5NUPnGztPneWNDyZerDp1nseWgjq9s3ikN JjeDQGj8xG+m8K63AQYak722AAs35yxTbStl5Ja54OUEWjl1t7VJ8CC4vQFI/1fEE8Cx djqw== X-Gm-Message-State: APjAAAUlaRHpUZIzlgnUludZdlOb2btFr9jBl/hB0gwHaLzlkQXVPiLA WhP6MkVOr2CkfMBHzT4vEtP50ep1 X-Google-Smtp-Source: APXvYqxYDYySul+dP/rlhagzzi0BB5xfk9VwNKILh7aNrHi6G2/uplmCSrfogUJuYrTO0xfDiuj27g== X-Received: by 2002:a1c:208e:: with SMTP id g136mr2117239wmg.107.1571991321665; Fri, 25 Oct 2019 01:15:21 -0700 (PDT) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id s13sm1271488wmc.28.2019.10.25.01.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 01:15:20 -0700 (PDT) From: Heiko Thiery To: buildroot@buildroot.org Date: Fri, 25 Oct 2019 10:15:00 +0200 Message-Id: <20191025081459.32429-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] check-package: add version format check 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: Heiko Thiery , fontaine.fabrice@gmail.com, thomas.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Heiko Thiery To meet the requirement of "Anitya", the tool used by https://release-monitoring.org/, the _VERSION variable should not contain a prefix 'v'. Signed-off-by: Heiko Thiery --- utils/checkpackagelib/lib_mk.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py index dd04ffd58f..ffde48e05b 100644 --- a/utils/checkpackagelib/lib_mk.py +++ b/utils/checkpackagelib/lib_mk.py @@ -325,3 +325,28 @@ class VariableWithBraces(_CheckFunction): return ["{}:{}: use $() to delimit variables, not ${{}}" .format(self.filename, lineno), text] + + +class Version(_CheckFunction): + VERSION = re.compile(r"^([A-Z0-9_]+)_VERSION\s*[\+|:|]*=\s*(.*)") + GIT_HASH = re.compile("([A-Za-f0-9]{40})") + + def _is_git_hash(self, value): + return True if self.GIT_HASH.match(value) else False + + def check_line(self, lineno, text): + m = self.VERSION.search(text) + if m is None: + return + + variable, assignment = m.group(1, 2) + + if self._is_git_hash(assignment): + return + + if assignment.startswith('v'): + return ["{}:{}: remove 'v' prefix from {} of variable {}_VERSION " + "and add to {}_SITE" + .format(self.filename, lineno, assignment, variable, + variable), + text]