]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Replace the dependency tracker.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Dec 2011 21:39:37 +0000 (22:39 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Dec 2011 21:39:37 +0000 (22:39 +0100)
Dropping the old version of the dependency tracker that is replaced
by a new one that should be much faster and supports x86_64.

The code should do exactly the same the old did.

16 files changed:
po/pakfire.pot
python/pakfire/base.py
python/pakfire/builder.py
python/pakfire/packages/base.py
python/pakfire/packages/file.py
python/pakfire/packages/installed.py
python/pakfire/packages/make.py
tools/Makefile
tools/dependency-tracker [deleted file]
tools/find-common [new file with mode: 0644]
tools/find-provides [new file with mode: 0755]
tools/find-requires [new file with mode: 0755]
tools/functions-files
tools/functions-packager-find [deleted file]
tools/pkg-config.prov [deleted file]
tools/pkg-config.req [deleted file]

index e616fa5ee7701aa4bf14133746e0e981e6a9d7a7..37c18e635bee960aa0b3a2962d2e6d97a5b51fcc 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-12-16 16:00+0100\n"
+"POT-Creation-Date: 2011-12-21 20:32+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -74,47 +74,47 @@ msgstr ""
 msgid "Downgrading"
 msgstr ""
 
-#: ../python/pakfire/base.py:207 ../python/pakfire/base.py:237
-#: ../python/pakfire/base.py:283 ../python/pakfire/base.py:334
-#: ../python/pakfire/base.py:400 ../python/pakfire/base.py:437
-#: ../python/pakfire/base.py:490 ../python/pakfire/base.py:510
+#: ../python/pakfire/base.py:211 ../python/pakfire/base.py:241
+#: ../python/pakfire/base.py:287 ../python/pakfire/base.py:338
+#: ../python/pakfire/base.py:404 ../python/pakfire/base.py:441
+#: ../python/pakfire/base.py:494 ../python/pakfire/base.py:514
 msgid "Nothing to do"
 msgstr ""
 
-#: ../python/pakfire/base.py:269
+#: ../python/pakfire/base.py:273
 msgid "There are no packages to install."
 msgstr ""
 
-#: ../python/pakfire/base.py:324
+#: ../python/pakfire/base.py:328
 #, python-format
 msgid "Could not find any installed package providing \"%s\"."
 msgstr ""
 
-#: ../python/pakfire/base.py:330
+#: ../python/pakfire/base.py:334
 #, python-format
 msgid "Multiple reinstall candidates for \"%s\": %s"
 msgstr ""
 
-#: ../python/pakfire/base.py:359
+#: ../python/pakfire/base.py:363
 #, python-format
 msgid "Could not find package %s in a remote repository."
 msgstr ""
 
-#: ../python/pakfire/base.py:428
+#: ../python/pakfire/base.py:432
 #, python-format
 msgid "Excluding %s."
 msgstr ""
 
-#: ../python/pakfire/base.py:478
+#: ../python/pakfire/base.py:482
 #, python-format
 msgid "\"%s\" package does not seem to be installed."
 msgstr ""
 
-#: ../python/pakfire/base.py:622
+#: ../python/pakfire/base.py:626
 msgid "Build command has failed."
 msgstr ""
 
-#: ../python/pakfire/base.py:702
+#: ../python/pakfire/base.py:706
 msgid "Everything is fine."
 msgstr ""
 
@@ -178,26 +178,26 @@ msgstr ""
 
 #. Package the result.
 #. Make all these little package from the build environment.
-#: ../python/pakfire/builder.py:845
+#: ../python/pakfire/builder.py:857
 msgid "Creating packages:"
 msgstr ""
 
 #. Execute the buildscript of this stage.
-#: ../python/pakfire/builder.py:865
+#: ../python/pakfire/builder.py:877
 #, python-format
 msgid "Running stage %s:"
 msgstr ""
 
-#: ../python/pakfire/builder.py:883
+#: ../python/pakfire/builder.py:895
 #, python-format
 msgid "Could not remove static libraries: %s"
 msgstr ""
 
-#: ../python/pakfire/builder.py:889
+#: ../python/pakfire/builder.py:901
 msgid "Compressing man pages did not complete successfully."
 msgstr ""
 
-#: ../python/pakfire/builder.py:909
+#: ../python/pakfire/builder.py:921
 msgid "Extracting debuginfo did not complete with success. Aborting build."
 msgstr ""
 
@@ -668,6 +668,11 @@ msgstr ""
 msgid "Package version is undefined."
 msgstr ""
 
+#: ../python/pakfire/packages/make.py:402
+#, python-format
+msgid "Searching for automatic dependencies for %s..."
+msgstr ""
+
 #. Load progressbar.
 #: ../python/pakfire/packages/packager.py:362
 msgid "Packaging"
@@ -705,13 +710,13 @@ msgid "%s: package database"
 msgstr ""
 
 #. Create progress bar.
-#: ../python/pakfire/repository/index.py:394
+#: ../python/pakfire/repository/index.py:395
 #, python-format
 msgid "Loading from %s"
 msgstr ""
 
 #. Add all packages from the database to the index.
-#: ../python/pakfire/repository/index.py:457
+#: ../python/pakfire/repository/index.py:458
 msgid "Loading installed packages"
 msgstr ""
 
index b065d71274a8590b8b061519e22ac41dc377d1d4..47d3c1c1e950374eb49e7e880bd6dc032c5b32a1 100644 (file)
@@ -123,6 +123,10 @@ class Pakfire(object):
 
                        name, version = s.split(pattern, 1)
 
+                       # Trim spaces from strings.
+                       name = name.strip()
+                       version = version.strip()
+
                        return satsolver.Relation(self.pool, name, version, type)
 
                return satsolver.Relation(self.pool, s)
index a17c32d077da3c8d152853a050c785e74bfb2080..9b33694bbf1fa4ad8dae0c2c82b5109132b59b78 100644 (file)
@@ -746,6 +746,18 @@ class Builder(object):
                        "LANG"             : "C",
                }
 
