|
59 | 59 | HTTP_SOURCE_UBUNTUKYLIN = "http://archive.ubuntukylin.com:10006/ubuntukylin"
|
60 | 60 | DEB_SOURCE_UBUNTUKYLIN = "deb " + HTTP_SOURCE_UBUNTUKYLIN
|
61 | 61 | UBUNTUKYLIN_SOFTWARECENTER_ACTION = 'com.ubuntukylin.softwarecenter.action'
|
62 |
| - |
| 62 | +LIB_PATH = "/var/lib/" |
| 63 | +DPKG_PATH = LIB_PATH + "dpkg/lock" |
63 | 64 |
|
64 | 65 | class WorkItem:
|
65 | 66 | def __init__(self, pkgname, action, kwargs):
|
@@ -87,7 +88,7 @@ def run(self):
|
87 | 88 | time.sleep(0.5)
|
88 | 89 | continue
|
89 | 90 |
|
90 |
| - if is_file_locked("/var/lib/dpkg/lock") is True or 1 == self.uksc_is_working: |
| 91 | + if is_file_locked(DPKG_PATH) is True or 1 == self.uksc_is_working: |
91 | 92 | time.sleep(0.5)
|
92 | 93 | continue
|
93 | 94 |
|
@@ -128,7 +129,8 @@ def is_file_locked(lockfile):
|
128 | 129 | """
|
129 | 130 | Check whether ``apt-get`` or ``dpkg`` is currently active by check the lock file.
|
130 | 131 |
|
131 |
| - This works by checking whether the lock file like ``/var/lib/dpkg/lock`` |
| 132 | + This works by checking whether the lock file like ``/var/lib/ |
| 133 | + dpkg/lock`` |
132 | 134 | ``/var/lib/apt/lists/lock`` is locked by an ``apt-get`` or ``dpkg`` process,
|
133 | 135 | which in turn is done by momentarily trying to acquire the lock.
|
134 | 136 | This means that the current process needs to have sufficient privileges.
|
@@ -590,7 +592,7 @@ def check_work_item(self):
|
590 | 592 | if len(self.worklist) != 0:
|
591 | 593 | workitemcount = len(self.worklist)
|
592 | 594 | self.mutex.release()
|
593 |
| - dpkg_is_running = is_file_locked("/var/lib/dpkg/lock") |
| 595 | + dpkg_is_running = is_file_locked(DPKG_PATH) |
594 | 596 | if dpkg_is_running is True:
|
595 | 597 | dpkg_is_running = 1
|
596 | 598 | else:
|
|
0 commit comments