authentication timeout and check kernel modules fixes

This commit is contained in:
guinux 2014-01-29 16:21:37 +01:00
parent 09ff0c9ca1
commit 5152f01be8
2 changed files with 12 additions and 6 deletions

View File

@ -71,7 +71,6 @@ class PamacDBusService(dbus.service.Object):
self.get_handle()
def get_handle(self):
print('daemon get handle')
self.handle = config.handle()
self.localdb = self.handle.get_localdb()
self.syncdbs = self.handle.get_syncdbs()
@ -417,7 +416,9 @@ class PamacDBusService(dbus.service.Object):
Subject = ('unix-process', {'pid': dbus.UInt32(sender_pid, variant_level=1),
'start-time': dbus.UInt64(0, variant_level=1)})
(is_authorized,is_challenge,details) = policykit_authority.CheckAuthorization(Subject, action, {'': ''}, dbus.UInt32(1), '')
# We would like an infinite timeout, but dbus-python won't allow it.
# Pass the longest timeout dbus-python will accept
(is_authorized,is_challenge,details) = policykit_authority.CheckAuthorization(Subject, action, {'': ''}, dbus.UInt32(1), '',timeout=2147483)
return is_authorized
@dbus.service.method('org.manjaro.pamac', 'si', 's')
@ -593,9 +594,15 @@ class PamacDBusService(dbus.service.Object):
for module in installed_modules:
pkgname = match.group(1)+module
if not pkgname in to_remove:
to_remove.add(pkgname)
_pkg = self.localdb.get_pkg(pkgname)
if _pkg:
# Check we won't remove a third party kernel
third_party = False
for provide in _pkg.provides:
if 'linux=' in provide:
third_party = True
if not third_party:
to_remove.add(pkgname)
self.t.remove_pkg(_pkg)
# start loops to check pkgs
i = 0

View File

@ -241,7 +241,6 @@ def get_handle():
handle = config.handle()
syncdbs = handle.get_syncdbs()
localdb = handle.get_localdb()
print('get handle')
def get_localpkg(name):
return localdb.get_pkg(name)
@ -395,7 +394,7 @@ def check_to_build():
to_mark_as_dep.add(name)
# reorder to_build following build_order
to_build.sort(key = lambda pkg: build_order.index(pkg.name))
print('order:', build_order)
#print('order:', build_order)
print('to build:',to_build)
print('makedeps:',make_depends)
print('builddeps:',build_depends)