Blame SOURCES/BZ-1510491-fixup-yumdb-validator.patch

6e3a62
commit 61cacc3c79c356a3c3a910b0c5ddd12cfaaa20e5
6e3a62
Author: Michal Domonkos <mdomonko@redhat.com>
6e3a62
Date:   Mon Nov 6 11:07:38 2017 +0100
6e3a62
6e3a62
    BZ 1510491
6e3a62
    
6e3a62
    Fix from_repo yumdb validator for local pkgs
6e3a62
6e3a62
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
6e3a62
index e810e2f9..19b9ab35 100644
6e3a62
--- a/yum/rpmsack.py
6e3a62
+++ b/yum/rpmsack.py
6e3a62
@@ -1731,6 +1731,12 @@ class RPMDBAdditionalData(object):
6e3a62
 
6e3a62
         pass
6e3a62
 
6e3a62
+def _validate_from_repo(value):
6e3a62
+    if value and value[0] == '/':
6e3a62
+        # Local package; chop the slash as it's not a valid repoid char
6e3a62
+        value = value[1:]
6e3a62
+    return misc.validate_repoid(value) is None
6e3a62
+
6e3a62
 class RPMDBAdditionalDataPackage(object):
6e3a62
 
6e3a62
     # We do auto hardlink on these attributes
6e3a62
@@ -1744,7 +1750,7 @@ class RPMDBAdditionalDataPackage(object):
6e3a62
     # Validate these attributes when they are read from a file
6e3a62
     _validators = {
6e3a62
         # Fixes BZ 1234967
6e3a62
-        'from_repo': lambda repoid: misc.validate_repoid(repoid) is None,
6e3a62
+        'from_repo': _validate_from_repo,
6e3a62
     }
6e3a62
 
6e3a62
     def __init__(self, conf, pkgdir, yumdb_cache=None):