Merge pull request #84 from Enlik/rewriter-bugfix

[entropy.core] fix DependencyRewriter with or-dependencies
This commit is contained in:
geaaru
2019-11-09 17:01:55 +01:00
committed by GitHub
2 changed files with 19 additions and 1 deletions
+10 -1
View File
@@ -1346,7 +1346,16 @@ class DependencyRewriter(object):
new_deps = []
for dep in self.deps:
clean_dep = dep_getkey(dep)
dep_prefix, dep_postfix = dep.split(clean_dep, 1)
try:
dep_prefix, dep_postfix = dep.split(clean_dep, 1)
except ValueError:
# String could not be split into two parts;
# dep_getkey(dep) is not in dep.
# E.g. dep_getkey("a/b[c];d/e[f]") => a/b;d/e
# Consider the rule as not matched.
new_deps.append(dep)
continue
use_flags_list, clean_use_flags_list = self._use_flags_from_dep(dep_postfix)
+9
View File
@@ -534,6 +534,15 @@ class DependencyRewriterBasicAttrsTests(unittest.TestCase, MatchedChangedTestsMi
self._expected_changed = False
self._validate()
def test_not_matched_for_complex_dep(self):
# entropy.dep.dep_getkey("a/b[c];d/e[f]") => a/b;d/e
# Something like this would make it crash.
self._rule = "from-dep=x11-misc/lightdm to-dep=x11-misc/lightdm"
self._deps = ["a/b[c];d/e[f]"]
self._expected_matched = False
self._expected_changed = False
self._validate()
if __name__ == '__main__':
unittest.main()