def __init__(self): platform = OnlPlatform() self.variables = {} self.variables['PLATFORM'] = platform.platform() self.variables['ARCH'] = pp.machine() self.variables['PARCH'] = onl.util.dpkg_architecture() self.config = {} for dir_ in self.SYSTEM_CONFIG_DIRS: if os.path.isdir(dir_): for f in sorted(os.listdir(dir_)): if f.endswith('.yml'): d = onl.onlyaml.loadf(os.path.join(dir_, f), self.variables) self.config = onl.util.dmerge(self.config, d) self.config['pc'] = platform.platform_config
def __init__(self): platform = OnlPlatform() self.variables = {} self.variables['PLATFORM'] = platform.platform() self.variables['ARCH'] = pp.machine() self.variables['PARCH'] = dict(ppc='powerpc', x86_64='amd64', armv7l='armel')[pp.machine()] self.config = {} for f in sorted(os.listdir(self.SYSTEM_CONFIG_DIR)): if f.endswith('.yml'): d = onl.onlyaml.loadf(os.path.join(self.SYSTEM_CONFIG_DIR, f), self.variables) self.config = onl.util.dmerge(self.config, d) self.config['pc'] = platform.platform_config
def __init__(self): platform = OnlPlatform() self.variables = {} self.variables['PLATFORM'] = platform.platform() self.variables['ARCH'] = pp.machine() self.variables['PARCH'] = dict(ppc='powerpc', x86_64='amd64', armv7l='armel', aarch64='arm64')[pp.machine()] self.config = {} for f in sorted(os.listdir(self.SYSTEM_CONFIG_DIR)): if f.endswith('.yml'): d = onl.onlyaml.loadf(os.path.join(self.SYSTEM_CONFIG_DIR, f), self.variables) self.config = onl.util.dmerge(self.config, d) self.config['pc'] = platform.platform_config
def __init__(self): if not (self.name and self.Name and self.atype and self.title and self.current_version_key and self.next_version_key): raise Exception( "Name descriptors must be provided by deriving class.") self.init_logger() self.init_argparser() self.load_config() self.arch = pp.machine() self.parch = dict(ppc='powerpc', x86_64='amd64', armv7l='armel')[self.arch] self.platform = OnlPlatform()
def __init__(self): if not (self.name and self.Name and self.atype and self.title and self.current_version_key and self.next_version_key): raise Exception( "Name descriptors must be provided by deriving class.") self.init_logger() self.init_argparser() self.load_config() self.arch = pp.machine() self.parch = onl.util.dpkg_architecture() self.platform = OnlPlatform() self.init() self.current_version = None self.next_version = None self.init_versions()
def baseconfig(): platform=OnlPlatform() msg("Setting up base ONL platform configuration for %s...\n" % platform.platform()) if os.path.exists(OnlPlatform.CURRENT_DIR): os.unlink(OnlPlatform.CURRENT_DIR) os.symlink(platform.basedir(), OnlPlatform.CURRENT_DIR) DEB_GNU_HOST_TYPE = None HOST_TYPES = [ 'powerpc-linux-gnu', 'i486-linux-gnu', 'i386-linux-gnu', 'x86_64-linux-gnu', 'arm-linux-gnueabi', 'aarch64-linux-gnu', ] for ht in HOST_TYPES: if os.path.exists('/lib/%s' % ht): DEB_GNU_HOST_TYPE=ht break if DEB_GNU_HOST_TYPE is None: 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_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) ONLPD = "/bin/onlpd" try: import dmidecode with open("%s/dmi-system-version" % platform.basedir_onl(), "w") as f: f.write(dmidecode.QuerySection('system')['0x0001']['data']['Version']) except: pass finally: if 'dmidecodemod' in sys.modules: mod = sys.modules['dmidecodemod'] buf = mod.get_warnings() if buf: [msg("*** %s\n" % x) for x in buf.splitlines(False)] mod.clear_warnings() if not platform.baseconfig(): msg("*** platform class baseconfig failed.\n", fatal=True) if os.path.exists(ONLPD): chassis_dir = os.path.join(platform.basedir_onl(), "chassis") if not os.path.isdir(chassis_dir): os.makedirs(chassis_dir) os.system("%s chassis onie json > %s/onie-info.json" % (ONLPD, chassis_dir)) os.system("%s chassis asset json > %s/asset-info.json" % (ONLPD, chassis_dir)) msg("Setting up base platform configuration for %s: done\n" % platform.platform())
def baseconfig(): platform=OnlPlatform() msg("Setting up base ONL platform configuration for %s...\n" % platform.platform()) if os.path.exists(OnlPlatform.CURRENT_DIR): os.unlink(OnlPlatform.CURRENT_DIR) os.symlink(platform.basedir(), OnlPlatform.CURRENT_DIR) DEB_GNU_HOST_TYPE = None HOST_TYPES = [ 'powerpc-linux-gnu', 'i486-linux-gnu', 'i386-linux-gnu', 'x86_64-linux-gnu' ] for ht in HOST_TYPES: if os.path.exists('/lib/%s' % ht): DEB_GNU_HOST_TYPE=ht break if DEB_GNU_HOST_TYPE is None: 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_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()) if not platform.baseconfig(): msg("*** platform class baseconfig failed.\n", fatal=True) if os.path.exists(ONLPDUMP): os.system("%s -i > %s/oids" % (ONLPDUMP,platform.basedir_onl())) os.system("%s -o -j > %s/onie-info.json" % (ONLPDUMP, platform.basedir_onl())) os.system("%s -x -j > %s/platform-info.json" % (ONLPDUMP, platform.basedir_onl())) msg("Setting up base platform configuration for %s: done\n" % platform.platform())
def baseconfig(): platform=OnlPlatform() msg("Setting up base ONL platform configuration for %s...\n" % platform.platform()) if os.path.exists(OnlPlatform.CURRENT_DIR): os.unlink(OnlPlatform.CURRENT_DIR) os.symlink(platform.basedir(), OnlPlatform.CURRENT_DIR) DEB_GNU_HOST_TYPE = None HOST_TYPES = [ 'powerpc-linux-gnu', 'i486-linux-gnu', 'i386-linux-gnu', 'x86_64-linux-gnu', 'arm-linux-gnueabi', 'arm-linux-gnueabihf', 'aarch64-linux-gnu', ] for ht in HOST_TYPES: if os.path.exists('/lib/%s' % ht): DEB_GNU_HOST_TYPE=ht break if DEB_GNU_HOST_TYPE is None: 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_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()) try: import dmidecode with open("%s/dmi-system-version" % platform.basedir_onl(), "w") as f: f.write(dmidecode.QuerySection('system')['0x0001']['data']['Version']) except: pass finally: if 'dmidecodemod' in sys.modules: mod = sys.modules['dmidecodemod'] buf = mod.get_warnings() if buf: [msg("*** %s\n" % x) for x in buf.splitlines(False)] mod.clear_warnings() if not platform.baseconfig(): msg("*** platform class baseconfig failed.\n", fatal=True) if os.path.exists(ONLPDUMP): os.system("%s -i > %s/oids" % (ONLPDUMP,platform.basedir_onl())) os.system("%s -o -j > %s/onie-info.json" % (ONLPDUMP, platform.basedir_onl())) os.system("%s -x -j > %s/platform-info.json" % (ONLPDUMP, platform.basedir_onl())) msg("Setting up base platform configuration for %s: done\n" % platform.platform())
def baseconfig(): platform = OnlPlatform() msg("Setting up base ONL platform configuration for %s...\n" % platform.platform()) if os.path.exists(OnlPlatform.CURRENT_DIR): os.unlink(OnlPlatform.CURRENT_DIR) os.symlink(platform.basedir(), OnlPlatform.CURRENT_DIR) DEB_GNU_HOST_TYPE = None HOST_TYPES = [ 'powerpc-linux-gnu', 'i486-linux-gnu', 'i386-linux-gnu', 'x86_64-linux-gnu', 'arm-linux-gnueabi', 'aarch64-linux-gnu', ] for ht in HOST_TYPES: if os.path.exists('/lib/%s' % ht): DEB_GNU_HOST_TYPE = ht break if DEB_GNU_HOST_TYPE is None: 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_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()) if not platform.baseconfig(): msg("*** platform class baseconfig failed.\n", fatal=True) if os.path.exists(ONLPDUMP): os.system("%s -i > %s/oids" % (ONLPDUMP, platform.basedir_onl())) os.system("%s -o -j > %s/onie-info.json" % (ONLPDUMP, platform.basedir_onl())) os.system("%s -x -j > %s/platform-info.json" % (ONLPDUMP, platform.basedir_onl())) msg("Setting up base platform configuration for %s: done\n" % platform.platform())