begin multiples provides handling

This commit is contained in:
guinux 2013-01-26 16:59:29 +01:00
parent 4b859f0eb6
commit fd63f7a36d

View File

@ -95,6 +95,7 @@ def check_conflicts():
installed_pkg_name = []
syncdbs_pkg_name = []
depends = []
provides = {}
warning = ''
for pkgname in to_add:
for repo in handle.get_syncdbs():
@ -105,31 +106,28 @@ def check_conflicts():
for installed_pkg in handle.get_localdb().pkgcache:
installed_pkg_name.append(installed_pkg.name)
for target in to_check:
if target.depends:
for name in target.depends:
depends.append(name)
if target.replaces:
for name in target.replaces:
if name in installed_pkg_name:
if not name in to_remove:
to_remove.append(name)
if warning:
warning = warning+'\n'
warning = warning+name+' will be replaced by '+target.name
if target.conflicts:
for name in target.conflicts:
if name in to_add:
to_add.remove(name)
to_add.remove(target.name)
for name in target.depends:
depends.append(name)
for name in target.replaces:
if name in installed_pkg_name:
if not name in to_remove:
to_remove.append(name)
if warning:
warning = warning+'\n'
warning = warning+name+' conflicts with '+target.name+'\nNone of them will be installed'
if name in installed_pkg_name:
if not name in to_remove:
to_remove.append(name)
if warning:
warning = warning+'\n'
warning = warning+name+' conflicts with '+target.name
warning = warning+name+' will be replaced by '+target.name
for name in target.conflicts:
if name in to_add:
to_add.remove(name)
to_add.remove(target.name)
if warning:
warning = warning+'\n'
warning = warning+name+' conflicts with '+target.name+'\nNone of them will be installed'
if name in installed_pkg_name:
if not name in to_remove:
to_remove.append(name)
if warning:
warning = warning+'\n'
warning = warning+name+' conflicts with '+target.name
for installed_pkg in handle.get_localdb().pkgcache:
if installed_pkg.conflicts:
for name in installed_pkg.conflicts:
@ -143,19 +141,28 @@ def check_conflicts():
depends.remove(installed_pkg.name)
for repo in handle.get_syncdbs():
for pkg in repo.pkgcache:
if pkg.replaces:
for name in pkg.replaces:
if name == installed_pkg_name:
if not name in to_remove:
to_remove.append(name)
if warning:
warning = warning+'\n'
warning = warning+name+' will be replaced by '+pkg.name
if not pkg.name in to_add:
to_add.append(pkg.name)
for name in pkg.replaces:
if name in installed_pkg_name:
if not name in to_remove:
to_remove.append(name)
if warning:
warning = warning+'\n'
warning = warning+name+' will be replaced by '+pkg.name
if not pkg.name in to_add:
to_add.append(pkg.name)
if pkg.name in depends:
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:
WarningDialog.format_secondary_text(warning)
response = WarningDialog.run()