]> git.ipfire.org Git - people/stevee/pakfire.git/blobdiff - tools/find-requires
debugedit: Recognize .debug_macro section.
[people/stevee/pakfire.git] / tools / find-requires
index fb5721ac32f63087cf57af2265c1269d7335ec2a..1f49dabea905302b04c934460c75ef2976ba9c4d 100755 (executable)
@@ -23,6 +23,19 @@ pkgconfig_files=
 # Walk through all file files and see what we have got here.
 while read file; do
        case "${file}" in
+               */usr/lib/debug/*|*/usr/src/debug/*)
+                       # Skip all debuginfo files.
+                       continue
+                       ;;
+               */usr/lib*/gconv/*)
+                       # Skip all gconv files.
+                       continue
+                       ;;
+               *.ko)
+                       # Skip all kernel modules because they do not
+                       # require anything at all.
+                       continue
+                       ;;
                *.pc)
                        # Find all pkg-config files.
                        pkgconfig_files="${pkgconfig_files} ${file}"
@@ -39,31 +52,22 @@ while read file; do
                # Python
                */usr/lib*/python*/*)
                        # Sort out all python files.
+                       # Directories are processed bewlow.
                        ;;
-               */usr/lib*/python*)
+               */usr/lib/python*|*/usr/lib64/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}"
+                       if [ -n "${python_version}" ]; then
+                               echo "python-abi = ${python_version}"
+                       fi
                        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.
@@ -74,6 +78,22 @@ while read file; do
                if ! [ -e "${link}" ]; then
                        echo "${link#${BUILDROOT}}"
                fi
+
+               # Don't search for anything else, because
+               # symlinks do not require anything but the target file.
+               continue
+       fi
+
+       # 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
 done < ${FILELIST}
 
@@ -98,8 +118,15 @@ done
 
 # Search for binary interpreters.
 for file in ${binary_files}; do
-       # Just print the interpreter.
-       file_get_elf_interpreter ${file}
+       # Get the interpreter.
+       interp=$(file_get_elf_interpreter ${file})
+
+       # Skip the interpreter if it is provided by this
+       # package.
+       [ -e "${BUILDROOT}${interp}" ] && continue
+
+       # Print the interpreter.
+       echo "${interp}"
 done | sort -u
 
 # Weak symbol versions (from glibc).
@@ -137,6 +164,9 @@ fi
 pkgconfig=$(which pkg-config)
 if [ -n "${pkgconfig}" -a -x "${pkgconfig}" ]; then
        for file in ${pkgconfig_files}; do
+               # The dependency for the pkgconfig package itself.
+               echo "pkgconfig"
+
                ${pkgconfig} --print-requires --print-requires-private "${file}" 2> /dev/null | while read n r v ; do
                        echo "pkgconfig(${n})" "${r}" "${v}"
                done