begin multiples provides handling

This commit is contained in:
guinux 2013-01-26 16:59:29 +01:00
parent 4b859f0eb6
commit fd63f7a36d
1 changed files with 41 additions and 34 deletions

View File

@ -95,6 +95,7 @@ def check_conflicts():
installed_pkg_name = [] installed_pkg_name = []
syncdbs_pkg_name = [] syncdbs_pkg_name = []
depends = [] depends = []
provides = {}
warning = '' warning = ''
for pkgname in to_add: for pkgname in to_add:
for repo in handle.get_syncdbs(): for repo in handle.get_syncdbs():
@ -105,10 +106,8 @@ def check_conflicts():
for installed_pkg in handle.get_localdb().pkgcache: for installed_pkg in handle.get_localdb().pkgcache:
installed_pkg_name.append(installed_pkg.name) installed_pkg_name.append(installed_pkg.name)
for target in to_check: for target in to_check:
if target.depends:
for name in target.depends: for name in target.depends:
depends.append(name) depends.append(name)
if target.replaces:
for name in target.replaces: for name in target.replaces:
if name in installed_pkg_name: if name in installed_pkg_name:
if not name in to_remove: if not name in to_remove:
@ -116,7 +115,6 @@ def check_conflicts():
if warning: if warning:
warning = warning+'\n' warning = warning+'\n'
warning = warning+name+' will be replaced by '+target.name warning = warning+name+' will be replaced by '+target.name
if target.conflicts:
for name in target.conflicts: for name in target.conflicts:
if name in to_add: if name in to_add:
to_add.remove(name) to_add.remove(name)
@ -143,9 +141,8 @@ def check_conflicts():
depends.remove(installed_pkg.name) depends.remove(installed_pkg.name)
for repo in handle.get_syncdbs(): for repo in handle.get_syncdbs():
for pkg in repo.pkgcache: for pkg in repo.pkgcache:
if pkg.replaces:
for name in pkg.replaces: for name in pkg.replaces:
if name == installed_pkg_name: if name in installed_pkg_name:
if not name in to_remove: if not name in to_remove:
to_remove.append(name) to_remove.append(name)
if warning: if warning:
@ -155,7 +152,17 @@ def check_conflicts():
to_add.append(pkg.name) to_add.append(pkg.name)
if pkg.name in depends: if pkg.name in depends:
depends.remove(pkg.name) depends.remove(pkg.name)
print(depends) if depends:
for repo in handle.get_syncdbs():
for pkg in repo.pkgcache:
for depend in depends:
for name in pkg.provides:
if name == depend:
if not provides.__contains__(depend):
provides[depend] = []
provides.get(depend).append(pkg.name)
if provides:
print(provides)
if warning: if warning:
WarningDialog.format_secondary_text(warning) WarningDialog.format_secondary_text(warning)
response = WarningDialog.run() response = WarningDialog.run()