def _findMergeTarget(self, mergePackage, packages): ## # if another package id has the same bits turned on, it is available # in the same parts. def areInSameParts(mergePackage, package): return (mergePackage.id & package.id) == mergePackage.id ## # check if any of the deps of mergePackage depend on targetPackage - # if merging mergePackage into targetPackage, this would be creating # circular dependencies def noCircularDeps(mergePackage, targetPackage): for package in mergePackage.packageDeps: if targetPackage in package.packageDeps: return False return True ## # check that the targetPackage is loaded in those parts # where mergePackage's deps are loaded def depsAvailWhereTarget(mergePackage, targetPackage): for depsPackage in mergePackage.packageDeps: if not areInSameParts(targetPackage, depsPackage): return False return True # ---------------------------------------------------------------------- allPackages = reversed(Package.sort(packages)) # sorting and reversing assures we try "smaller" package id's first addtl_merge_constraints = self._jobconf.get( "packages/additional-merge-constraints", True) for targetPackage in allPackages: if mergePackage.id == targetPackage.id: # no self-merging ;) continue if not areInSameParts(mergePackage, targetPackage): self._console.debug("Problematic #%d (different parts using)" % targetPackage.id) continue if not noCircularDeps(mergePackage, targetPackage): self._console.debug("Problematic #%d (circular dependencies)" % targetPackage.id) if addtl_merge_constraints: continue # why accept this by default? if not depsAvailWhereTarget(mergePackage, targetPackage): self._console.debug( "Problematic #%d (dependencies not always available)" % targetPackage.id) if addtl_merge_constraints: continue # why accept this by default? yield targetPackage yield None
def _findMergeTarget(self, mergePackage, packages): ## # if another package id has the same bits turned on, it is available # in the same parts. def areInSameParts(mergePackage, package): return (mergePackage.id & package.id) == mergePackage.id ## # check if any of the deps of mergePackage depend on targetPackage - # if merging mergePackage into targetPackage, this would be creating # circular dependencies def noCircularDeps(mergePackage, targetPackage): for package in mergePackage.packageDeps: if targetPackage in package.packageDeps: return False return True ## # check that the targetPackage is loaded in those parts # where mergePackage's deps are loaded def depsAvailWhereTarget (mergePackage, targetPackage): for depsPackage in mergePackage.packageDeps: if not areInSameParts(targetPackage, depsPackage): return False return True # ---------------------------------------------------------------------- allPackages = reversed(Package.sort(packages)) # sorting and reversing assures we try "smaller" package id's first addtl_merge_constraints = self._jobconf.get("packages/additional-merge-constraints", False) for targetPackage in allPackages: if mergePackage.id == targetPackage.id: # no self-merging ;) continue if not areInSameParts(mergePackage, targetPackage): self._console.debug("Problematic #%d (different parts using)" % targetPackage.id) continue if not noCircularDeps(mergePackage, targetPackage): self._console.debug("Problematic #%d (circular dependencies)" % targetPackage.id) if addtl_merge_constraints: continue # why accept this by default? if not depsAvailWhereTarget(mergePackage, targetPackage): self._console.debug("Problematic #%d (dependencies not always available)" % targetPackage.id) if addtl_merge_constraints: continue # why accept this by default? yield targetPackage yield None
def packagesSorted(self): return Package.sort(self.packages)