All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Thiery <heiko.thiery@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/1] check-package: add version format check
Date: Fri, 25 Oct 2019 11:21:04 +0200	[thread overview]
Message-ID: <20191025092104.1164-1-heiko.thiery@gmail.com> (raw)

From: Heiko Thiery <heiko.thiery@kontron.com>

To meet the requirement of "Anitya", the tool used by
https://release-monitoring.org/, the <pkg>_VERSION variable
should not contain a prefix 'v'.

Signed-off-by: Heiko Thiery <heiko.thiery@kontron.com>
---
 utils/checkpackagelib/lib_mk.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py
index dd04ffd58f..b04fe370d5 100644
--- a/utils/checkpackagelib/lib_mk.py
+++ b/utils/checkpackagelib/lib_mk.py
@@ -325,3 +325,23 @@ 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*(.*)")
+    VERSION_FAIL = re.compile("v[0-9]+")
+
+    def check_line(self, lineno, text):
+        m = self.VERSION.search(text)
+
+        if m is None:
+            return
+
+        variable, assignment = m.group(1, 2)
+
+        if self.VERSION_FAIL.match(assignment):
+            return ["{}:{}: remove 'v' prefix from {} of variable {}_VERSION "
+                    "and add to {}_SITE"
+                    .format(self.filename, lineno, assignment, variable,
+                            variable),
+                    text]
-- 
2.20.1

             reply	other threads:[~2019-10-25  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  9:21 Heiko Thiery [this message]
2019-10-26 13:57 ` [Buildroot] [PATCH v2 1/1] check-package: add version format check Thomas Petazzoni
2019-10-27  6:12   ` Heiko Thiery
2019-10-27  6:57   ` Matthew Weber
2019-10-27 10:13     ` Matthew Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191025092104.1164-1-heiko.thiery@gmail.com \
    --to=heiko.thiery@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.