Skip to content
Snippets Groups Projects
Commit fd63f7a3 authored by guinux's avatar guinux
Browse files

begin multiples provides handling

parent 4b859f0e
No related branches found
No related tags found
No related merge requests found
...@@ -95,6 +95,7 @@ def check_conflicts(): ...@@ -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,31 +106,28 @@ def check_conflicts(): ...@@ -105,31 +106,28 @@ 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) for name in target.replaces:
if target.replaces: if name in installed_pkg_name:
for name in target.replaces: if not name in to_remove:
if name in installed_pkg_name: to_remove.append(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)
if warning: if warning:
warning = warning+'\n' warning = warning+'\n'
warning = warning+name+' conflicts with '+target.name+'\nNone of them will be installed' warning = warning+name+' will be replaced by '+target.name
if name in installed_pkg_name: for name in target.conflicts:
if not name in to_remove: if name in to_add:
to_remove.append(name) to_add.remove(name)
if warning: to_add.remove(target.name)
warning = warning+'\n' if warning:
warning = warning+name+' conflicts with '+target.name 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: for installed_pkg in handle.get_localdb().pkgcache:
if installed_pkg.conflicts: if installed_pkg.conflicts:
for name in installed_pkg.conflicts: for name in installed_pkg.conflicts:
...@@ -143,19 +141,28 @@ def check_conflicts(): ...@@ -143,19 +141,28 @@ 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 in installed_pkg_name:
if name == 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: warning = warning+'\n'
warning = warning+'\n' warning = warning+name+' will be replaced by '+pkg.name
warning = warning+name+' will be replaced by '+pkg.name if not pkg.name in to_add:
if not pkg.name in to_add: 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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment