[entropy] make packages.server.qa.exec more modular

This commit is contained in:
Fabio Erculiani 2011-11-25 10:07:53 +01:00
parent 077ccf3ddb
commit ace3df2945

View File

@ -46,15 +46,15 @@ import sys
import os import os
import entropy.dep import entropy.dep
def check_unwanted_deps(): def check_unwanted_deps(pkg_deps):
""" """
Check against forbidden dependencies, those we consider meta packages, Check against forbidden dependencies, those we consider meta packages,
placeholders just to keep Gentoo compatibility, which, if listed as dep in, placeholders just to keep Gentoo compatibility, which, if listed as dep in,
would cause the whole world to be pulled in. would cause the whole world to be pulled in.
""" """
pkg_deps = os.getenv("PKG_DEPS") if not pkg_deps:
if pkg_deps is None:
return 0 return 0
pkg_atom = os.getenv("PKG_ATOM") pkg_atom = os.getenv("PKG_ATOM")
pkg_keywords = os.getenv("PKG_KEYWORDS") pkg_keywords = os.getenv("PKG_KEYWORDS")
@ -65,21 +65,21 @@ def check_unwanted_deps():
"dev-lang/gnat-gcc"] "dev-lang/gnat-gcc"]
func_rc = 0 func_rc = 0
pkg_deps = dict((entropy.dep.dep_getkey(x), x) for x in pkg_deps.split() if \ pkg_deps_map = dict((entropy.dep.dep_getkey(x), x) for x in pkg_deps if \
not x.startswith("!")) not x.startswith("!"))
for unwanted_dep in unwanted_deps: for unwanted_dep in unwanted_deps:
if unwanted_dep in pkg_deps: if unwanted_dep in pkg_deps_map:
sys.stderr.write("\nATTENTION ATTENTION ATTENTION\n") sys.stderr.write("\nATTENTION ATTENTION ATTENTION\n")
sys.stderr.write("%s contains forbidden dependency against %s\n" % ( sys.stderr.write("%s contains forbidden dependency against %s\n" % (
pkg_atom, pkg_deps[unwanted_dep])) pkg_atom, pkg_deps_map[unwanted_dep]))
sys.stderr.write("ATTENTION ATTENTION ATTENTION\n\n") sys.stderr.write("ATTENTION ATTENTION ATTENTION\n\n")
func_rc = 2 func_rc = 2
for warning_dep in warning_deps: for warning_dep in warning_deps:
if warning_dep in pkg_deps: if warning_dep in pkg_deps_map:
sys.stderr.write("\nATTENTION ATTENTION ATTENTION\n") sys.stderr.write("\nATTENTION ATTENTION ATTENTION\n")
sys.stderr.write("%s contains a weirdo dependency against %s\n" % ( sys.stderr.write("%s contains a weirdo dependency against %s\n" % (
pkg_atom, pkg_deps[warning_dep])) pkg_atom, pkg_deps_map[warning_dep]))
sys.stderr.write("ATTENTION ATTENTION ATTENTION\n\n") sys.stderr.write("ATTENTION ATTENTION ATTENTION\n\n")
if func_rc == 0: if func_rc == 0:
func_rc = 1 func_rc = 1
@ -98,7 +98,15 @@ def check_unwanted_deps():
if __name__ == "__main__": if __name__ == "__main__":
exit_st = check_unwanted_deps() pkg_deps = os.getenv("PKG_DEPS")
if exit_st != 0: if pkg_deps is None:
raise SystemExit(exit_st) return 0
raise SystemExit(0) pkg_deps = pkg_deps.split()
exit_st = 0
rc = check_unwanted_deps(pkg_deps)
if rc != 0:
exit_st = rc
# more tests here
raise SystemExit(exit_st)