示例#1
0
文件: fsrepos.py 项目: tensor5/conary
    def __init__(self, serverNameList, troveStore, contentsDir, repositoryMap,
                 requireSigs = False, paranoidCommits = False):
        self.serverNameList = serverNameList
        self.paranoidCommits = paranoidCommits
        map = dict(repositoryMap)
        for serverName in serverNameList:
            map[serverName] = self
        self.troveStore = troveStore
        self.requireSigs = requireSigs

        storeType, paths = contentsDir
        if storeType == CfgContentStore.LEGACY:
            storeClass = DataStore
        elif storeType == CfgContentStore.SHALLOW:
            storeClass = ShallowDataStore
        elif storeType == CfgContentStore.FLAT:
            storeClass = FlatDataStore
        else:
            raise ValueError("Invalid contentsDir type %r" % (storeType,))

        stores = []
        for path in paths:
            util.mkdirChain(path)
            stores.append(storeClass(path))
        if len(stores) == 1:
            store = stores[0]
        else:
            store = DataStoreSet(*stores)

        DataStoreRepository.__init__(self, dataStore = store)
        AbstractRepository.__init__(self)
示例#2
0
    def __init__(self, serverNameList, troveStore, contentsDir, repositoryMap,
                 requireSigs = False, paranoidCommits = False):
        self.serverNameList = serverNameList
        self.paranoidCommits = paranoidCommits
        map = dict(repositoryMap)
        for serverName in serverNameList:
            map[serverName] = self
        # XXX this client needs to die
        from conary import conarycfg
        self.reposSet = netclient.NetworkRepositoryClient(map,
                                    conarycfg.UserInformation())
        self.troveStore = troveStore

        self.requireSigs = requireSigs
        for dir in contentsDir:
            util.mkdirChain(dir)

        if len(contentsDir) == 1:
            store = DataStore(contentsDir[0])
        else:
            storeList = []
            for dir in contentsDir:
                storeList.append(DataStore(dir))

            store = DataStoreSet(*storeList)

        DataStoreRepository.__init__(self, dataStore = store)
        AbstractRepository.__init__(self)