[noarch/entropy] make unwanted deps QA check work better with multiple slotted deps

This commit is contained in:
Fabio Erculiani 2012-04-23 21:54:36 +02:00
parent a8f695c19f
commit 4942da371f

View File

@ -83,24 +83,35 @@ def check_unwanted_deps():
(entropy.dep.dep_getkey(x), (entropy.dep.dep_getslot(x), x)) \ (entropy.dep.dep_getkey(x), (entropy.dep.dep_getslot(x), x)) \
for x in pkg_deps if not x.startswith("!")) for x in pkg_deps if not x.startswith("!"))
pkg_deps_map = {}
for pkg_dep in pkg_deps:
if x.startswith("!"):
continue
key = entropy.dep.dep_getkey(pkg_dep)
obj = pkg_deps_map.setdefault(key, [])
val = entropy.dep.dep_getslot(pkg_dep), pkg_dep
obj.append(val)
for unwanted_dep in unwanted_deps: for unwanted_dep in unwanted_deps:
unwanted_slot = entropy.dep.dep_getslot(unwanted_dep) unwanted_slot = entropy.dep.dep_getslot(unwanted_dep)
if unwanted_slot: if unwanted_slot:
unwanted_dep = entropy.dep.remove_slot(unwanted_dep) unwanted_dep = entropy.dep.remove_slot(unwanted_dep)
dep_data = pkg_deps_map.get(unwanted_dep) dep_data_list = pkg_deps_map.get(unwanted_dep)
if dep_data is None: if dep_data_list is None:
continue continue
dep_slot, dep = dep_data
if not unwanted_slot: for dep_data in dep_data_list:
unwanted_slot = dep_slot dep_slot, dep = dep_data
if dep_slot == unwanted_slot: if not unwanted_slot:
write_attention_msg( unwanted_slot = dep_slot
"%s contains forbidden dependency against %s" % (
pkg_atom, pkg_deps_map[unwanted_dep][1])) if dep_slot == unwanted_slot:
func_rc = 2 write_attention_msg(
"%s contains forbidden dependency against %s" % (
pkg_atom, pkg_deps_map[unwanted_dep][1]))
func_rc = 2
for warning_dep in warning_deps: for warning_dep in warning_deps:
@ -108,20 +119,22 @@ def check_unwanted_deps():
if warning_slot: if warning_slot:
warning_dep = entropy.dep.remove_slot(warning_dep) warning_dep = entropy.dep.remove_slot(warning_dep)
dep_data = pkg_deps_map.get(warning_dep) dep_data_list = pkg_deps_map.get(warning_dep)
if dep_data is None: if dep_data_list is None:
continue continue
dep_slot, dep = dep_data
if not warning_slot: for dep_data in dep_data_list:
unwanted_slot = dep_slot dep_slot, dep = dep_data
if dep_slot == warning_slot: if not warning_slot:
write_attention_msg( unwanted_slot = dep_slot
"%s contains a weirdo dependency against %s" % (
pkg_atom, pkg_deps_map[warning_dep][1])) if dep_slot == warning_slot:
if func_rc == 0: write_attention_msg(
func_rc = 1 "%s contains a weirdo dependency against %s" % (
pkg_atom, pkg_deps_map[warning_dep][1]))
if func_rc == 0:
func_rc = 1
if pkg_keywords is not None: if pkg_keywords is not None:
keywords = pkg_keywords.split() keywords = pkg_keywords.split()