pakhandler.py 797 B

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. def update_ld_so_cache(filepath):
  3. import glob
  4. import piksemel
  5. import subprocess
  6. libdirs = []
  7. for config_file in glob.glob("/etc/ld.so.conf.d/*.conf"):
  8. for line in open(config_file):
  9. line = line.strip()
  10. if line.startswith("/"):
  11. libdirs.append(line[1:])
  12. libdirs = tuple(libdirs)
  13. doc = piksemel.parse(filepath)
  14. for item in doc.tags("File"):
  15. path = item.getTagData("Path")
  16. if path.startswith(libdirs):
  17. subprocess.call(["/sbin/ldconfig", "-X"])
  18. return
  19. def setupPackage(metapath, filepath):
  20. update_ld_so_cache(filepath)
  21. def cleanupPackage(metapath, filepath):
  22. pass
  23. def postCleanupPackage(metapath, filepath):
  24. update_ld_so_cache(filepath)