some updater fixes
This commit is contained in:
0
pamac/__init__.py
Executable file → Normal file
0
pamac/__init__.py
Executable file → Normal file
2
pamac/common.py
Executable file → Normal file
2
pamac/common.py
Executable file → Normal file
@@ -16,4 +16,4 @@ def format_pkg_name(name):
|
||||
index = name.find(i)
|
||||
if index != -1:
|
||||
name = name[0:index]
|
||||
return name
|
||||
return name
|
||||
|
0
pamac/config.py
Executable file → Normal file
0
pamac/config.py
Executable file → Normal file
10
pamac/manager.py
Executable file → Normal file
10
pamac/manager.py
Executable file → Normal file
@@ -327,7 +327,7 @@ def choose_provides():
|
||||
break
|
||||
for target in to_check:
|
||||
for name in target.depends:
|
||||
depends.append(common.format_pkg_name(name))
|
||||
depends.append(name)
|
||||
for installed_pkg in transaction.handle.get_localdb().pkgcache:
|
||||
if installed_pkg.name in depends:
|
||||
depends.remove(installed_pkg.name)
|
||||
@@ -340,7 +340,7 @@ def choose_provides():
|
||||
for pkg in repo.pkgcache:
|
||||
for depend in depends:
|
||||
for name in pkg.provides:
|
||||
if common.format_pkg_name(name) == depend:
|
||||
if name == depend:
|
||||
if not provides.__contains__(depend):
|
||||
provides[depend] = []
|
||||
if not pkg.name in provides.get(depend):
|
||||
@@ -375,7 +375,7 @@ def choose_provides():
|
||||
already_provided = True
|
||||
for installed_pkg in transaction.handle.get_localdb().pkgcache:
|
||||
for name in installed_pkg.provides:
|
||||
if common.format_pkg_name(name) == virtualdep:
|
||||
if name == virtualdep:
|
||||
already_provided = True
|
||||
if already_provided:
|
||||
pass
|
||||
@@ -415,7 +415,7 @@ class Handler:
|
||||
print('Transaction locked')
|
||||
else:
|
||||
if transaction_type is "remove":
|
||||
if transaction.init_transaction(cascade = True):
|
||||
if transaction.init_transaction(cascade = True, unneeded = True):
|
||||
for pkgname in transaction_dict.keys():
|
||||
transaction.Remove(pkgname)
|
||||
error = transaction.Prepare()
|
||||
@@ -498,7 +498,7 @@ class Handler:
|
||||
Gtk.main_iteration()
|
||||
transaction.Commit(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
if (transaction_type == "install") or (transaction_type == "update"):
|
||||
if transaction.init_transaction(noconflicts = True, nodeps = True):
|
||||
if transaction.init_transaction(noconflicts = True):#, nodeps = True):
|
||||
for pkgname in transaction.to_update:
|
||||
transaction.Add(pkgname)
|
||||
for pkgname in transaction.to_add:
|
||||
|
0
pamac/pamac-daemon.py
Executable file → Normal file
0
pamac/pamac-daemon.py
Executable file → Normal file
37
pamac/transaction.py
Executable file → Normal file
37
pamac/transaction.py
Executable file → Normal file
@@ -159,36 +159,6 @@ def get_to_add():
|
||||
global to_add
|
||||
to_add = To_Add()
|
||||
|
||||
def do_refresh():
|
||||
"""Sync databases like pacman -Sy"""
|
||||
global t_lock
|
||||
get_handle()
|
||||
if t_lock is False:
|
||||
t_lock = True
|
||||
progress_label.set_text('Refreshing...')
|
||||
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
|
||||
ProgressWindow.show_all()
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
Refresh(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
|
||||
def handle_error(error):
|
||||
global t_lock
|
||||
if not 'DBus.Error.NoReply' in str(error):
|
||||
transaction.ErrorDialog.format_secondary_text('Refresh Error:\n'+str(error))
|
||||
response = transaction.ErrorDialog.run()
|
||||
if response:
|
||||
transaction.ErrorDialog.hide()
|
||||
t_lock = False
|
||||
Release()
|
||||
ProgressWindow.hide()
|
||||
|
||||
def handle_reply(reply):
|
||||
global t_lock
|
||||
t_lock = False
|
||||
Release()
|
||||
ProgressWindow.hide()
|
||||
|
||||
def get_updates():
|
||||
"""Return a list of package objects in local db which can be updated"""
|
||||
global do_syncfirst
|
||||
@@ -197,9 +167,10 @@ def get_updates():
|
||||
if config.syncfirst:
|
||||
for name in config.syncfirst:
|
||||
pkg = handle.get_localdb().get_pkg(name)
|
||||
candidate = pyalpm.sync_newversion(pkg, handle.get_syncdbs())
|
||||
if candidate:
|
||||
list_first.append(candidate)
|
||||
if pkg:
|
||||
candidate = pyalpm.sync_newversion(pkg, handle.get_syncdbs())
|
||||
if candidate:
|
||||
list_first.append(candidate)
|
||||
if list_first:
|
||||
do_syncfirst = True
|
||||
return list_first
|
||||
|
0
pamac/tray.py
Executable file → Normal file
0
pamac/tray.py
Executable file → Normal file
23
pamac/updater.py
Executable file → Normal file
23
pamac/updater.py
Executable file → Normal file
@@ -18,6 +18,18 @@ bottom_label = interface.get_object('bottom_label')
|
||||
update_listore = interface.get_object('update_list')
|
||||
update_label = interface.get_object('update_label')
|
||||
|
||||
def do_refresh():
|
||||
"""Sync databases like pacman -Sy"""
|
||||
transaction.get_handle()
|
||||
if transaction.t_lock is False:
|
||||
transaction.t_lock = True
|
||||
transaction.progress_label.set_text('Refreshing...')
|
||||
transaction.action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
|
||||
transaction.ProgressWindow.show_all()
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
transaction.Refresh(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
|
||||
def have_updates():
|
||||
available_updates = transaction.get_updates()
|
||||
update_listore.clear()
|
||||
@@ -90,11 +102,11 @@ def do_sysupgrade():
|
||||
transaction.get_to_add()
|
||||
transaction.check_conflicts()
|
||||
transaction.Release()
|
||||
if len(transaction.to_update) == 0:
|
||||
if len(transaction.to_add) == 0:
|
||||
transaction.t_lock = False
|
||||
print("Nothing to update")
|
||||
else:
|
||||
if transaction.init_transaction(noconflicts = True, nodeps = True):
|
||||
if transaction.init_transaction(noconflicts = True):
|
||||
for pkgname in transaction.to_update:
|
||||
transaction.Add(pkgname)
|
||||
for pkgname in transaction.to_add:
|
||||
@@ -169,7 +181,7 @@ class Handler:
|
||||
|
||||
def on_RefreshButton_clicked(self, *arg):
|
||||
transaction.do_refresh()
|
||||
have_updates()
|
||||
#have_updates()
|
||||
|
||||
def on_TransCancelButton_clicked(self, *arg):
|
||||
ConfDialog.hide()
|
||||
@@ -187,8 +199,9 @@ class Handler:
|
||||
have_updates()
|
||||
|
||||
def main():
|
||||
transaction.do_refresh()
|
||||
have_updates()
|
||||
do_refresh()
|
||||
#have_updates()
|
||||
update_label.set_markup("<big><b>Available updates</b></big>")
|
||||
interface.connect_signals(Handler())
|
||||
UpdateWindow.show_all()
|
||||
while Gtk.events_pending():
|
||||
|
Reference in New Issue
Block a user