buildman: Automatically create a config file if needed
If there is no ~/.buildman file, buildman currently complains and exists. To make things a little more friendly, create an empty one automatically. This will not allow things to be built, but --fetch-arch can be used to handle that. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
8ea42101d2
commit
8e605a5e3e
|
@ -22,6 +22,10 @@ def Setup(fname=''):
|
||||||
config_fname = fname
|
config_fname = fname
|
||||||
if config_fname == '':
|
if config_fname == '':
|
||||||
config_fname = '%s/.buildman' % os.getenv('HOME')
|
config_fname = '%s/.buildman' % os.getenv('HOME')
|
||||||
|
if not os.path.exists(config_fname):
|
||||||
|
print 'No config file found ~/.buildman\nCreating one...\n'
|
||||||
|
CreateBuildmanConfigFile(config_fname)
|
||||||
|
print 'To install tool chains, please use the --fetch-arch option'
|
||||||
if config_fname:
|
if config_fname:
|
||||||
settings.read(config_fname)
|
settings.read(config_fname)
|
||||||
|
|
||||||
|
@ -53,3 +57,43 @@ def SetItem(section, tag, value):
|
||||||
if config_fname is not None:
|
if config_fname is not None:
|
||||||
with open(config_fname, 'w') as fd:
|
with open(config_fname, 'w') as fd:
|
||||||
settings.write(fd)
|
settings.write(fd)
|
||||||
|
|
||||||
|
def CreateBuildmanConfigFile(config_fname):
|
||||||
|
"""Creates a new config file with no tool chain information.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
config_fname: Config filename to create
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
f = open(config_fname, 'w')
|
||||||
|
except IOError:
|
||||||
|
print "Couldn't create buildman config file '%s'\n" % config_fname
|
||||||
|
raise
|
||||||
|
|
||||||
|
print >>f, '''[toolchain]
|
||||||
|
# name = path
|
||||||
|
# e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux
|
||||||
|
|
||||||
|
[toolchain-prefix]
|
||||||
|
# name = path to prefix
|
||||||
|
# e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-
|
||||||
|
|
||||||
|
[toolchain-alias]
|
||||||
|
# arch = alias
|
||||||
|
# Indicates which toolchain should be used to build for that arch
|
||||||
|
x86 = i386
|
||||||
|
blackfin = bfin
|
||||||
|
nds32 = nds32le
|
||||||
|
openrisc = or1k
|
||||||
|
|
||||||
|
[make-flags]
|
||||||
|
# Special flags to pass to 'make' for certain boards, e.g. to pass a test
|
||||||
|
# flag and build tag to snapper boards:
|
||||||
|
# snapper-boards=ENABLE_AT91_TEST=1
|
||||||
|
# snapper9260=${snapper-boards} BUILD_TAG=442
|
||||||
|
# snapper9g45=${snapper-boards} BUILD_TAG=443
|
||||||
|
'''
|
||||||
|
f.close();
|
||||||
|
|
Loading…
Reference in New Issue