+       def mktemp(self):
+               """
+                       Create a temporary file in the build environment.
+               """
+               file = "/tmp/pakfire_%s" % util.random_string()
+
+               # Touch the file.
+               f = open(file, "w")
+               f.close()
+
+               return file
+
        @property
        def buildroot(self):
                return self.pkg.buildroot
index 877aff2a03970f15c38a121a386365709422de0f..e16ccb14d53375bb06fc863fed7bc0ee2340c658 100644 (file)
@@ -409,23 +409,23 @@ class Package(object):
                        if ret:
                                break
 
-               return ret.split()
+               return ret.splitlines()
 
        @property
        def provides(self):
-               return self.metadata.get("PKG_PROVIDES", "").split()
+               return self.metadata.get("PKG_PROVIDES", "").splitlines()
 
        @property
        def conflicts(self):
-               return self.metadata.get("PKG_CONFLICTS", "").split()
+               return self.metadata.get("PKG_CONFLICTS", "").splitlines()
 
        @property
        def obsoletes(self):
-               return self.metadata.get("PKG_OBSOLETES", "").split()
+               return self.metadata.get("PKG_OBSOLETES", "").splitlines()
 
        @property
        def scriptlets(self):
-               return self.metadata.get("PKG_SCRIPTLETS", "").split()
+               return self.metadata.get("PKG_SCRIPTLETS", "").splitlines()
 
        @property
        def filelist(self):
index 2b9487750ca09d7087ea98787d62845ddbd8b74f..29fb22ba3f280948a4ae17802b34602fba7d619c 100644 (file)
@@ -741,7 +741,7 @@ class FilePackage(Package):
                if not provides:
                        return []
 
-               return provides.split()
+               return provides.splitlines()
 
        @property
        def requires(self):
@@ -753,7 +753,7 @@ class FilePackage(Package):
                if not requires:
                        return []
 
