mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-17 21:41:30 +00:00
Minor performance improvements.
This commit is contained in:
parent
1df9db222d
commit
b21863f9fd
44
britney.py
44
britney.py
@ -351,6 +351,8 @@ class Britney:
|
|||||||
|
|
||||||
packages = {}
|
packages = {}
|
||||||
provides = {}
|
provides = {}
|
||||||
|
rdepends = {}
|
||||||
|
rconflicts = {}
|
||||||
sources = self.sources
|
sources = self.sources
|
||||||
package = None
|
package = None
|
||||||
filename = os.path.join(basedir, "Packages_%s" % arch)
|
filename = os.path.join(basedir, "Packages_%s" % arch)
|
||||||
@ -390,10 +392,9 @@ class Britney:
|
|||||||
if 'provides' in dpkg:
|
if 'provides' in dpkg:
|
||||||
parts = map(string.strip, dpkg['provides'].split(","))
|
parts = map(string.strip, dpkg['provides'].split(","))
|
||||||
for p in parts:
|
for p in parts:
|
||||||
try:
|
if p not in provides:
|
||||||
provides[p].append(pkg)
|
provides[p] = []
|
||||||
except KeyError:
|
provides[p].append(pkg)
|
||||||
provides[p] = [pkg]
|
|
||||||
del dpkg['provides']
|
del dpkg['provides']
|
||||||
|
|
||||||
# append the resulting dictionary to the package list
|
# append the resulting dictionary to the package list
|
||||||
@ -1235,49 +1236,56 @@ class Britney:
|
|||||||
|
|
||||||
self.__log("Update Excuses generation started", type="I")
|
self.__log("Update Excuses generation started", type="I")
|
||||||
|
|
||||||
|
# list of local methods and variables (for better performance)
|
||||||
|
sources = self.sources
|
||||||
|
architectures = self.options.architectures
|
||||||
|
should_remove_source = self.should_remove_source
|
||||||
|
should_upgrade_srcarch = self.should_upgrade_srcarch
|
||||||
|
should_upgrade_src = self.should_upgrade_src
|
||||||
|
|
||||||
# this list will contain the packages which are valid candidates;
|
# this list will contain the packages which are valid candidates;
|
||||||
# if a package is going to be removed, it will have a "-" prefix
|
# if a package is going to be removed, it will have a "-" prefix
|
||||||
upgrade_me = []
|
upgrade_me = []
|
||||||
|
|
||||||
# for every source package in testing, check if it should be removed
|
# for every source package in testing, check if it should be removed
|
||||||
for pkg in self.sources['testing']:
|
for pkg in sources['testing']:
|
||||||
if self.should_remove_source(pkg):
|
if should_remove_source(pkg):
|
||||||
upgrade_me.append("-" + pkg)
|
upgrade_me.append("-" + pkg)
|
||||||
|
|
||||||
# for every source package in unstable check if it should be upgraded
|
# for every source package in unstable check if it should be upgraded
|
||||||
for pkg in self.sources['unstable']:
|
for pkg in sources['unstable']:
|
||||||
# if the source package is already present in testing,
|
# if the source package is already present in testing,
|
||||||
# check if it should be upgraded for every binary package
|
# check if it should be upgraded for every binary package
|
||||||
if pkg in self.sources['testing']:
|
if pkg in sources['testing']:
|
||||||
for arch in self.options.architectures:
|
for arch in architectures:
|
||||||
if self.should_upgrade_srcarch(pkg, arch, 'unstable'):
|
if should_upgrade_srcarch(pkg, arch, 'unstable'):
|
||||||
upgrade_me.append("%s/%s" % (pkg, arch))
|
upgrade_me.append("%s/%s" % (pkg, arch))
|
||||||
|
|
||||||
# check if the source package should be upgraded
|
# check if the source package should be upgraded
|
||||||
if self.should_upgrade_src(pkg, 'unstable'):
|
if should_upgrade_src(pkg, 'unstable'):
|
||||||
upgrade_me.append(pkg)
|
upgrade_me.append(pkg)
|
||||||
|
|
||||||
# for every source package in testing-proposed-updates, check if it should be upgraded
|
# for every source package in testing-proposed-updates, check if it should be upgraded
|
||||||
for pkg in self.sources['tpu']:
|
for pkg in sources['tpu']:
|
||||||
# if the source package is already present in testing,
|
# if the source package is already present in testing,
|
||||||
# check if it should be upgraded for every binary package
|
# check if it should be upgraded for every binary package
|
||||||
if pkg in self.sources['testing']:
|
if pkg in sources['testing']:
|
||||||
for arch in self.options.architectures:
|
for arch in architectures:
|
||||||
if self.should_upgrade_srcarch(pkg, arch, 'tpu'):
|
if should_upgrade_srcarch(pkg, arch, 'tpu'):
|
||||||
upgrade_me.append("%s/%s_tpu" % (pkg, arch))
|
upgrade_me.append("%s/%s_tpu" % (pkg, arch))
|
||||||
|
|
||||||
# check if the source package should be upgraded
|
# check if the source package should be upgraded
|
||||||
if self.should_upgrade_src(pkg, 'tpu'):
|
if should_upgrade_src(pkg, 'tpu'):
|
||||||
upgrade_me.append("%s_tpu" % pkg)
|
upgrade_me.append("%s_tpu" % pkg)
|
||||||
|
|
||||||
# process the `remove' hints, if the given package is not yet in upgrade_me
|
# process the `remove' hints, if the given package is not yet in upgrade_me
|
||||||
for src in self.hints["remove"].keys():
|
for src in self.hints["remove"].keys():
|
||||||
if src in upgrade_me: continue
|
if src in upgrade_me: continue
|
||||||
if ("-"+src) in upgrade_me: continue
|
if ("-"+src) in upgrade_me: continue
|
||||||
if src not in self.sources['testing']: continue
|
if src not in sources['testing']: continue
|
||||||
|
|
||||||
# check if the version specified in the hint is the same of the considered package
|
# check if the version specified in the hint is the same of the considered package
|
||||||
tsrcv = self.sources['testing'][src]['version']
|
tsrcv = sources['testing'][src]['version']
|
||||||
if not self.same_source(tsrcv, self.hints["remove"][src][0]): continue
|
if not self.same_source(tsrcv, self.hints["remove"][src][0]): continue
|
||||||
|
|
||||||
# add the removal of the package to upgrade_me and build a new excuse
|
# add the removal of the package to upgrade_me and build a new excuse
|
||||||
|
Loading…
x
Reference in New Issue
Block a user