def _addAllNewFiles(self, cs, troveAndPathList, previousVersionMap): repos = self.getRepos() existingTroves = repos.getTroves(previousVersionMap.values(), withFiles=True) troveDict = dict(zip(previousVersionMap.values(), existingTroves)) for trove, pathDict in troveAndPathList: existingTroveTup = previousVersionMap.get( trove.getNameVersionFlavor(), None) if existingTroveTup: existingTrove = troveDict[existingTroveTup] else: existingTrove = None self._addNewFiles(cs, trove, pathDict, existingTrove)
def _matchTrovesToJobContext(self, buildTroves, jobContext): trovesByNVF = {} for trove in buildTroves: trovesByNVF[trove.getNameVersionFlavor()] = trove for jobId in reversed(jobContext): # go through last job first. needed = {} configsNeeded = set() if not trovesByNVF: continue builtState = buildtrove.TROVE_STATE_BUILT trovesByState = self.db.listTrovesByState(jobId, builtState) for n,v,f,c in trovesByState.get(builtState, []): toBuild = trovesByNVF.pop((n,v,f), False) if toBuild: needed[jobId, n,v,f,c] = toBuild configsNeeded.add(c) if not needed: continue troveList = self.db.getTroves(needed) configDict = dict((x, self.db.getConfig(jobId, x)) for x in configsNeeded) for oldBuildTrove, toBuild in zip(troveList, needed.values()): oldTrove = None binaries = oldBuildTrove.getBinaryTroves() for troveTup in binaries: if ':' not in troveTup[0]: oldTrove = self.repos.getTrove( withFiles=False, *troveTup) break if not oldTrove: continue oldCfg = configDict[oldBuildTrove.getContext()] self._matchPrebuiltTrove(oldTrove, toBuild, binaries, oldBuildTrove, oldCfg)
def troveDuplicate(self, trove, troveList): package = trove.getName().split(':')[0] possibleMatches = self.depState.getTrovesByPackage(package) for match in possibleMatches: if match is trove: continue elif match.getBinaryTroves() == set(troveList): self.depState.troveDuplicate(trove, match) return elif set(match.getBinaryTroves()) & set(troveList): trove.troveFailed( 'Two versions of %s=%s[%s] were built at the same time but resulted in different components. If these packages should have different flavors, then add flavor information to them. Otherwise, try building only one of them.' % trove.getNameVersionFlavor()) return elif not match.getBinaryTroves() and match.isBuilding(): # it's possible that the two results just came back in the # wrong order self._possibleDuplicates.setdefault(match, []).append( (trove, troveList)) return trove.troveFailed( 'Package was committed at the same time as the same package was built in another job. Make sure no-one else is building the same packages as you, and that you didn\'t accidentally build the same package twice with the same flavor.' )
def troveDuplicate(self, trove, troveList): package = trove.getName().split(':')[0] possibleMatches = self.depState.getTrovesByPackage(package) for match in possibleMatches: if match is trove: continue elif match.getBinaryTroves() == set(troveList): self.depState.troveDuplicate(trove, match) return elif set(match.getBinaryTroves()) & set(troveList): trove.troveFailed('Two versions of %s=%s[%s] were built at the same time but resulted in different components. If these packages should have different flavors, then add flavor information to them. Otherwise, try building only one of them.' % trove.getNameVersionFlavor()) return elif not match.getBinaryTroves() and match.isBuilding(): # it's possible that the two results just came back in the # wrong order self._possibleDuplicates.setdefault(match, []).append((trove, troveList)) return trove.troveFailed('Package was committed at the same time as the same package was built in another job. Make sure no-one else is building the same packages as you, and that you didn\'t accidentally build the same package twice with the same flavor.')