def fetch_dev(): basedir = os.path.dirname(config.sysStore.ExecDir) ReportStatus("updt dev", hold=1) logsupport.Logs.Log("New version fetch(currentdev)") # noinspection PyBroadException try: U.StageVersion(basedir + '/consoledev', '*live*', 'Maint Dnld') U.InstallStagedVersion(basedir + '/consoledev') logsupport.Logs.Log("Staged version installed in consoledev") except: logsupport.Logs.Log('Failed beta download', severity=ConsoleWarning) ReportStatus("done dev", hold=2)
def fetch_stable(): basedir = os.path.dirname(config.sysStore.ExecDir) ReportStatus("updt stable", hold=1) # noinspection PyBroadException try: if os.path.exists(basedir + '/homesystem'): # personal system logsupport.Logs.Log("New version fetch(homerelease)") logsupport.DevPrint("New Version Fetch Requested (homesystem)") U.StageVersion(basedir + '/consolestable', 'homerelease', 'Maint Dnld') else: logsupport.Logs.Log("New version fetch(currentrelease)") logsupport.DevPrint("New Version Fetch Requested (currentrelease)") U.StageVersion(basedir + '/consolestable', 'currentrelease', 'Maint Dnld') U.InstallStagedVersion(basedir + '/consolestable') logsupport.Logs.Log("Staged version installed in consolestable") except: logsupport.Logs.Log('Failed release download', severity=ConsoleWarning) ReportStatus("done stable", hold=2)
def DoFetchRestart(): global fetcher try: historybuffer.HBNet.Entry('Autoversion get sha') sha, c = githubutil.GetSHA(config.sysStore.versionname) historybuffer.HBNet.Entry('Autoversion get sha done') # logsupport.Logs.Log('sha: ',sha, ' cvshha: ',config.versionsha,severity=ConsoleDetail) if sha != config.sysStore.versionsha and sha != 'no current sha': logsupport.Logs.Log('Current hub version different') logsupport.Logs.Log('Running (' + config.sysStore.versionname + '): ' + config.sysStore.versionsha + ' of ' + config.sysStore.versioncommit) logsupport.Logs.Log('Getting: ' + sha + ' of ' + c) elif sha == 'no current sha': logsupport.Logs.Log('No sha for autoversion: ', config.sysStore.versionname, severity=ConsoleWarning) fetcher = None # allow next autoversion to proceed return else: fetcher = None # allow next autoversion to proceed return except: historybuffer.HBNet.Entry('GitHub access failure: {}:{}'.format( str(sys.exc_info()[0]), str(sys.exc_info()[1]))) logsupport.Logs.Log('Github check not available', severity=ConsoleWarning) fetcher = None # allow next autoversion to proceed return try: logsupport.Logs.Log('Update fetch started') ReportStatus("auto updt firmware", hold=1) githubutil.StageVersion(config.sysStore.ExecDir, config.sysStore.versionname, 'Auto Dnld') logsupport.Logs.Log('Update fetch thread staged') ReportStatus("auto install firmware", hold=1) githubutil.InstallStagedVersion(config.sysStore.ExecDir) logsupport.Logs.Log("Staged version installed in ", config.sysStore.ExecDir) logsupport.Logs.Log('Restart for new version') ReportStatus('auto restart', hold=2) controlevents.PostEvent( controlevents.ConsoleEvent(controlevents.CEvent.RunProc, proc=ForceRestart, name='ForceRestart')) fetcher = None except: historybuffer.HBNet.Entry('Version access failure: {}:{}'.format( str(sys.exc_info()[0]), str(sys.exc_info()[1]))) logsupport.Logs.Log('Version access failed', severity=ConsoleWarning) fetcher = None # allow next autoversion to proceed
with open('versioninfo') as f: versionname = f.readline()[:-1].rstrip() versionsha = f.readline()[:-1].rstrip() versiondnld = f.readline()[:-1].rstrip() versioncommit = f.readline()[:-1].rstrip() except (IOError, ValueError): print("Couldn't get version info, assuming currentrelease") versionname = "currentrelease" versionsha = 'none' versiondnld = 'none' versioncommit = 'none' try: # if network is down or other error occurs just skip for now rather than blow up sha, c = githubutil.GetSHA(versionname) # logsupport.Logs.Log('sha: ',sha, ' cvshha: ',config.versionsha,severity=ConsoleDetail) if sha != versionsha and sha != 'no current sha': print('Current hub version different') print('Running (' + versionname + '): ' + versionsha + ' of ' + versioncommit) print('Getting: ' + sha + ' of ' + c) githubutil.StageVersion(exdir, versionname, 'Offline Dnld') githubutil.InstallStagedVersion(exdir) print("Staged version installed in " + exdir) elif sha == 'no current sha': print('No sha for autoversion: ' + versionname) else: print("sha already matches") pass except Exception as e: print("Got exception: " + repr(e))