diff options
-rwxr-xr-x | bin/show-dependencies | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/bin/show-dependencies b/bin/show-dependencies index 65aca79..58a0241 100755 --- a/bin/show-dependencies +++ b/bin/show-dependencies @@ -303,50 +303,48 @@ for target_package in "$@"; do sort -k2,3 | \ sponge "${tmp_dir}/knots" - if [ "${target_package}" != 'ALL-build-list' ]; then - - mkdir "${tmp_dir}/neighbours" - cat "${tmp_dir}/knots" "${tmp_dir}/build-order" | \ - awk '{ - print $1 " " $2 > "'"${tmp_dir}/neighbours/"'"$1; - print $1 " " $2 > "'"${tmp_dir}/neighbours/"'"$2; - }' - - find "${tmp_dir}/neighbours" -maxdepth 1 -type f | \ - while read -r file; do - sed " - s@\(^\| \)$(str_to_regex "${file##*/}")\( \|\$\)@\1<knot>\2@ - " "${file}" | \ - sort -u | \ - sponge "${file}" - done - - find "${tmp_dir}/neighbours" -maxdepth 1 -type f -exec \ - sha512sum {} \; | \ - sed 's|^\(\S\+\) .*/\([^/]\+\)$|\2 \1|' | \ - sort -k2,2 | \ - uniq -f1 -D | \ - awk '{print $2 " " $1}' > \ - "${tmp_dir}/sums" - - rm -rf --one-file-system "${tmp_dir}/neighbours" - - sed ' - :a - $!N - s|^\(\S\+\) \([^\n]\+\)\n\1 |\1 \2<nl>| - ta - P - D - ' "${tmp_dir}/sums" | \ - join -1 1 -2 1 -o 2.2,1.2 - "${tmp_dir}/sums" | \ - while read -r original replacement; do - sed -i " - s@\( \|^\)$(str_to_regex "${original}")\( \|\$\)@\1${replacement}\2@ - " "${tmp_dir}/build-order" "${tmp_dir}/knots" + mkdir "${tmp_dir}/neighbours" + cat "${tmp_dir}/knots" "${tmp_dir}/build-order" | \ + awk '{ + print $1 " " $2 > "'"${tmp_dir}/neighbours/"'"$1; + print $1 " " $2 > "'"${tmp_dir}/neighbours/"'"$2; + }' + + find "${tmp_dir}/neighbours" -maxdepth 1 -type f | \ + while read -r file; do + sed " + s@\(^\| \)$(str_to_regex "${file##*/}")\( \|\$\)@\1<knot>\2@ + s@\(^\| \)$(str_to_regex "${file##*/}")\( \|\$\)@\1<knot>\2@ + " "${file}" | \ + sort -u | \ + sponge "${file}" done - fi + find "${tmp_dir}/neighbours" -maxdepth 1 -type f -exec \ + sha512sum {} \; | \ + sed 's|^\(\S\+\) .*/\([^/]\+\)$|\2 \1|' | \ + sort -k2,2 | \ + uniq -f1 -D | \ + awk '{print $2 " " $1}' > \ + "${tmp_dir}/sums" + + rm -rf --one-file-system "${tmp_dir}/neighbours" + + sed ' + :a + $!N + s|^\(\S\+\) \([^\n]\+\)\n\1 |\1 \2<nl>| + ta + P + D + ' "${tmp_dir}/sums" | \ + join -1 1 -2 1 -o 2.2,1.2 - "${tmp_dir}/sums" | \ + while read -r original replacement; do + sed -i " + s@\( \|^\)$(str_to_regex "${original}")\( \|\$\)@\1${replacement}\2@ + s@\( \|^\)$(str_to_regex "${original}")\( \|\$\)@\1${replacement}\2@ + " "${tmp_dir}/build-order" "${tmp_dir}/knots" + done grep -v '^\(\S\+\) \1$' "${tmp_dir}/build-order" | \ sort -u | \ |