--- scripts/checkelf.old	2014-06-19 18:50:10.499728066 +0200
+++ scripts/checkelf	2014-06-19 18:47:59.408732856 +0200
@@ -26,6 +26,7 @@
 import itertools
 import subprocess
 
+FILESDB = pisi.db.filesldb.FilesLDB()
 INSTALLDB = pisi.db.installdb.InstallDB()
 CONSTANTS = pisi.constants.Constants()
 CMPFILTR = re.compile("(.*?)(\s*\((base|devel)\)\s*)$")
@@ -73,6 +74,7 @@
     # result_undefined = undefined symbol errors
     return (result_needed, result_broken, result_unused, result_undefined)
 
+found_objdump = []
 def check_objdump(processed_needed, package_elf_files, package_name):
     '''check the objdump needed libraries with the ldd libraries
        the libraries that are needed can be used for dependencies'''
@@ -86,14 +88,18 @@
         else:
             # search for the package name (i.e: pisi sf /usr/lib/*.so )
             # the library may not exist, thus adding an exception is welcome
+            if objdump_needed.startswith("/"): objdump_needed = objdump_needed[1:]
+            if objdump_needed in found_objdump: continue
             try:
-                dependency_name = pisi.api.search_file(objdump_needed)[0][0]
+                dependency_name = FILESDB.search_file(objdump_needed)[0][0]
+                found_objdump.extend([x.path for x in INSTALLDB.get_files(dependency_name).list])
             except IndexError:
                 dependency_name = "broken"
                 #print "%s (probably broken dependency)" % needed
         result_needed.append((objdump_needed, dependency_name))
     return result_needed
 
+found_pc_files = []
 def check_pc_files(pc_file):
     '''check for .pc files created by pkgconfig and shipped with the package
        these .pc files have requirements tags that can be used for dependencies'''
@@ -102,12 +108,14 @@
             os.path.basename(pc_file).replace(".pc", "")).read().split("\n")[:-1])
 
     for require in requires:
-        require_file = "/usr/share/pkgconfig/%s.pc" % require
+        require_file = "usr/share/pkgconfig/%s.pc" % require
 
-        if not os.path.exists(require_file):
-            require_file = "/usr/lib/pkgconfig/%s.pc" % require
+        if not os.path.exists("/%s" % require_file):
+            require_file = "usr/lib/pkgconfig/%s.pc" % require
+        if require_file in found_pc_files: continue
         try:
-            dependency_name = pisi.api.search_file(require_file)[0][0]
+            dependency_name = FILESDB.search_file(require_file)[0][0]
+            found_pc_files.extend([x.path for x in INSTALLDB.get_files(dependency_name).list])
         except IndexError:
             dependency_name = "broken"
 
