def _loadRestartInfo(restartDir, updJob):
    lazyFileCache = updJob.lzCache
    changeSetList = []
    # Skip files that are not changesets (.ccs).
    # This was the first attempt to fix CNY-1034, but it would break
    # old clients.
    # Nevertheless the code now ignores everything but .ccs files

    # Value of dictionary is includesFileContents
    fileDict = dict((os.path.join(restartDir, x), False)
        for x in os.listdir(restartDir) if x.endswith('.ccs'))
    # Add the changesets from the index file
    csIndexPath = os.path.join(restartDir, 'changesets')
    if os.path.exists(csIndexPath):
        for line in open(csIndexPath):
            cspath, includesFileContents = line.strip().split()[:2]
            includesFileContents = bool(int(includesFileContents))
            fileDict[cspath] = includesFileContents

    for path, includesFileContents in fileDict.iteritems():
        # path should already be absolute, so the next line is most likely not
        # changing path
        csFileName = os.path.join(restartDir, path)
        cs = changeset.ChangeSetFromFile(lazyFileCache.open(csFileName))
        changeSetList.append((cs, includesFileContents))
    jobSetPath = os.path.join(restartDir, 'joblist')
    jobSet = _unserializeJobList(open(jobSetPath))
    finalJobSet = []
    for job in jobSet:
        if job[1][0]:
            oldVersion = versions.VersionFromString(job[1][0])
        else:
            oldVersion = None
        if job[2][0]:
            newVersion = versions.VersionFromString(job[2][0])
        else:
            newVersion = None
        finalJobSet.append((job[0], (oldVersion, job[1][1]),
                            (newVersion, job[2][1]), job[3]))
    # If there was something to be done with the version information, it would
    # be performed by now. Clean up the misc directory
    util.rmtree(restartDir + "misc", ignore_errors=True)

    # Load the invocation information, if available
    invInfoFile = util.joinPaths(restartDir, 'job-invocation')
    if os.path.exists(invInfoFile):
        try:
            updJob.loadInvocationInfo(invInfoFile)
        except DecodingError:
            pass
    # If there is a __version__ file, load the previous conary version
    verFile = util.joinPaths(restartDir, '__version__')
    if os.path.exists(verFile):
        ver = []
        try:
            ver = [ x for x in file(verFile) if x.startswith('version ') ]
        except __HOLE__:
            pass
        else:
            if ver:
                ver = ver[0]
                # We already know there is a space in the version string, so
                # it's safe to assume split returned a 2-item list
                updJob.setPreviousVersion(ver.strip().split(' ', 1)[1])
    # Load features
    featuresFilePath = os.path.join(restartDir, "features")
    updJob.loadFeatures(featuresFilePath)

    # Load information about pre scripts already run
    path = os.path.join(restartDir, "jobPreScriptsAlreadyRun")
    try:
        iterable = file(path)
    except IOError:
        iterable = []
    updJob.setJobPreScriptsAlreadyRun(_unserializePreScripts(iterable))

    troveMapDir = os.path.join(restartDir, "trove-changesets")
    updJob.loadTroveMap(troveMapDir)

    return finalJobSet, changeSetList
dataset/ETHPy150Open sassoftware/conary/conary/conaryclient/update.py/_loadRestartInfo