Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # This scripts checks the given list of packages if they have
- # reverse dependencies (i.e. there are packages which depends on them).
- # Dependencies that are on the list are excluded.
- #
- # Usage: $0 LIST
- set -eu
- SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
- find_revdeps() {
- local pkgname="$1"
- local excludes="$2"
- "$SCRIPT_DIR"/abuild-revdeps $pkgname \
- | xargs -I% "$SCRIPT_DIR"/abuild-origin % \
- | grep -vFf "$excludes" \
- | sort | uniq
- }
- has_maintainer() {
- local pkgname="$1"
- local abuild="$pkgname/APKBUILD"
- if [ -f "$abuild" ]; then
- grep -qE '# Maintainer: *\w+' "$abuild"
- else
- echo "ERROR: $abuild does not exist!" >&2
- fi
- }
- mark_unmaintained() {
- local pkg; for pkg in $@; do
- if has_maintainer $pkg; then
- printf "%s " $pkg
- else
- printf "%s* " $pkg
- fi
- done
- }
- pkglist="$1"
- echo '# PKGNAME <- list of packages that (make)depends on PKGNAME' >&2
- cat "$pkglist" | while read pkgname; do
- revdeps="$(find_revdeps "$pkgname" "$pkglist")"
- if [ -n "$revdeps" ]; then
- printf "%s <- %s\n" "$pkgname" "$(mark_unmaintained $revdeps)"
- fi
- done
- echo ''
- echo '* package without a maintainer' >&2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement