Fixes for single-architecture updates.

bzr-import-20160707
Fabio Tranchitella 19 years ago
parent 8c9bac0eea
commit b0ef0af348

@ -1810,12 +1810,12 @@ class Britney:
sources = self.sources sources = self.sources
binaries = self.binaries['testing'] binaries = self.binaries['testing']
# removal of single-arch binary packag = "-<package>/<arch>" # removal of single-arch binary package = "-<package>/<arch>"
if pkg[0] == "-" and "/" in pkg: if pkg[0] == "-" and "/" in pkg:
pkg_name, arch = pkg.split("/") pkg_name, arch = pkg.split("/")
pkg_name = pkg_name[1:] pkg_name = pkg_name[1:]
suite = "testing" suite = "testing"
# arch = "<package>/<arch>", # arch = "<source>/<arch>",
elif "/" in pkg: elif "/" in pkg:
pkg_name, arch = pkg.split("/") pkg_name, arch = pkg.split("/")
suite = "unstable" suite = "unstable"
@ -1833,101 +1833,99 @@ class Britney:
suite = "unstable" suite = "unstable"
# remove all binary packages (if the source already exists) # remove all binary packages (if the source already exists)
if not arch: if not (arch and pkg[0] == '-'):
if pkg_name in sources['testing']: if pkg_name in sources['testing']:
source = sources['testing'][pkg_name] source = sources['testing'][pkg_name]
# remove all the binaries # remove all the binaries
for p in source['binaries']: for p in source['binaries']:
binary, arch = p.split("/") binary, parch = p.split("/")
if arch and parch != arch: continue
# if a smooth update is possible for the package, skip it # if a smooth update is possible for the package, skip it
if not self.options.compatible and suite == 'unstable' and \ if not self.options.compatible and suite == 'unstable' and \
binary not in self.binaries[suite][arch][0] and \ binary not in self.binaries[suite][parch][0] and \
('ALL' in self.options.smooth_updates or \ ('ALL' in self.options.smooth_updates or \
binaries[arch][0][binary].get('section', None) in self.options.smooth_updates): binaries[parch][0][binary].get('section', None) in self.options.smooth_updates):
continue continue
# save the old binary for undo # save the old binary for undo
undo['binaries'][p] = binaries[arch][0][binary] undo['binaries'][p] = binaries[parch][0][binary]
# all the reverse dependencies are affected by the change # all the reverse dependencies are affected by the change
for j in binaries[arch][0][binary]['rdepends']: for j in binaries[parch][0][binary]['rdepends']:
key = (j, arch) key = (j, parch)
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
# remove the provided virtual packages # remove the provided virtual packages
for j in binaries[arch][0][binary]['provides']: for j in binaries[parch][0][binary]['provides']:
key = j + "/" + arch key = j + "/" + parch
if key not in undo['virtual']: if key not in undo['virtual']:
undo['virtual'][key] = binaries[arch][1][j][:] undo['virtual'][key] = binaries[parch][1][j][:]
binaries[arch][1][j].remove(binary) binaries[parch][1][j].remove(binary)
if len(binaries[arch][1][j]) == 0: if len(binaries[parch][1][j]) == 0:
del binaries[arch][1][j] del binaries[parch][1][j]
# finally, remove the binary package # finally, remove the binary package
del binaries[arch][0][binary] del binaries[parch][0][binary]
# remove the source package # remove the source package
if not arch:
undo['sources'][pkg_name] = source undo['sources'][pkg_name] = source
del sources['testing'][pkg_name] del sources['testing'][pkg_name]
else: else:
# the package didn't exist, so we mark it as to-be-removed in case of undo # the package didn't exist, so we mark it as to-be-removed in case of undo
undo['sources']['-' + pkg_name] = True undo['sources']['-' + pkg_name] = True
# single architecture updates (eg. binNMU or single binary removal) # single binary removal
else: elif pkg_name in binaries[arch][0]:
if pkg_name in binaries[arch][0]:
undo['binaries'][pkg_name + "/" + arch] = binaries[arch][0][pkg_name] undo['binaries'][pkg_name + "/" + arch] = binaries[arch][0][pkg_name]
for j in binaries[arch][0][pkg_name]['rdepends']: for j in binaries[arch][0][pkg_name]['rdepends']:
key = (j, arch) key = (j, arch)
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
# the package didn't exist, so we mark it as to-be-removed in case of undo
if pkg[0] != "-":
undo['binaries']['-' + pkg] = True
source = {'binaries': [pkg]}
# or we delete it if this is what the action required
else:
del binaries[arch][0][pkg_name] del binaries[arch][0][pkg_name]
# add the new binary packages (if we are not removing) # add the new binary packages (if we are not removing)
if pkg[0] != "-": if pkg[0] != "-":
source = sources[suite][pkg_name] source = sources[suite][pkg_name]
for p in source['binaries']: for p in source['binaries']:
binary, arch = p.split("/") binary, parch = p.split("/")
key = (binary, arch) if arch and parch != arch: continue
key = (binary, parch)
# obviously, added/modified packages are affected # obviously, added/modified packages are affected
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
# if the binary already exists (built from another source) # if the binary already exists (built from another ource)
if binary in binaries[arch][0]: if binary in binaries[parch][0]:
# save the old binary package # save the old binary package
undo['binaries'][p] = binaries[arch][0][binary] undo['binaries'][p] = binaries[parch][0][binary]
# all the reverse dependencies are affected by the change # all the reverse dependencies are affected by the change
for j in binaries[arch][0][binary]['rdepends']: for j in binaries[parch][0][binary]['rdepends']:
key = (j, arch) key = (j, parch)
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
# all the reverse conflicts and their dependency tree are affected by the change # all the reverse conflicts and their dependency tree are affected by the change
for j in binaries[arch][0][binary]['rconflicts']: for j in binaries[parch][0][binary]['rconflicts']:
key = (j, arch) key = (j, parch)
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
for p in self.get_full_tree(j, arch, 'testing'): for p in self.get_full_tree(j, parch, 'testing'):
key = (p, arch) key = (p, parch)
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
# add/update the binary package # add/update the binary package
binaries[arch][0][binary] = self.binaries[suite][arch][0][binary] binaries[parch][0][binary] = self.binaries[suite][parch][0][binary]
# register new provided packages # register new provided packages
for j in binaries[arch][0][binary]['provides']: for j in binaries[parch][0][binary]['provides']:
key = j + "/" + arch key = j + "/" + parch
if j not in binaries[arch][1]: if j not in binaries[parch][1]:
undo['nvirtual'].append(key) undo['nvirtual'].append(key)
binaries[arch][1][j] = [] binaries[parch][1][j] = []
elif key not in undo['virtual']: elif key not in undo['virtual']:
undo['virtual'][key] = binaries[arch][1][j][:] undo['virtual'][key] = binaries[parch][1][j][:]
binaries[arch][1][j].append(binary) binaries[parch][1][j].append(binary)
# all the reverse dependencies are affected by the change # all the reverse dependencies are affected by the change
for j in binaries[arch][0][binary]['rdepends']: for j in binaries[parch][0][binary]['rdepends']:
key = (j, arch) key = (j, parch)
if key not in affected: affected.append(key) if key not in affected: affected.append(key)
# register reverse dependencies and conflicts for the new binary packages # register reverse dependencies and conflicts for the new binary packages
for p in source['binaries']: for p in source['binaries']:
binary, arch = p.split("/") binary, parch = p.split("/")
self.register_reverses(binary, binaries[arch][0] , binaries[arch][1]) if arch and parch != arch: continue
self.register_reverses(binary, binaries[parch][0] , binaries[parch][1])
# add/update the source package # add/update the source package
if not arch:
sources['testing'][pkg_name] = sources[suite][pkg_name] sources['testing'][pkg_name] = sources[suite][pkg_name]
# return the package name, the suite, the list of affected packages and the undo dictionary # return the package name, the suite, the list of affected packages and the undo dictionary

Loading…
Cancel
Save