projects.py: Started implementation of required os cascade

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2016-09-17 10:52:58 +00:00
commit bf056c61cc

View file

@ -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())