diff --git a/stoneridge.py b/stoneridge.py index b60adb6..a0ee6f6 100644 --- a/stoneridge.py +++ b/stoneridge.py @@ -27,6 +27,7 @@ os_version = None download_platform = None download_suffix = None current_netconfig = None +buildid_suffix = None # Paths that multiple programs need to know about 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 pass +_netconfig_ids = { + 'broadband':'0', + 'umts':'1', + 'gsm':'2', +} + +_os_ids = { + 'windows':'w', + 'linux':'l', + 'mac':'m', +} + class ArgumentParser(argparse.ArgumentParser): """An argument parser for stone ridge programs that handles the arguments required by all of them @@ -290,6 +303,7 @@ class ArgumentParser(argparse.ArgumentParser): def parse_args(self, **kwargs): global _conffile global current_netconfig + global buildid_suffix 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_) + buildid_suffix = _os_ids[os_name] + _netconfig_ids[current_netconfig] + return args diff --git a/stoneridge_info_gatherer.py b/stoneridge_info_gatherer.py index bee5875..ad1595f 100644 --- a/stoneridge_info_gatherer.py +++ b/stoneridge_info_gatherer.py @@ -27,14 +27,16 @@ class StoneRidgeInfoGatherer(object): build_info['branch'] = stoneridge.current_netconfig # 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. 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. - buildid_base = build_info['original_buildid'][2:-2] - # Build ID is limited to 16 characters in the receiving database. - build_info['id'] = (buildid_base + stoneridge.current_netconfig)[:16] + + # Build ID is limited to 16 characters in the receiving database, and + # our suffix is 2 characters, so we truncate the original to 14 + # characters before adding our suffix. It should already be only 14 + # 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['name'] = platform.node() diff --git a/tools/fix_buildids.py b/tools/fix_buildids.py index d5639d9..3bb6371 100644 --- a/tools/fix_buildids.py +++ b/tools/fix_buildids.py @@ -31,8 +31,11 @@ for fname in sys.argv[1:]: # See stoneridge_info_gatherer.py for why the buildid is the way it is. 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'] - 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']['id'] = new_buildid