Skip to content

Commit

Permalink
Fix some lintian warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
handsome-feng committed Aug 12, 2019
1 parent b6b6d67 commit b82a929
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions backend/aptdaemon/conf/com.ubuntukylin.softwarecenter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

<!-- Allow anyone to invoke methods on the interfaces -->
<policy context="default">
<allow send_interface="com.ubuntukylin.softwarecenter"/>
<allow send_destination="com.ubuntukylin.softwarecenter"
send_interface="org.freedesktop.DBus.Introspectable"/>
send_interface="com.ubuntukylin.softwarecenter"/>
<allow send_destination="com.ubuntukylin.softwarecenter"
send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="com.ubuntukylin.softwarecenter"
send_interface="org.freedesktop.DBus.Properties"/>
send_interface="org.freedesktop.DBus.Properties"/>
</policy>
</busconfig>
10 changes: 6 additions & 4 deletions ubuntu_kylin_software_center_daemon/apt_dbus_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
HTTP_SOURCE_UBUNTUKYLIN = "http://archive.ubuntukylin.com:10006/ubuntukylin"
DEB_SOURCE_UBUNTUKYLIN = "deb " + HTTP_SOURCE_UBUNTUKYLIN
UBUNTUKYLIN_SOFTWARECENTER_ACTION = 'com.ubuntukylin.softwarecenter.action'

LIB_PATH = "/var/lib/"
DPKG_PATH = LIB_PATH + "dpkg/lock"

class WorkItem:
def __init__(self, pkgname, action, kwargs):
Expand Down Expand Up @@ -87,7 +88,7 @@ def run(self):
time.sleep(0.5)
continue

if is_file_locked("/var/lib/dpkg/lock") is True or 1 == self.uksc_is_working:
if is_file_locked(DPKG_PATH) is True or 1 == self.uksc_is_working:
time.sleep(0.5)
continue

Expand Down Expand Up @@ -128,7 +129,8 @@ def is_file_locked(lockfile):
"""
Check whether ``apt-get`` or ``dpkg`` is currently active by check the lock file.
This works by checking whether the lock file like ``/var/lib/dpkg/lock``
This works by checking whether the lock file like ``/var/lib/
dpkg/lock``
``/var/lib/apt/lists/lock`` is locked by an ``apt-get`` or ``dpkg`` process,
which in turn is done by momentarily trying to acquire the lock.
This means that the current process needs to have sufficient privileges.
Expand Down Expand Up @@ -590,7 +592,7 @@ def check_work_item(self):
if len(self.worklist) != 0:
workitemcount = len(self.worklist)
self.mutex.release()
dpkg_is_running = is_file_locked("/var/lib/dpkg/lock")
dpkg_is_running = is_file_locked(DPKG_PATH)
if dpkg_is_running is True:
dpkg_is_running = 1
else:
Expand Down

0 comments on commit b82a929

Please sign in to comment.