diff --git a/scripts/projects.py b/scripts/projects.py index ca6e0571..68b76713 100644 --- a/scripts/projects.py +++ b/scripts/projects.py @@ -21,6 +21,9 @@ def debug(*objs): if args.debug: print("DEBUG: ", *objs, file=sys.stderr) +def err(*objs): + print("ERR: ", *objs, file=sys.stderr) + def proj_dir(name): return projs_root + '/' + name @@ -30,6 +33,19 @@ def re_section(name): '(?=[)', re.DOTALL) +def get_os(): + for d in [ projs_root + 'ytools/devutil/scripts', '/opt/ytools/bin' ]: + script=d + '/get_os.sh' + if os.path.isfile(script): + cmd = '/bin/bash ' + script + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + (out, rr) = p.communicate() + if rr: + err("failed to run ", cmd) + continue + return out + return "linux" + # TODO: add support for customizing this in project.conf def htdocs_dir(name): pd = proj_dir(name) @@ -39,8 +55,11 @@ def htdocs_dir(name): return r return None -def required_cascade(): - return [] +def pkg_required_os_cascade(): + os = get_os() + # TODO: implement this + #return [ 'os', 'os.linux', 'os.linux.suse', 'os.linux.suse.tumbleweed' ] ? + return [ 'os', 'linux', 'suse', 'suse-tumbleweed' ] def strip_module_from_spec(mod): return re.sub(r'-devel$|-run$', '', re.split('([=><]+)', mod)[0].strip())