This commit is contained in:
Nick Hurley 2012-09-25 11:27:22 -07:00
Родитель 8b6e610147
Коммит 78f6dafdbc
3 изменённых файлов: 28 добавлений и 7 удалений

Просмотреть файл

@ -27,6 +27,7 @@ os_version = None
download_platform = None download_platform = None
download_suffix = None download_suffix = None
current_netconfig = None current_netconfig = None
buildid_suffix = None
# Paths that multiple programs need to know about # Paths that multiple programs need to know about
installroot = None installroot = None
@ -269,6 +270,18 @@ def setup_dirnames(srroot, srwork, srxpcout):
# don't worry if we can't get it earlier in the process # don't worry if we can't get it earlier in the process
pass pass
_netconfig_ids = {
'broadband':'0',
'umts':'1',
'gsm':'2',
}
_os_ids = {
'windows':'w',
'linux':'l',
'mac':'m',
}
class ArgumentParser(argparse.ArgumentParser): class ArgumentParser(argparse.ArgumentParser):
"""An argument parser for stone ridge programs that handles the arguments """An argument parser for stone ridge programs that handles the arguments
required by all of them required by all of them
@ -290,6 +303,7 @@ class ArgumentParser(argparse.ArgumentParser):
def parse_args(self, **kwargs): def parse_args(self, **kwargs):
global _conffile global _conffile
global current_netconfig global current_netconfig
global buildid_suffix
args = argparse.ArgumentParser.parse_args(self, **kwargs) args = argparse.ArgumentParser.parse_args(self, **kwargs)
@ -298,4 +312,6 @@ class ArgumentParser(argparse.ArgumentParser):
setup_dirnames(args._sr_root_, args._sr_work_, args._sr_xpcout_) setup_dirnames(args._sr_root_, args._sr_work_, args._sr_xpcout_)
buildid_suffix = _os_ids[os_name] + _netconfig_ids[current_netconfig]
return args return args

Просмотреть файл

@ -27,14 +27,16 @@ class StoneRidgeInfoGatherer(object):
build_info['branch'] = stoneridge.current_netconfig build_info['branch'] = stoneridge.current_netconfig
# Due to the way the graph server works, we need to create a unique # Due to the way the graph server works, we need to create a unique
# build id for each build/netconfig combination. We also want to keep # build id for each build/os/netconfig combination. We also want to keep
# the unmodified build ID around for posterity. # the unmodified build ID around for posterity.
build_info['original_buildid'] = cp.get('App', 'BuildID') build_info['original_buildid'] = cp.get('App', 'BuildID')
# Cut off the century and the seconds from the date in the build id, as
# they are relatively useless bits of information. # Build ID is limited to 16 characters in the receiving database, and
buildid_base = build_info['original_buildid'][2:-2] # our suffix is 2 characters, so we truncate the original to 14
# Build ID is limited to 16 characters in the receiving database. # characters before adding our suffix. It should already be only 14
build_info['id'] = (buildid_base + stoneridge.current_netconfig)[:16] # characters, but we do this Just In Case.
buildid_base = build_info['original_buildid'][:14]
build_info['id'] = buildid_base + stoneridge.buildid_suffix
machine_info = {} machine_info = {}
machine_info['name'] = platform.node() machine_info['name'] = platform.node()

Просмотреть файл

@ -31,8 +31,11 @@ for fname in sys.argv[1:]:
# See stoneridge_info_gatherer.py for why the buildid is the way it is. # See stoneridge_info_gatherer.py for why the buildid is the way it is.
netconfig = info['test_build']['branch'] netconfig = info['test_build']['branch']
os_name = info['test_machine']['os']
buildid_suffix = (stoneridge._os_ids[os_name] +
stoneridge._netconfig_ids[netconfig])
original_buildid = info['test_build']['id'] original_buildid = info['test_build']['id']
new_buildid = (original_buildid[2:-2] + netconfig)[:16] new_buildid = original_buildid[:14] + buildid_suffix
info['test_build']['original_buildid'] = original_buildid info['test_build']['original_buildid'] = original_buildid
info['test_build']['id'] = new_buildid info['test_build']['id'] = new_buildid