[elbe-devel] [PATCH] Fix pkg list validation error on version wildcards

bage at linutronix.de bage at linutronix.de
Wed Jan 13 15:01:52 CET 2021


From: Matthias Bühler <matthias.buehler at trumpf.com>

Fix issue #276 "package list validation error when using wildcards in package
version".  Instead of comparing version strings use regex to match versions.

Signed-off-by: Matthias Bühler <matthias.buehler at trumpf.com>
[edit commit message]
Reviewed-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/dump.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/elbepack/dump.py b/elbepack/dump.py
index edc6637f6..ec5e8fbfb 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -6,6 +6,7 @@
 # SPDX-License-Identifier: GPL-3.0-or-later
 
 import logging
+import re
 
 from datetime import datetime
 
@@ -106,7 +107,7 @@ def check_full_pkgs(pkgs, fullpkgs, cache):
 
             ver = p.et.get('version')
             pkg = cache.get_pkg(nomulti_name)
-            if ver and (pkg.installed_version != ver):
+            if ver and (not re.match(ver, pkg.installed_version)):
                 validation.error("Package '%s' version '%s' does not match installed version %s",
                                  name, ver, pkg.installed_version)
                 errors += 1
@@ -143,7 +144,7 @@ def check_full_pkgs(pkgs, fullpkgs, cache):
 
         pkg = cache.get_pkg(name)
 
-        if pkg.installed_version != ver:
+        if not re.match(ver, pkg.installed_version):
             validation.error("Package '%s' version %s does not match installed version %s",
                              name, ver, pkg.installed_version)
             errors += 1
-- 
2.29.2



More information about the elbe-devel mailing list