[elbe-devel] [PATCH v2 3/4] Revert "Fix pkg list validation error on version wildcards"

Torben Hohn torben.hohn at linutronix.de
Thu Mar 11 10:20:30 CET 2021


This reverts commit 57c34159ed640693d477ff2e6627f871225c3648.

Wildcards are interpreted as globs, and not as regexps.

This poses problems where versions like '10.3+deb10u8'
do not match themselves, when one of the versions is
interpreted as a regexp.

>>> re.match('10.3+deb10u8', '10.3+deb10u8') is None
True

An escape would be required.

>>> re.match('10.3\+deb10u8', '10.3+deb10u8') is None
False

This problem does not happen, when the version is interpreted as
a glob. This is implemented in a subsequent commit.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/dump.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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



More information about the elbe-devel mailing list