-               return requires.split()
+               return requires.splitlines()
 
        @property
        def prerequires(self):
@@ -765,7 +765,7 @@ class FilePackage(Package):
                if not prerequires:
                        return []
 
-               return prerequires.split()
+               return prerequires.splitlines()
 
        @property
        def obsoletes(self):
@@ -777,7 +777,7 @@ class FilePackage(Package):
                if not obsoletes:
                        return []
 
-               return obsoletes.split()
+               return obsoletes.splitlines()
 
        @property
        def conflicts(self):
@@ -789,7 +789,7 @@ class FilePackage(Package):
                if not conflicts:
                        return []
 
-               return conflicts.split()
+               return conflicts.splitlines()
 
 
 class SourcePackage(FilePackage):
index ba7cbab7663992662d6f948e7b2f740b8ad1cf70..bf57229557efc2feef96b77c6553108b9814791a 100644 (file)
@@ -145,19 +145,19 @@ class DatabasePackage(Package):
 
        @property
        def provides(self):
-               return self.metadata.get("provides", "").split()
+               return self.metadata.get("provides", "").splitlines()
 
        @property
        def requires(self):
-               return self.metadata.get("requires", "").split()
+               return self.metadata.get("requires", "").splitlines()
 
        @property
        def conflicts(self):
-               return self.metadata.get("conflicts", "").split()
+               return self.metadata.get("conflicts", "").splitlines()
 
        @property
        def obsoletes(self):
-               return self.metadata.get("obsoletes", "").split()
+               return self.metadata.get("obsoletes", "").splitlines()
 
        @property
        def hash1(self):
index 9380e3ce5fc1cc8df567b618626101929adf481d..64387885a44c8f6786d31b9344f7e4c08f93a9df 100644 (file)
@@ -270,7 +270,7 @@ class Makefile(MakefileBase):
 
        @property
        def requires(self):
-               return self.lexer.build.get_var("requires", "").split()
+               return self.lexer.build.get_var("requires", "").splitlines()
 
        @property
        def provides(self):
@@ -387,32 +387,48 @@ class MakefilePackage(MakefileBase):
                return None
 
        def track_dependencies(self, builder, path):
-               # Dependency types.
-               dep_types = ("prerequires", "requires", "provides", "conflicts", "obsoletes",)
+               # Build filelist with all files that have been installed.
+               filelist = builder.mktemp()
 
-               result = builder.do("/usr/lib/pakfire/dependency-tracker %s" \
-                       % path, returnOutput=True)
+               try:
+                       f = open(filelist, "w")
+                       for dir, subdirs, files in os.walk(path):
+                               f.write("%s\n" % dir)
 
-               for line in result.splitlines():
-                       m = re.match(r"^(\w+)=(.*)$", line)
-                       if m is None:
-                               continue
+                               for file in files:
+                                       f.write("%s\n" % os.path.join(dir, file))
+                       f.close()
 
-                       key, val = m.groups()
+                       log.info(_("Searching for automatic dependencies for %s...") % self.friendly_name)
 
-                       if not key in dep_types:
-                               continue
+                       # Search for provides.
+                       res = builder.do("/usr/lib/pakfire/find-provides %s %s" \
+                               % (path, filelist), returnOutput=True)
+                       provides = set(res.splitlines())
 
-                       val = val.strip("\"")
-                       val = val.split()
+                       # Search for requires.
+                       res = builder.do("/usr/lib/pakfire/find-requires %s %s" \
+                               % (path, filelist), returnOutput=True)
+                       requires = set(res.splitlines()) - provides
 
-                       self._dependencies[key] = sorted(val)
+               finally:
+                       if os.path.exists(filelist):
+                               os.unlink(filelist)
+
+               self._dependencies["provides"] = provides
+               self._dependencies["requires"] = requires
 
                # Filter dependencies.
