- Support new baseplatform() method in platform base class.

- Allow multiple patterns for the ONLP platform library.
This commit is contained in:
Jeffrey Townsend
2016-01-04 19:43:59 +00:00
parent 8c64434055
commit e5bba253b3
2 changed files with 18 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ import pprint
import yaml
import json
import os
import re
class OnlInfoObject(object):
DEFAULT_INDENT=" "
@@ -146,6 +147,11 @@ class OnlPlatformBase(object):
def platform(self):
raise Exception("Platform is not set.")
def baseplatform(self):
p = self.platform()
p = re.sub(r'-r\d$', '', p)
return p
def description(self):
return "%s %s (%s)" % (self.manufacturer(), self.model(),
self.platform())

View File

@@ -42,12 +42,19 @@ def baseconfig():
msg("Could not determine the current host type.\n", fatal=True)
DEFAULT_ONLP_LIB = "/lib/%s/libonlp-platform.so" % DEB_GNU_HOST_TYPE
PLATFORM_ONLP_LIB = "%s/lib/libonlp-%s.so" % (platform.basedir_onl(), platform.platform())
if os.path.exists(PLATFORM_ONLP_LIB):
if os.path.exists(DEFAULT_ONLP_LIB):
os.unlink(DEFAULT_ONLP_LIB)
os.symlink(PLATFORM_ONLP_LIB, DEFAULT_ONLP_LIB)
PLATFORM_ONLP_LIBS = [
# Look for full platform and revision library
"%s/lib/libonlp-%s.so" % (platform.basedir_onl(), platform.platform()),
# Look for common platform library
"%s/lib/libonlp-%s.so" % (platform.basedir_onl(), platform.baseplatform()),
]
for l in PLATFORM_ONLP_LIBS:
if os.path.exists(l):
if os.path.exists(DEFAULT_ONLP_LIB):
os.unlink(DEFAULT_ONLP_LIB)
os.symlink(l, DEFAULT_ONLP_LIB)
ONLPDUMP = "%s/bin/onlpdump" % (platform.basedir_onl())