From 23c99ca8e349a429774193b3b5513cba9c4daab3 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Sat, 4 Jun 2022 17:37:56 -0500 Subject: scripts/deplist: factor for clearer error messages. --- scripts/deplist | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'scripts/deplist') diff --git a/scripts/deplist b/scripts/deplist index 54e5b3275..f960044c1 100755 --- a/scripts/deplist +++ b/scripts/deplist @@ -37,15 +37,28 @@ done parent () { a=$("${HERE}"/sgrep " ${1} " "${HERE}"/.index | cut -d' ' -f2 | xargs); - if test -n "${a}"; then + if ! test -z "${a}"; then r=${a}; else b=$(grep " ${1} " "${HERE}"/.index | cut -d' ' -f2 | xargs); - r=${b}; + if ! test -z "${b}"; then + r=${b}; + else + r=${1}; + fi fi printf "%s" "${r}"; } +## +# Prints a fatal error and exits. +# +nxdepf () +{ + printf "E: dependency '%s' not found or excepted (needed by '%s')\n" "${1}" "${2}" 1>&2; + exit 1; +} + ## # Do everything at once. # @@ -152,8 +165,7 @@ EOF case "${repo}" in system) # nothing in system may depend on anything outside of system if ! test -f "${BASE}/${repo}/${_d}/APKBUILD"; then - printf "E: dependency '%s' not found or excepted\n" "${_d}" 1>&2; - exit 1; + nxdepf "${_d}" "${p}"; fi path="${repo}/${_d}"; ;; @@ -162,8 +174,7 @@ EOF if test -f "${BASE}/system/${_d}/APKBUILD"; then path="system/${_d}"; else - printf "E: dependency '%s' not found or excepted\n" "${_d}" 1>&2; - exit 1; + nxdepf "${_d}" "${p}"; fi else path="${repo}/${_d}"; -- cgit v1.2.3-60-g2f50