コード例 #1
0
ファイル: fsrepos.py プロジェクト: tensor5/conary
    def _handleJob(self, job, recursed, idx):
        t = self.trvIterator.next()

        if t is not None:
            if self.withFiles:
                t, streams = t
            else:
                streams = {}

        if t is None:
            if recursed:
                # synthesize a removed trove for this missing
                # trove
                t = trove.Trove(job[0], job[idx][0], job[idx][1],
                                type=trove.TROVE_TYPE_REMOVED)
                t.setIsMissing(True)
                t.computeDigests()

                # synthesize empty filestreams
                streams = {}
            else:
                # drain the iterator, in order to complete
                # the sql queries
                for x in self.trvIterator: pass
                raise errors.TroveMissing(job[0], job[idx][0])

        return t, streams
コード例 #2
0
ファイル: repocache.py プロジェクト: pombreda/rmake-2
 def getTrove(self, name, version, flavor, withFiles=True, callback=None):
     trv = self.getTroves([(name, version, flavor)],
                          withFiles=withFiles,
                          callback=callback)[0]
     if trv is None:
         raise errors.TroveMissing(name, version)
     return trv
コード例 #3
0
ファイル: accessmap.py プロジェクト: pombreda/conary-1
 def _findInstanceIds(self, troveList, checkMissing=True):
     cu = self.db.cursor()
     schema.resetTable(cu, "tmpNVF")
     schema.resetTable(cu, "tmpInstanceId")
     for (n, v, f) in troveList:
         cu.execute(
             "insert into tmpNVF (name, version, flavor) "
             "values (?,?,?)", (n, v, f),
             start_transaction=False)
     self.db.analyze("tmpNVF")
     cu.execute("""
     insert into tmpInstanceId (idx, instanceId)
     select tmpNVF.idx, Instances.instanceId
     from tmpNVF
     join Items on tmpNVF.name = Items.item
     join Versions on tmpNVF.version = Versions.version
     join Flavors on tmpNVF.flavor = Flavors.flavor
     join Instances on
         Instances.itemId = Items.itemId and
         Instances.versionId = Versions.versionId and
         Instances.flavorId = Flavors.flavorId
     where
         Instances.isPresent in (%d,%d)
     """ % (instances.INSTANCE_PRESENT_NORMAL,
            instances.INSTANCE_PRESENT_HIDDEN),
                start_transaction=False)
     self.db.analyze("tmpInstances")
     # check if any troves specified are missing
     cu.execute("""
     select tmpNVF.idx, name, version, flavor
     from tmpNVF
     left join tmpInstanceId using(idx)
     where tmpInstanceId.instanceId is NULL
     """)
     if checkMissing:
         # granting permissions to a !present trove has a fuzzy meaning
         for i, n, v, f in cu.fetchall():
             raise errors.TroveMissing(n, v)
     return True