-               for key in dep_types:
+               for key in ("prerequires", "requires", "provides", "conflicts", "obsoletes"):
+                       # Make sure this is a list.
+                       try:
+                               self._dependencies[key] = list(self._dependencies[key])
+                       except KeyError:
+                               self._dependencies[key] = []
+
+                       # Filter out unwanted elements.
                        self._dependencies[key] = self.filter_deps(
-                               self._dependencies.get(key, []),
-                               self.lexer.get_var("filter_%s" % key)
+                               self._dependencies[key], self.lexer.get_var("filter_%s" % key)
                        )
 
        @staticmethod
@@ -440,7 +456,7 @@ class MakefilePackage(MakefileBase):
 
        def get_deps(self, key):
                # Collect all dependencies that were set in the makefile by the user.
-               deps = self.lexer.get_var(key).split()
+               deps = self.lexer.get_var(key).splitlines()
 
                # Collect all dependencies that were discovered by the tracker.
                deps += self._dependencies.get(key, [])
index 969254b660057b8c1a3660843867897131f2bcfd..3edf918deecea8d0b11388f92728db7e72a746e5 100644 (file)
@@ -18,8 +18,10 @@ SCRIPTS_SHELL = \
        chroot-shell \
        cleanup \
        compress-man-pages \
-       dependency-tracker \
        extract-debuginfo \
+       find-common \
+       find-provides \
+       find-requires \
        pakfire-multicall.py \
        patch \
        py-compile \
