Skip to content

Instantly share code, notes, and snippets.

@prurigro
Created November 14, 2014 06:00
Show Gist options
  • Save prurigro/69919a291debf9cb45c5 to your computer and use it in GitHub Desktop.
Save prurigro/69919a291debf9cb45c5 to your computer and use it in GitHub Desktop.
(Arch Linux) Small demo to play with ideas surrounding how linked library updates might be traced back to packages needing to be rebuilt
#!/usr/bin/env bash
function recursive_ldd() {
for file in "$(find . -type f -exec file '{}' \; | grep 'dynamically linked')"; do sed 's|:.*||' <<< "$file"; done
}
function find_libs() {
ldd $(recursive_ldd) \
| sed '/^[^ ]*:$/d;s|^ *||' \
| grep -o -e '/[^ ]*' \
| sort -u
}
function find_pkgs() {
for library in $(find_libs); do
pacman -Qo "$library" \
| sed 's|^.*owned by ||;s| .*$||'
done | sort -u
}
find_pkgs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment