sync confirmed working. still need to test iPXE builds.

This commit is contained in:
brent s. 2016-12-11 21:12:09 -05:00
parent 60ee17bf9d
commit 3c46d85683
4 changed files with 19 additions and 12 deletions

View File

@ -386,7 +386,7 @@ def genISO(conf):


def displayStats(iso): def displayStats(iso):
for i in iso['name']: for i in iso['name']:
print("{0}:\t\t\t == {1} {2} ==".format(datetime.datetime.now(), iso[i]['type'], iso[i]['fmt'])) print("{0}: == {1} {2} ==".format(datetime.datetime.now(), iso[i]['type'], iso[i]['fmt']))
print('\t\t\t = Size: {0}'.format(iso[i]['size'])) print('\t\t\t = Size: {0}'.format(iso[i]['size']))
print('\t\t\t = SHA256: {0}'.format(iso[i]['sha'])) print('\t\t\t = SHA256: {0}'.format(iso[i]['sha']))
print('\t\t\t = Location: {0}'.format(iso[i]['file'])) print('\t\t\t = Location: {0}'.format(iso[i]['file']))

View File

@ -2,6 +2,7 @@ import os
import sys import sys
import platform import platform
import re import re
import glob
import configparser import configparser
import validators import validators
import git import git
@ -75,6 +76,22 @@ def parseConfig(confs):
config_dict['bdisk']['ver'] = refs[0] + 'r' + refs[2] config_dict['bdisk']['ver'] = refs[0] + 'r' + refs[2]
for i in ('http', 'tftp', 'rsync', 'git'): for i in ('http', 'tftp', 'rsync', 'git'):
config_dict['sync'][i] = config['sync'].getboolean(i) config_dict['sync'][i] = config['sync'].getboolean(i)
# And the build number.
# TODO: support tracking builds per version. i.e. in buildnum:
# v2.51r13:0
# v2.51r17:3
if os.path.isfile(config_dict['build']['dlpath'] + '/buildnum'):
with open(config_dict['build']['dlpath'] + '/buildnum', 'r') as f:
config_dict['build']['buildnum'] = int(f.readlines()[0])
else:
config_dict['build']['buildnum'] = 0
# But logically we should start the build over at 0 if we don't have any existing ISO's.
if os.path.isdir(config_dict['build']['isodir']):
if os.listdir(config_dict['build']['isodir']) == []:
conf_dict['build']['buildnum'] = 0
# ...or if we don't have any previous builds for this ISO version.
elif not glob.glob('{0}/*v{1}r*.iso'.format(config_dict['build']['isodir'], config_dict['build']['ver'])):
config_dict['build']['buildnum'] = 0
config_dict['ipxe']['iso'] = config['ipxe'].getboolean('iso') config_dict['ipxe']['iso'] = config['ipxe'].getboolean('iso')
config_dict['ipxe']['usb'] = config['ipxe'].getboolean('usb') config_dict['ipxe']['usb'] = config['ipxe'].getboolean('usb')
# and build a list of arch(es) we want to build # and build a list of arch(es) we want to build

View File

@ -110,8 +110,7 @@ def buildIPXE(conf):
DEVNULL = open(os.devnull, 'w') DEVNULL = open(os.devnull, 'w')
if os.path.isfile(build['dlpath'] + '/ipxe.log'): if os.path.isfile(build['dlpath'] + '/ipxe.log'):
os.remove(build['dlpath'] + '/ipxe.log') os.remove(build['dlpath'] + '/ipxe.log')
print(('{0}: [IPXE] Building iPXE ({1})...\n\t\t\t PROGRESS: ' + print(('{0}: [IPXE] Building iPXE ({1})... PROGRESS: tail -f {2}/ipxe.log ...').format(
'tail -f {2}/ipxe.log').format(
datetime.datetime.now(), datetime.datetime.now(),
ipxe_src, ipxe_src,
build['dlpath'])) build['dlpath']))

View File

@ -191,15 +191,6 @@ def prepChroot(build, bdisk, user):
build['user'] = os.environ['USER'] build['user'] = os.environ['USER']
if 'SUDO_USER' in os.environ: if 'SUDO_USER' in os.environ:
build['realuser'] = os.environ['SUDO_USER'] build['realuser'] = os.environ['SUDO_USER']
# Get the build number...
# TODO: support tracking builds per version. i.e. in buildnum:
# v2.51-g7381cc3:0
# v2.51-gb3bb039:3
if os.path.isfile(dlpath + '/buildnum'):
with open(dlpath + '/buildnum', 'r') as f:
build['buildnum'] = int(f.readlines()[0])
else:
build['buildnum'] = 0
build['buildnum'] += 1 build['buildnum'] += 1
with open(dlpath + '/buildnum', 'w+') as f: with open(dlpath + '/buildnum', 'w+') as f:
f.write(str(build['buildnum']) + "\n") f.write(str(build['buildnum']) + "\n")