summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/util/_dyn_libs/LinkageMapELF.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
index 31aacbbf2..11e32b6b9 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
@@ -183,7 +183,9 @@ class LinkageMapELF(object):
lines.append((include_file, line))
aux_keys = [self._needed_aux_key]
- self._dbapi.lock()
+ can_lock = os.access(os.path.dirname(self._dbapi._dbroot), os.W_OK)
+ if can_lock:
+ self._dbapi.lock()
try:
for cpv in self._dbapi.cpv_all():
if exclude_pkgs is not None and cpv in exclude_pkgs:
@@ -193,7 +195,8 @@ class LinkageMapELF(object):
for line in self._dbapi.aux_get(cpv, aux_keys)[0].splitlines():
lines.append((needed_file, line))
finally:
- self._dbapi.unlock()
+ if can_lock:
+ self._dbapi.unlock()
# have to call scanelf for preserved libs here as they aren't
# registered in NEEDED.ELF.2 files