- # define xml file to be used
- #
- # get current Linux platform
- plt_name, plt_ver, plt_arch = get_os_release()
- data = []
- for i in plt_name, plt_ver, plt_arch:
- if i: data.append(i)
- full_plt_name = " ".join(data)
- # get all supported platforms
- all_platforms = get_supported_platforms(xml_file)
- if all_platforms:
- if pltname:
- # platform name is specified in the command line
- if pltname in all_platforms:
- # if specified platform is supported, choose the corresponding XML file for use
- xml_file = all_platforms[pltname]
- else:
- # if specified platform is NOT supported, print warning message
- # and prompt user to choose another platform
- msg = "Specified platform is not supported: %s" % (pltname)
- warning(msg)
- pltname, xml_file = select_platform(all_platforms)
- pass
- pass
- elif full_plt_name in all_platforms:
- # if current platform is supported, choose the corresponding XML file for use
- pltname = full_plt_name
- xml_file = all_platforms[pltname]
- else:
- if xml_file and len(all_platforms) == 1:
- # XML file is specified and contains only one platform definition
- xml_file = all_platforms.values()[0]
- pltname = all_platforms.keys()[0]
- else:
- # current Linux platform is not supported, print warning message
- # and prompt user to choose platform from the list
- warning("Not supported Linux platform: %s."%" ".join(data))
- pltname, xml_file = select_platform(all_platforms)
- pass
- pass
- else:
- # current Linux platform is not supported, exit
- if pltname:
- msg = "Not supported Linux platform: %s."%pltname
- else:
- msg = "Not supported Linux platform: %s."%" ".join(data)
- error_exit(msg, False)
- pass
-