detect packages which are built against missing libraries

Jona Joachim jaj at hcl-club.lu
Thu Feb 14 22:00:11 UTC 2008


On Thu, 14 Feb 2008 21:32:19 +0100, Jona Joachim wrote:

> Hi!
> The last upgrade of devel/icu broke a lot of binaries for me because
> they were missing libicui18n.so.36. I quickly hacked together a python
> script which tries to indentify which packages were built against no
> longer existing libraries.
> It outputs a list of packages which can easily be combinded with
> portupgrade -f.
> It depends on portupgrade.
> I just post it here in case it can be useful for anybody. It is a good
> idea to run pkgdb -F before running it.

#!/usr/bin/env python

from subprocess import *

lddprog = "/usr/bin/ldd"
pkg_whichprog = "/usr/local/sbin/pkg_which"

def execcmd(cmd):
  p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
  return p.stdout

def pkg_which(executable):
  out = execcmd(pkg_whichprog + " " + executable)
  ret = out.readline()
  out.close()
  return ret[:-1]

pldd = execcmd(lddprog + " /usr/local/bin/* /usr/local/sbin/*")

progarr = []

for line in pldd.readlines():
  if line[0] != '\t':
    tmp = line[:-2]
  elif line.find("not found") != (-1):
    progarr.append(tmp)

concerned_pkgs = set(map(pkg_which, progarr))

print reduce(lambda x, y: x + " " + y, concerned_pkgs)



More information about the freebsd-ports mailing list