def populateLcache(self):
        class lcachePopulationState:
            """Used to track the state of the lcache to enable it to be
            efficiently populated on-demand"""
            classes=None
            sourcePaths={}
            completedActions = set()
            pathMap = {}

        if not self.laReposCache.repos:
            return

        if not self._lcstate:
            repos = self.laReposCache.repos
            self._lcstate = lcachePopulationState()

            # build a list containing this recipe class and any ancestor class
            # from which it descends
            recipeClass = self.__class__
            classes = [ recipeClass ]
            bases = list(recipeClass.__bases__)
            while bases:
                parent = bases.pop()
                bases.extend(list(parent.__bases__))
                if issubclass(parent, Recipe):
                    classes.append(parent)
            # reverse the class list, this way the files will be found in the
            # youngest descendant first
            classes.reverse()
            self._lcstate.classes = classes

            for rclass in self._lcstate.classes:
                if not rclass._trove:
                    continue
                srcName = rclass._trove.getName()
                srcVersion = rclass._trove.getVersion()
                # CNY-31: walk over the files in the trove we found upstream
                # (which we may have modified to remove the non-autosourced
                # files.
                # Also, if an autosource file is marked as needing to be
                # refreshed in the Conary state file, the lookaside cache has
                # to win, so don't populate it with the repository file)
                fileList = []
                for pathId, path, fileId, version in \
                        rclass._trove.iterFileList():

                    assert(path[0] != "/")
                    # we might need to retrieve this source file
                    # to enable a build, so we need to find the
                    # sha1 hash of it since that's how it's indexed
                    # in the file store
                    if isinstance(version, versions.NewVersion):
                        # don't try and look up things on the NewVersion label!
                        continue
                    fileList.append((pathId, path, fileId, version))

                fileObjs = repos.getFileVersions([ (x[0],x[2],x[3])
                                              for x in fileList])
                for i in range(len(fileList)):
                    fileObj = fileObjs[i]
                    if isinstance(fileObj, files_mod.RegularFile):
                        (pathId, path, fileId, version) = fileList[i]
                        self._lcstate.pathMap[path] = (srcName, srcVersion,
                            pathId, path, fileId, version, fileObj)

        # populate the repository source lookaside cache from the :source
        # components
        sourcePaths = self._lcstate.sourcePaths
        actions = set(self.getSourcePathList())-self._lcstate.completedActions
        for a in actions:
            self._lcstate.completedActions.add(a)
            ps = a.getPathAndSuffix()

            # check if we have an autosourced file
            if any(x in ps[0] for x in ['://', ':pserver:', ':ext:']):
                # use guess name if it is provided
                k = os.path.basename(ps[0]) or ps[1]
                assert(k)
                sourcePaths[ k ] = ps
            else:
                sourcePaths[ ps[0] ] = ps
                if a.ephemeral:
                    raise RecipeFileError("File '%s' is marked as ephemeral "
                            "but is not autosourced" % (ps[0],))

        pathMap = self._lcstate.pathMap
        delList = []
        for path in pathMap:
            fullPath = None
            if path in sourcePaths:
                fullPath = lookaside.laUrl(sourcePaths[path][0]).filePath()
            elif path.find("/") == -1:  # we might have a guessed name
                for k in sourcePaths:
                    if k and path.startswith(k) and sourcePaths[k][2]:
                        for sk in sourcePaths[k][2]:
                            if path.endswith(sk) and \
                                    len(k) + len(sk) == len(path)-1:
                                fullUrl = sourcePaths[k][0]+k+'.'+sk
                                fullPath = \
                                    lookaside.laUrl(fullUrl).filePath()

            (srcName, srcVersion, pathId, path, fileId, version, fileObj) = \
                pathMap[path]
            if not fullPath:
                if fileObj.flags.isAutoSource():
                    continue
                else:
                    fullPath = path
            self.laReposCache.addFileHash(fullPath, srcName,
                srcVersion, pathId, path, fileId, version,
                fileObj.contents.sha1(), fileObj.inode.perms())
            delList.append(path)

        for path in delList:
            if path in sourcePaths:
                del sourcePaths[path]
            del pathMap[path]
Segment permissions.
dataset/ETHPy150Open sassoftware/conary/conary/build/recipe.py/Recipe.populateLcache--crossover with--dataset/ETHPy150Open tmr232/Sark/sark/code/segment.py/Segment.permissions