From baa3e640cd1ffe7a3f2698ded8e86cfce9e82c47 Mon Sep 17 00:00:00 2001 From: Alad Wenter Date: Thu, 9 Nov 2023 16:23:18 +0100 Subject: [PATCH] repo: prefix pacman config in errors Fixup for 1f9f41093ab4c51b3be2d248994b509e232ad050 --- lib/aur-repo | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/aur-repo b/lib/aur-repo index ecbeac33..4b319f99 100755 --- a/lib/aur-repo +++ b/lib/aur-repo @@ -122,11 +122,18 @@ while read -r key _ value; do done < <(pacman-conf "${conf_args[@]}") wait $! || exit +# prefix error messages with pacman.conf (#1118) +if [[ -v pacman_conf ]]; then + err_prefix="$argv0: $pacman_conf" +else + err_prefix="$argv0" +fi + # list information on available local repositories case $list in path|repo) if ! [[ ${!conf_file_path[*]} ]]; then - printf >&2 '%s: no file:// repository configured\n' "$argv0" + printf >&2 '%s: no file:// repository configured\n' "$err_prefix" exit 2 fi ;;& path) @@ -150,10 +157,10 @@ if [[ ! $db_name ]]; then 1) db_root=${conf_file_serv[${conf_file_repo[0]}]} db_name=${conf_file_repo[0]} ;; - 0) printf >&2 '%s: no file:// repository configured\n' "$argv0" + 0) printf >&2 '%s: no file:// repository configured\n' "$err_prefix" exit 2 ;; - *) printf >&2 '%s: repository choice is ambiguous (use -d to specify)\n' "$argv0" + *) printf >&2 '%s: repository choice is ambiguous (use -d to specify)\n' "$err_prefix" for db in "${conf_file_repo[@]}"; do printf '%q\t%q\n' "$db" "${conf_file_path[$db]}" @@ -164,12 +171,7 @@ if [[ ! $db_name ]]; then # check $db_name is a configured pacman repository (local or remote, #1113) elif ! [[ ${conf_sync_serv[$db_name]} ]]; then - # disambiguate used pacman.conf (#1118) - if [[ -v pacman_conf ]]; then - printf >&2 "%s: %q: repository %q not configured\n" "$argv0" "$pacman_conf" "$db_name" - else - printf >&2 "%s: repository %q not configured\n" "$argv0" "$db_name" - fi + printf >&2 "%s: repository %q not configured\n" "$err_prefix" "$db_name" exit 2 fi -- 2.11.4.GIT