| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 | #!/usr/bin/env python3from os import environ, makedirs, chdir, listdirfrom os.path import isdirfrom subprocess import check_callfrom shutil import *from multiprocessing import cpu_count# Clean up and clone gluonif isdir('gluon'):    rmtree('gluon')check_call('git clone https://github.com/freifunk-gluon/gluon.git gluon -b "%s"' % environ['GLUON_TAG'], shell=True)makedirs('output')# Add site configurationmakedirs('gluon/site')copy('/usr/src/site.mk', 'gluon/site')copy('/usr/src/site.conf', 'gluon/site')copytree('/usr/src/i18n', 'gluon/site/i18n')# Preparechdir('gluon')check_call('make update', shell=True)# Choose targets to buildif 'GLUON_TARGETS' in environ:    targets = environ['GLUON_TARGETS'].split()else:    targets = [f for f in listdir('targets') if isdir('targets/%s' % f)]branch = environ['GLUON_BRANCH'] if 'GLUON_BRANCH' in environ else 'stable'broken = environ['GLUON_BROKEN'] if 'GLUON_BROKEN' in environ else '0'# Buildfor target in targets:    print('Building for target %s' % target)    check_call('make -j %s GLUON_BRANCH=%s BROKEN=%s GLUON_TARGET=%s' % (cpu_count()+1, branch, broken, target), shell=True)    check_call('make manifest GLUON_BRANCH=%s' % branch, shell=True)    copytree('output', '../output/%s' % target)    check_call('make dirclean', shell=True)print('''BUILD FINISHEDYou can copy the resulting images from the container using:docker cp %s:/usr/src/build/output <destination>'''% environ.get('HOSTNAME'))
 |