projects.py: Make OS-cascade support distro version families

Now ubuntu-14.04 is also caught by ubuntu-14

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2018-03-06 16:35:16 +00:00
commit 6ec57849c3

View file

@ -99,10 +99,23 @@ def htdocs_dir(name):
return None
def os_cascade():
r = [ 'os', platform.system().lower() ]
os = cache.run(get_os, [])
name = re.sub('-.*', '', os)
series = os
while True:
n = re.sub('\.[0-9]+$', '', series)
if n == series:
break
r.append(n)
series = n
if not name in r:
r.append(name)
if not os in r:
r.append(os)
# e.g. os, linux, suse, suse-tumbleweed
return [ 'os', platform.system().lower(), name, os ]
#return [ 'os', platform.system().lower(), name, os ]
return r
def strip_module_from_spec(mod):
return re.sub(r'-devel$|-run$', '', re.split('([=><]+)', mod)[0].strip())
@ -625,7 +638,7 @@ debug("----------------------------------------- running ", ' '.join(sys.argv))
projs_root = args.prefix
if args.topdir:
topdir = args.topdir
top_name = cache.run(read_value, [topdir + '/make/project.conf', 'build', 'name'])
top_name = res_cache.run(read_value, [topdir + '/make/project.conf', 'build', 'name'])
if not top_name:
top_name = re.sub('-[0-9.-]*$', '', basename(realpath(topdir)))