[elbe-devel] [PATCH] fix package list validation error when using wildcards in package version

Buehler, Matthias Matthias.Buehler at trumpf.com
Fri Nov 6 09:09:56 CET 2020


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

>From b3c389d67e8a77c4512f3b26246afb826e38149d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20B=C3=BChler?= <matthias.buehler at trumpf.com>
Date: Fri, 6 Nov 2020 09:03:11 +0100
Subject: [PATCH] fix package list validation error when using wildcards in
 package version

---
 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.11.0




More information about the elbe-devel mailing list