summaryrefslogtreecommitdiff
path: root/scripts/deplist
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2022-06-04 17:37:56 -0500
committerZach van Rijn <me@zv.io>2022-06-04 17:37:56 -0500
commit23c99ca8e349a429774193b3b5513cba9c4daab3 (patch)
tree928d1c31df58b2787cb9b4f59232f71cb7b5e603 /scripts/deplist
parent4cc81c01e16ed3ffd6e005881667b95e945156af (diff)
downloadpackages-23c99ca8e349a429774193b3b5513cba9c4daab3.tar.gz
packages-23c99ca8e349a429774193b3b5513cba9c4daab3.tar.bz2
packages-23c99ca8e349a429774193b3b5513cba9c4daab3.tar.xz
packages-23c99ca8e349a429774193b3b5513cba9c4daab3.zip
scripts/deplist: factor for clearer error messages.
Diffstat (limited to 'scripts/deplist')
-rwxr-xr-xscripts/deplist23
1 files changed, 17 insertions, 6 deletions
diff --git a/scripts/deplist b/scripts/deplist
index 54e5b3275..f960044c1 100755
--- a/scripts/deplist
+++ b/scripts/deplist
@@ -37,16 +37,29 @@ 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.
#
for repo in ${@}; do
@@ -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}";