diff options
Diffstat (limited to 'src/pkgbuild-check-nonfree')
-rwxr-xr-x | src/pkgbuild-check-nonfree | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree index ccc846b..6bec280 100755 --- a/src/pkgbuild-check-nonfree +++ b/src/pkgbuild-check-nonfree @@ -5,7 +5,7 @@ # Copyright (C) 2011 Joseph Graham (Xylon) <joe@t67.eu> # Copyright (C) 2010-2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com> # Copyright (C) 2010-2012 Nicolás Reynolds <fauno@parabola.nu> -# Copyright (C) 2012-2013, 2017 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2012-2013, 2017, 2024 Luke Shumaker <lukeshu@parabola.nu> # # License: GNU GPLv3+ # @@ -57,7 +57,11 @@ usage() { echo flag '-h' 'Show this message' } -# Make sure these match pkgbuild-summarize-nonfree + +# Make sure these match: +# - the usage() text above +# - pkgbuild-summarize-nonfree +# - pkgbuild-check-nonfree.bats declare -ri _E_OK=0 declare -ri _E_ERROR=1 declare -ri _E_LIC_UNKNOWN=2 @@ -217,15 +221,29 @@ check_dep() { # Checks for ${pkgname} in the blacklist check_pkg() { [[ $# == 1 ]] || panic 'malformed call to check_pkg' - check_dep "$@" - case $? in - $_E_OK) - return $_E_OK;; - $_E_DEP_NONFREE) - return $_E_PKG_NONFREE;; - *) - panic 'unexpected return code from check_dep';; - esac + local pkg=$1 + + local line rep + line="$(blacklist-cat|blacklist-lookup "$pkg")" + rep="$(blacklist-get-rep <<<"$line")" + if [[ -z $line ]]; then + # not mentioned in blacklist; free + info '%s: not blacklisted' "$pkg" + return $_E_OK + elif [[ -z $rep ]]; then + # non-free with no replacement + plain '%s: blacklisted' "$pkg" + return $_E_PKG_NONFREE + else + # non-free with free replacement + if [[ "$rep" == "$pkg" ]]; then + info '%s: repackaged with the same name' "$pkg" + return $_E_OK + else + info '%s: replaced by %s (update blacklist.txt first if you would like to repackage it with the same name)' "$pkg" "$rep" + return $_E_PKG_NONFREE + fi + fi panic 'code should never be reached' } |