diff --git a/tools/dependency-tracker b/tools/dependency-tracker
deleted file mode 100755 (executable)
index 2023d2b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-dirname=$(dirname ${0})
-
-. ${dirname}/functions-common
-
-args=${1}
-
-if [ -n "${2}" ]; then
-       args=${2}
-fi
-
-provides=$(find_provides ${args})
-requires=""
-for require in $(find_requires ${args}); do
-       listmatch ${require} ${provides} || requires="${requires} ${require}"
-done
-
-echo "requires=\"${requires}\""
-echo "provides=\"${provides}\""
-echo "conflicts=\"${PKG_CONFLICTS}\""
-echo "obsoletes=\"${PKG_OBSOLETES}\""
-
-exit 0
diff --git a/tools/find-common b/tools/find-common
new file mode 100644 (file)
index 0000000..22ce747
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+. ${BASEDIR}/functions-common
+
+# Find marker for 64 bit binaries.
+case "$(uname -m)" in
+       i?86|x86_64)
+               mark64="()(64bit)"
+               ;;
+       *)
+               mark64=""
+               ;;
+esac
diff --git a/tools/find-provides b/tools/find-provides
new file mode 100755 (executable)
index 0000000..1b8f92a
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+# Include functions.
+BASEDIR=$(dirname ${0})
+source ${BASEDIR}/find-common
+
+BUILDROOT=${1}
+FILELIST=${2}
+
+binary_files=
+perl_files=
+pkgconfig_files=
+
+# Walk through all file files and see what we have got here.
+while read file; do
+       case "${file}" in
+               */lib/ld.so)
+                       # Just ignore this file.
+                       ;;
+               *.so*)
+                       binary_files="${binary_files} ${file}"
+                       ;;
+               *.pm)
+                       # This file is a perl module. We check them later.
+                       perl_files="${perl_files} ${file}"
+                       ;;
+               *.pc)
+                       pkgconfig_files="${pkgconfig_files} ${file}"
+                       ;;
+       esac
+done < ${FILELIST}
+
+# Search for SONAMEs in all binary files.
+for file in ${binary_files}; do
+       [ -L ${file} ] && continue
+
+       soname=$(file_get_soname ${file})
+
+       # If the files does not have a SONAME, we will
+       # simply use the basename.
+       if [ -z "${soname}" ]; then
+               if [ -L ${file} ]; then
+                       continue
+               fi
+               soname=$(basename ${file})
+       fi
+
+       if file_is_64bit ${file}; then
+               is_64=true
+               echo "${soname}${mark64}"
+       else
+               is_64=false
+               echo "${soname}"
+       fi
+
+       # Find weak symbol provides.
+       objdump -p ${file} 2>/dev/null | awk '
+               BEGIN { START=0 ; }
+               /Version definitions:/ { START=1; }
+               /^[0-9]/ && (START==1) { print $4; }
+               /^$/ { START=0; }' | \
+                grep -v ${soname} | \
+                while read symbol ; do
+                    echo "${soname}(${symbol})$(${is_64} && echo ${mark64} | sed 's/()//')"
+                done
+done
+
+# Search for perl provides.
+if [ -n "${perl_files}" ] && [ -x /usr/bin/perl ]; then
+       perl ${BASEDIR}/perl.prov ${perl_files} | sort -u
+fi
+
+# pkg-config files.
+pkgconfig=$(which pkg-config)
+
+if [ -n "${pkgconfig}" -a -x "${pkgconfig}" ]; then
+       for file in ${pkgconfig_files}; do
+               # Query the dependencies of the package.
+               ${pkgconfig} --print-provides "${file}" 2> /dev/null | while read n r v ; do
+                       # We have a dependency.  Make a note that we need the pkgconfig
+                       # tool for this package.
+                       echo "pkgconfig(${n}) ${r} ${v}"
+
+                       # The dependency on the pkgconfig package itself.
+                       echo "pkgconfig"
+               done
+       done | sort -u
+fi
+
+exit 0
diff --git a/tools/find-requires b/tools/find-requires
new file mode 100755 (executable)
index 0000000..ddfdb5f
--- /dev/null
@@ -0,0 +1,140 @@
+#!/bin/bash
+
+# Include functions.
+BASEDIR=$(dirname ${0})
+source ${BASEDIR}/find-common
+
+# BUILDROOT is the first argument.
+BUILDROOT=${1}
+FILELIST=${2}
+
+# Determine libdir.
+if [ "$(uname -m)" = "x86_64" ]; then
+       libdir=/usr/lib64
+else
+       libdir=/usr/lib
+fi
+
+binary_files=
+perl_files=
+script_files=
+pkgconfig_files=
+
+# Walk through all file files and see what we have got here.
+while read file; do
+       case "${file}" in
+               *.pc)
+                       # Find all pkg-config files.
+                       pkgconfig_files="${pkgconfig_files} ${file}"
+                       continue
+                       ;;
+               *.pm)
+                       # Find all perl modules.
+                       if [ -r "${file}" ]; then
+                               perl_files="${perl_files} ${file}"
+                               continue
+                       fi
+                       ;;
+
+               # Python
+               */usr/lib*/python*/*)
+                       # Sort out all python files.
+                       ;;
+               */usr/lib*/python*)
+                       # This will only get the python directory.
+                       file=$(basename ${file})
+
+                       # Strip the python version from the string.
+                       python_version="${file#python}"
+
+                       echo "python-abi = ${python_version}"
+                       continue
+                       ;;
+       esac
+
+       # Search for all binary files.
+       if file_is_elf ${file}; then
+               binary_files="${binary_files} ${file}"
+               continue
+       fi
+
+       # Search for script files.
+       if file_is_script ${file}; then
+               script_files="${script_files} ${file}"
+               continue
+       fi
+
+       # Unresolved symlinks.
+       if [ -L "${file}" ]; then
+               # Get destination.
+               link=$(readlink -m ${file})
+
+               # If destination does not exist, make
+               # a dependency for it.
+               if ! [ -e "${link}" ]; then
+                       echo "${link#${BUILDROOT}}"
+               fi
+       fi
+done < ${FILELIST}
+
+# Process script files.
+interpreters=
+for file in ${script_files}; do
+       [ -r ${file} -a -x ${file} ] || continue
+
+       interp=$(head -n 1 ${file} | sed -e 's/^\#\![   ]*//' | cut -d" " -f1)
+       interpreters="${interpreters} ${interp}"
+
+       # Collect all perl files.
+       case ${interp} in
+               */perl)
+                       perl_files="${perl_files} ${file}"
+                       ;;
+       esac
+done
+
+# Output the list of needed interpreters.
+[ -n "${interpreters}" ] && { echo "${interpreters}" | tr '[:blank:]' \\n | sort -u ; }
+
+# Weak symbol versions (from glibc).
+[ -n "${mark64}" ] && mark64="(64bit)"
+for file in ${binary_files}; do
+       [ -r ${file} ] || continue
+
+       lib64=$(if file_is_64bit ${file}; then echo "${mark64}"; fi)
+       objdump -p ${file} | awk 'BEGIN { START=0; LIBNAME=""; }
+               /^$/ { START=0; }
+               /^Dynamic Section:$/ { START=1; }
+               (START==1) && /NEEDED/ {
+                       if ("'${lib64}'" != "") {
+                               sub(/$/, "()'${lib64}'", $2);
+                       }
+                       print $2;
+               }
+               (START==2) && /^[A-Za-z]/ { START=3; }
+               /^Version References:$/ { START=2; }
+               (START==2) && /required from/ {
+                       sub(/:/, "", $3);
+                       LIBNAME=$3;
+               }
+               (START==2) && (LIBNAME!="") && ($4!="") {
+                       print LIBNAME "(" $4 ")'${lib64}'";
+               }'
+done | sort -u
+
+# Search for perl requires.
+if [ -n "${perl_files}" ] && [ -x /usr/bin/perl ]; then
+       perl ${BASEDIR}/perl.req ${perl_files} | sort -u
+fi
+
+# Search for pkg-config requires.
+pkgconfig=$(which pkg-config)
+if [ -n "${pkgconfig}" -a -x "${pkgconfig}" ]; then
+       for file in ${pkgconfig_files}; do
+               ${pkgconfig} --print-requires --print-requires-private "${file}" 2> /dev/null | while read n r v ; do
+                       echo "pkgconfig(${n})" "${r}" "${v}"
+               done
+       done
+fi
+
+exit 0
index 6f4d6a3c73f86040d240d46538a05970e4180772..b721ea0e02d035bca5c7bbe04c24ce6b36eaee24 100644 (file)
@@ -14,9 +14,14 @@ function file_is_elf() {
 function file_is_script() {
        local file=${1}
 
-       local first_line=$(head -n1 ${file})
+       file ${file} | egrep -q ":.* (commands|script) "
+}
+
+# Check if file is an 64-bit binary.
+function file_is_64bit() {
+       local file=${1}
 
-       [ "${first_line:0:2}" = "#!" ]
+       file -L ${file} 2>/dev/null | grep -q "ELF 64-bit"
 }
 
 # Get the interpreter of a file.
@@ -80,8 +85,10 @@ function file_is_static() {
 function file_get_needed() {
        local file=${1}
 
-       readelf -d ${file} | grep NEEDED | \
-               tr -d "[]" | awk '{ print $NF }'
+       local out=$(readelf -d ${file} | grep NEEDED | \
+               tr -d "[]" | awk '{ print $NF }')
+
+       echo "${out}$(file_is_64bit ${file})"
 }
 
 # Get RPATH from a file.
@@ -104,8 +111,7 @@ function file_get_soname() {
                return
        fi
 
-       readelf -d ${file} | grep SONAME | \
-               tr -d "[]" | awk '{ print $NF }'
+       objdump -p ${file} 2>/dev/null | awk '/SONAME/ { print $2 }'
 }
 
 # Check if a file is a shared object.
diff --git a/tools/functions-packager-find b/tools/functions-packager-find
deleted file mode 100644 (file)
index 0e50985..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/bin/bash
-
-# A function that finds needed libraries and interpreters.
-#
-function find_requires() {
-       local dir
-       local dirs=$@
-
-       # Find interpreters of all files in the dirs and skip those we provide
-       # ourself.
-       local interpreter
-       local interpreters
-       for interpreter in $(find_interpreters ${dirs}); do
-               local found=0
-               for dir in ${dirs}; do
-                       if [ -e "${dir}/${interpreter}" ]; then
-                               found=1
-                               break
-                       fi
-               done
-
-               [ "${found}" = "0" ] && interpreters="${interpreters} ${interpreter}"
-       done
-
-       # Find NEEDED libs and add them to a list if they are not provided by any
-       # other file in dirs.
-       local neededs
-       for file in $(find_elf_files ${dirs}); do
-               for needed in $(file_get_needed ${file}); do
-                       neededs="${neededs} ${needed}"
-               done
-       done
-
-       # Find all symlink destinations
-       local links=$(find_symlink_destinations ${dirs})
-
-       # Others
-       local others=$(find_python_requires ${dirs})
-       others="${others} $(find_weak_symbols_requires ${dirs})"
-       others="${others} $(find_perl_requires ${dirs})"
-       others="${others} $(find_pkgconfig_requires ${dirs})"
-
-       # Return a sorted and unique(!) list
-       local require
-       local requires
-       for require in $(listsort ${PKG_DEPS} ${interpreters} ${neededs} ${links} ${others}); do
-               [ "${require:0:3}" = "ld-" ] && continue
-
-               requires="${requires} ${require}"
-       done
-
-       echo ${requires}
-}
-
-function find_provides() {
-       local dirs=$@
-
-       local file
-       local sonames
-       for file in $(find_elf_files ${dirs}); do
-               sonames="${sonames} $(file_get_soname ${file})"
-       done
-       sonames=$(listsort ${sonames})
-
-       # Others
-       local others=$(find_python_provides ${dirs})
-       others="${others} $(find_weak_symbols_provides ${dirs})"
-       others="${others} $(find_perl_provides ${dirs})"
-       others="${others} $(find_pkgconfig_provides ${dirs})"
-
-       local provide
-       local provides
-       for provide in $(listsort ${PKG_PROVIDES} ${sonames} ${others}); do
-               provides="${provides} ${provide}"
-       done
-
-       echo ${provides}
-}
-
-function find_interpreters() {
-       local dirs=$@
-
-       log DEBUG "Searching for interpreters in ${dirs}"
-
-       local file
-       local interpreter
-       local interpreters
-       for file in $(find ${dirs} -type f 2>/dev/null); do
-               # Get interpreter information from file.
-               interpreter=$(file_get_interpreter ${file})
-
-               # Skip the file silently if the result was empty.
-               [ -z "${interpreter}" ] && continue
-
-               # Skip invalid interpreters that don't start with a slash.
-               if [ "${interpreter:0:1}" != "/" ]; then
-                       log WARNING "Skipping invalid interpreter \"${interpreter}\" from \"${file}\"."
-                       continue
-               fi
-
-               if ! listmatch ${interpreter} ${INTERPRETERS_TO_BE_SKIPPED}; then
-                       interpreters="${interpreters} ${interpreter}"
-               fi
-       done
-
-       interpreters=$(listsort ${interpreters})
-
-       log DEBUG "find_interpreters ${dirs}: ${interpreters}"
-
-       echo "${interpreters}"
-}
-
-# Find the destinations of all symlinks and adds a dependency for that.
-#
-function find_symlink_destinations() {
-        local dir=$@
-
-        local link
-        local links
-        for link in $(find ${dir} -type l 2>/dev/null); do
-                link="$(readlink -m ${link})"
-                [ -e "${link}" ] && continue
-
-                link="${link#${dir}}"
-                links="${links} ${link}"
-        done
-
-        echo ${links}
-}
-
-function find_python_provides() {
-       local dir=${1}
-
-       local file
-       for file in $(find ${dir}/usr/bin/python* 2>/dev/null); do
-               file=$(basename ${file})
-               file=${file#python}
-
-               if [ -n "${file}" ]; then
-                       echo "python-api=${file}"
-               fi
-       done
-}
-
-function find_python_requires() {
-       local dir=${1}
-
-       local file
-       for file in $(find ${dir}/usr/lib -maxdepth 1 2>/dev/null); do
-               file=$(basename ${file})
-
-               if [ "${file:0:6}" = "python" ]; then
-                       file=${file#python}
-
-                       if [ -n "${file}" ]; then
-                               echo "python-api=${file}"
-                       fi
-               fi
-       done
-}
-
-function find_perl_files() {
-       local extension
-       for extension in pm pl; do
-               find $@ -name "*.${extension}" 2>/dev/null
-       done
-}
-
-function find_perl_provides() {
-       [ -x "/usr/bin/perl" ] || return 0
-       perl ${BASEDIR}/perl.prov $(find_perl_files $@) | sort -u
-}
-
-function find_perl_requires() {
-       [ -x "/usr/bin/perl" ] || return 0
-       perl ${BASEDIR}/perl.req $(find_perl_files $@) | sort -u
-}
-
-function find_pkgconfig_provides() {
-       [ -x "/usr/bin/pkg-config" ] || return 0
-       find $@ | ${BASEDIR}/pkg-config.prov
-}
-
-function find_pkgconfig_requires() {
-       [ -x "/usr/bin/pkg-config" ] || return 0
-       find $@ | ${BASEDIR}/pkg-config.req
-}
-
-function find_weak_symbols_provides() {
-       local dirs=$@
-
-       local file
-       local soname
-       local symbol
-       for file in $(find_elf_files ${dirs}); do
-               soname=$(file_get_soname ${file})
-               [ -z "${soname}" ] && continue
-
-               for symbol in $(objdump -p ${file} | grep -E "^[0-9]+" | awk '{ print $4 }'); do
-                       [ "${symbol}" = "${soname}" ] && continue
-                       [ "${symbol}" = "GLIBC_PRIVATE" ] && continue
-
-                       echo "${soname}(${symbol})"
-               done
-       done | sort -u
-}
-
-function find_weak_symbols_requires() {
-       local dirs=$@
-
-       local file
-       for file in $(find_elf_files ${dirs}); do
-           objdump -p ${file} | awk 'BEGIN { START=0; LIBNAME=""; }
-                       /^$/ { START=0; }
-                       /^Dynamic Section:$/ { START=1; }
-                       (START==1) && /NEEDED/ {
-                               print $2;
-                       }
-                       (START==2) && /^[A-Za-z]/ { START=3; }
-                       /^Version References:$/ { START=2; }
-                       (START==2) && /required from/ {
-                           sub(/:/, "", $3);
-                           LIBNAME=$3;
-                       }
-                       (START==2) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) {
-                           print LIBNAME "(" $4 ")";
-                       }'
-       done | grep -v "GLIBC_PRIVATE" | sort -u
-}
diff --git a/tools/pkg-config.prov b/tools/pkg-config.prov
deleted file mode 100755 (executable)
index 2ef9b3c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-pkgconfig=${1:-/usr/bin/pkg-config}
-test -x $pkgconfig || exit 0
-while read filename ; do
-case "${filename}" in
-*.pc)
-       # Assume that this file doesn't contain useful information.
-       needs_pkgconfig=false
-       # Query the dependencies of the package.
-       $pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
-               # We have a dependency.  Make a note that we need the pkgconfig
-               # tool for this package.
-               echo "pkgconfig($n)$r$v"
-               needs_pkgconfig=true
-       done
-       # The dependency on the pkgconfig package itself.
-       if $needs_pkgconfig ; then
-               echo pkgconfig
-       fi
-       ;;
-esac
-done
diff --git a/tools/pkg-config.req b/tools/pkg-config.req
deleted file mode 100755 (executable)
index edb8bce..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-pkgconfig=${1:-/usr/bin/pkg-config}
-test -x $pkgconfig || exit 0
-while read filename ; do
-case "${filename}" in
-*.pc)
-       $pkgconfig --print-requires "$filename" 2> /dev/null | while read n r v ; do
-               echo "pkgconfig($n)$r$v"
-       done
-esac
-done