diff --git a/britney.conf b/britney.conf index b926081..e8516c2 100644 --- a/britney.conf +++ b/britney.conf @@ -7,9 +7,11 @@ UNSTABLE = ../data/unstable # Output EXCUSES_OUTPUT = update.EXCUSES_py +UPGRADE_OUTPUT = update.OUTPUT_py # List of release architectures -ARCHITECTURES = i386 sparc alpha powerpc arm m68k hppa ia64 mips mipsel s390 amd64 +# ARCHITECTURES = i386 sparc alpha powerpc arm m68k hppa ia64 mips mipsel s390 amd64 +ARCHITECTURES = i386 hppa # if you're not in this list, arch: all packages are allowed to break on you NOBREAKALL_ARCHES = i386 diff --git a/britney.py b/britney.py index ddd7666..7da2037 100644 --- a/britney.py +++ b/britney.py @@ -181,10 +181,12 @@ import sys import string import time import optparse +import operator import apt_pkg from excuse import Excuse +from upgrade import UpgradeRun __author__ = 'Fabio Tranchitella' __version__ = '2.0.alpha1' @@ -358,6 +360,7 @@ class Britney: 'source': pkg, 'source-ver': version, 'architecture': Packages.Section.get('Architecture'), + 'rdepends': [], } for k in ('Pre-Depends', 'Depends', 'Provides'): v = Packages.Section.get(k) @@ -393,18 +396,18 @@ class Britney: # loop again on the list of packages to register reverse dependencies # this is not needed for the moment, so it is disabled - #for pkg in packages: - # dependencies = [] - # if packages[pkg].has_key('depends'): - # dependencies.extend(apt_pkg.ParseDepends(packages[pkg]['depends'])) - # if packages[pkg].has_key('pre-depends'): - # dependencies.extend(apt_pkg.ParseDepends(packages[pkg]['pre-depends'])) - # # register the list of the dependencies for the depending packages - # for p in dependencies: - # for a in p: - # if a[0] not in packages: continue - # packages[a[0]]['rdepends'].append((pkg, a[1], a[2])) - # del dependencies + for pkg in packages: + dependencies = [] + if packages[pkg].has_key('depends'): + dependencies.extend(apt_pkg.ParseDepends(packages[pkg]['depends'])) + if packages[pkg].has_key('pre-depends'): + dependencies.extend(apt_pkg.ParseDepends(packages[pkg]['pre-depends'])) + # register the list of the dependencies for the depending packages + for p in dependencies: + for a in p: + if a[0] not in packages: continue + packages[a[0]]['rdepends'].append((pkg, a[1], a[2])) + del dependencies # return a tuple with the list of real and virtual packages return (packages, provides) @@ -672,7 +675,7 @@ class Britney: return 0 - def get_dependency_solvers(self, block, arch, distribution): + def get_dependency_solvers(self, block, arch, distribution, excluded=[]): """Find the packages which satisfy a dependency block This method returns the list of packages which satisfy a dependency @@ -689,7 +692,7 @@ class Britney: # for every package, version and operation in the block for name, version, op in block: # look for the package in unstable - if name in self.binaries[distribution][arch][0]: + if name in self.binaries[distribution][arch][0] and name not in excluded: package = self.binaries[distribution][arch][0][name] # check the versioned dependency (if present) if op == '' and version == '' or apt_pkg.CheckDep(package['version'], op, version): @@ -699,6 +702,7 @@ class Britney: if name in self.binaries[distribution][arch][1]: # loop on the list of packages which provides it for prov in self.binaries[distribution][arch][1][name]: + if prov in excluded: continue package = self.binaries[distribution][arch][0][prov] # check the versioned dependency (if present) # TODO: this is forbidden by the debian policy, which says that versioned @@ -710,7 +714,7 @@ class Britney: return (len(packages) > 0, packages) - def excuse_unsat_deps(self, pkg, src, arch, suite, excuse): + def excuse_unsat_deps(self, pkg, src, arch, suite, excuse=None, excluded=[]): """Find unsatisfied dependencies for a binary package This method analyzes the dependencies of the binary package specified @@ -736,8 +740,10 @@ class Britney: # for every block of dependency (which is formed as conjunction of disconjunction) for block, block_txt in map(None, apt_pkg.ParseDepends(binary_u[type_key]), binary_u[type_key].split(',')): # if the block is satisfied in testing, then skip the block - solved, packages = self.get_dependency_solvers(block, arch, 'testing') + solved, packages = self.get_dependency_solvers(block, arch, 'testing', excluded) if solved: continue + elif excuse == None: + return False # check if the block can be satisfied in unstable, and list the solving packages solved, packages = self.get_dependency_solvers(block, arch, suite) @@ -758,6 +764,8 @@ class Britney: else: excuse.add_break_dep(p, arch) + return True + # Package analisys methods # ------------------------ @@ -1226,9 +1234,11 @@ class Britney: e.addhtml("Unpossible dep: %s -> %s" % (e.name, d)) self.invalidate_excuses(upgrade_me, unconsidered) - self.__log("Writing Excuses to %s" % self.options.excuses_output, type="I") + self.upgrade_me = sorted(upgrade_me) # write excuses to the output file + self.__log("Writing Excuses to %s" % self.options.excuses_output, type="I") + f = open(self.options.excuses_output, 'w') f.write("\n") f.write("