fix 2 bugs and autosyncfirst pamac

This commit is contained in:
guinux 2013-03-20 10:03:22 +01:00
parent caca63de0e
commit 1bcbcc3c81
3 changed files with 40 additions and 34 deletions

View File

@ -26,7 +26,7 @@ def install(pkgnames):
if not pkgname in transaction.localpkgs.keys(): if not pkgname in transaction.localpkgs.keys():
transaction.to_add.append(pkgname) transaction.to_add.append(pkgname)
pkg_to_install.append(transaction.syncpkgs[pkgname]) pkg_to_install.append(transaction.syncpkgs[pkgname])
main.check_conflicts(pkg_to_install) main.check_conflicts('normal', pkg_to_install)
if transaction.to_add: if transaction.to_add:
if transaction.init_transaction(noconflicts = True, needed =True): if transaction.init_transaction(noconflicts = True, needed =True):
for pkgname in transaction.to_add: for pkgname in transaction.to_add:

View File

@ -192,3 +192,5 @@ if 'HoldPkg' in pacman_conf.options:
holdpkg = pacman_conf.options['HoldPkg'] holdpkg = pacman_conf.options['HoldPkg']
if 'SyncFirst' in pacman_conf.options: if 'SyncFirst' in pacman_conf.options:
syncfirst = pacman_conf.options['SyncFirst'] syncfirst = pacman_conf.options['SyncFirst']
if not 'pamac' in syncfirst:
syncfirst.append('pamac')

View File

@ -432,9 +432,9 @@ def check_conflicts(mode, pkg_list):
error = '' error = ''
pkgs = transaction.handle.get_localdb().search('linux3') pkgs = transaction.handle.get_localdb().search('linux3')
installed_linux = [] installed_linux = []
for i in pkgs: for item in pkgs:
if len(i.name) == 7: if len(item.name) == 7:
installed_linux.append(i.name) installed_linux.append(item.name)
for to_install in transaction.to_add: for to_install in transaction.to_add:
if 'linux3' in to_install: if 'linux3' in to_install:
if len(to_install) == 7: if len(to_install) == 7:
@ -517,21 +517,23 @@ def check_conflicts(mode, pkg_list):
provide = pyalpm.find_satisfier(transaction.localpkgs.values(), conflict) provide = pyalpm.find_satisfier(transaction.localpkgs.values(), conflict)
if provide: if provide:
if provide.name != pkg.name: if provide.name != pkg.name:
required = pkg.compute_requiredby() new_provide = pyalpm.find_satisfier([transaction.syncpkgs[provide.name]], conflict)
if required: if new_provide:
str_required = '' required = pkg.compute_requiredby()
for i in required: if required:
if str_required: str_required = ''
str_required += ', ' for item in required:
str_required += i if str_required:
if error: str_required += ', '
error += '\n' str_required += item
error += '{} conflicts with {} but cannot be removed because it is needed by {}'.format(provide.name, pkg.name, str_required) if error:
elif not provide.name in transaction.to_remove: error += '\n'
transaction.to_remove.append(provide.name) error += '{} conflicts with {} but cannot be removed because it is needed by {}'.format(provide.name, pkg.name, str_required)
if warning: elif not provide.name in transaction.to_remove:
warning += '\n' transaction.to_remove.append(provide.name)
warning += pkg.name+' conflicts with '+provide.name if warning:
warning += '\n'
warning += pkg.name+' conflicts with '+provide.name
provide = pyalpm.find_satisfier(depends[0], conflict) provide = pyalpm.find_satisfier(depends[0], conflict)
if provide: if provide:
if not common.format_pkg_name(conflict) == pkg.name: if not common.format_pkg_name(conflict) == pkg.name:
@ -548,21 +550,23 @@ def check_conflicts(mode, pkg_list):
provide = pyalpm.find_satisfier(depends[0], conflict) provide = pyalpm.find_satisfier(depends[0], conflict)
if provide: if provide:
if provide.name != pkg.name: if provide.name != pkg.name:
required = pkg.compute_requiredby() new_provide = pyalpm.find_satisfier([transaction.syncpkgs[pkg.name]], conflict)
if required: if new_provide:
str_required = '' required = pkg.compute_requiredby()
for i in required: if required:
if str_required: str_required = ''
str_required += ', ' for item in required:
str_required += i if str_required:
if error: str_required += ', '
error += '\n' str_required += item
error += '{} conflicts with {} but cannot be removed because it is needed by {}'.format(provide.name, pkg.name, str_required) if error:
elif not provide.name in transaction.to_remove: error += '\n'
transaction.to_remove.append(pkg.name) error += '{} conflicts with {} but cannot be removed because it is needed by {}'.format(provide.name, pkg.name, str_required)
if warning: elif not provide.name in transaction.to_remove:
warning += '\n' transaction.to_remove.append(pkg.name)
warning += provide.name+' conflicts with '+pkg.name if warning:
warning += '\n'
warning += provide.name+' conflicts with '+pkg.name
if mode == 'updating': if mode == 'updating':
for pkg in transaction.syncpkgs.values(): for pkg in transaction.syncpkgs.values():
for replace in pkg.replaces: for replace in pkg.replaces: