def _checkBuildSanity(self, buildTroves): def _isSolitaryTrove(trv): return (trv.isRedirectRecipe() or trv.isFilesetRecipe()) delayed = [ x for x in buildTroves if _isSolitaryTrove(x) ] if delayed and len(buildTroves) > 1: err = ('redirect and fileset packages must' ' be alone in their own job') for trove in delayed: # publish failed status trove.troveFailed(failure.FailureReason('Trove failed sanity check: %s' % err)) troveNames = ', '.join(x.getName().split(':')[0] for x in delayed) self.job.jobFailed(failure.FailureReason("Job failed sanity check: %s: %s" % (err, troveNames))) return False groupSourceCount = len(set(x.getName() for x in buildTroves if x.isGroupRecipe())) packageSourceCount = len(set(x.getName() for x in buildTroves if not x.isGroupRecipe())) if (groupSourceCount and packageSourceCount) or groupSourceCount > 1: self.job.jobFailed(failure.FailureReason("Combining group troves " "with other troves is deprecated.")) return False return True
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 addSourceTrovesToGraph(self, sourceTroves): sourceTroves = [ x for x in sourceTroves if not x.isFailed() ] [ self.depGraph.addNode(trove) for trove in sourceTroves ] for trove in sourceTroves: if trove.isPrepOnly(): continue for package in trove.getDerivedPackages(): self.trovesByPackage.setdefault(package, []).append(trove) for trove in sourceTroves: try: if trove.isPrimaryTrove(): self.hasPrimaryTroves = True trove.addBuildRequirements(trove.cfg.defaultBuildReqs) if trove.isPrepOnly(): continue for buildReq in trove.getBuildRequirementSpecs(): self._addReq(trove, buildReq, False) for crossReq in trove.getCrossRequirementSpecs(): self._addReq(trove, crossReq, True) except Exception, err: errMsg = 'Error adding buildreqs to %s: %s: %s' % (trove.getName(), err.__class__.__name__, err) failureReason = failure.LoadFailed(errMsg, traceback.format_exc()) trove.troveFailed(failureReason) # We can't continue the build now raise errors.RmakeError, errMsg, sys.exc_info()[2] # if're loading something that we're also building # then we should make sure that we build the thing with the # loadInstalled line secondly for loadSpec, sourceTup in trove.iterAllLoadedSpecs(): name, label, flavor = loadSpec providingTroves = self.trovesByPackage.get(name, []) for provTrove in providingTroves: if provTrove.getVersion() != sourceTup[1]: continue elif self._flavorsMatch(trove.getFlavor(), provTrove.getFlavor(), flavor, False): # FIXME: we really shouldn't allow loadInstalled # loops to occur. It means that we're building # two recipes that loadInstall each other which # means that we can't even trust the buildReqs # specified for each. self.dependsOn(trove, provTrove, (False, loadSpec)) else: self.rejectDep(trove, provTrove, False) # If we have multiple groups that are building w/ the same # name and version, we send them to be built together. if trove.isGroupRecipe(): name, version = trove.getName(), trove.getVersion() if (name, version) not in self.groupsByNameVersion: self.groupsByNameVersion[name, version] = [] self.groupsByNameVersion[name, version].append(trove) # Troves like groups, redirects, etc, have requirements # that control when they can be built. for sourceTup in trove.getDelayedRequirements(): name, version, flavor = sourceTup package = name.split(':')[0] providingTroves = self.trovesByPackage.get(package, []) for provTrove in providingTroves: if provTrove.getVersion() != sourceTup[1]: continue if (flavor is None or provTrove.getFlavor().toStrongFlavor().satisfies( flavor.toStrongFlavor())): self.dependsOn(trove, provTrove, (False, (name, version, flavor)))