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:
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