diff --git a/misc/scripts/build.sh b/misc/scripts/build.sh index 38969266a..3e00e80c9 100755 --- a/misc/scripts/build.sh +++ b/misc/scripts/build.sh @@ -380,6 +380,36 @@ function is_builddep_arch() { fi } +# This function is used to undo a raw repo URL into its base components. +# It is sort of flawed because for self-hosted instances, it might not catch the name that it needs +# in order to parse, and if that eventually comes up, we'll deal with it then. +function parse_repo_unraw() { + { ignore_stack=false; set -o pipefail; trap stacktrace ERR RETURN; } + local rep="${1}" + case "${rep}" in + *"githubusercontent"*) + pURL="${rep/'raw.githubusercontent.com'/'github.com'}" + pURL="${pURL%/*}" + export pURL pBRANCH="${rep##*/}" pISSUES="${pURL}/issues" branch="yes" + ;; + *"gitlab"*) + pURL="${rep%/-/raw/*}" + export pURL pBRANCH="${rep##*/-/raw/}" pISSUES="${pURL}/-/issues" branch="yes" + ;; + *"git.sr.ht"*) + pURL="${rep%/blob*}" + export pURL pBRANCH="${rep##*/}" pISSUES="https://lists.sr.ht/~${pURL#*~}" branch="yes" + ;; + *"codeberg"*) + pURL="${rep%raw/branch/*}" + export pURL pBRANCH="${rep##*/}" pISSUES="${pURL}/issues" branch="yes" + ;; + *) + export pURL="$rep" branch="no" + ;; + esac +} + function makedeb() { { ignore_stack=false; set -o pipefail; trap stacktrace ERR RETURN; } # It looks weird for it to say: `Packaging foo as foo` @@ -418,6 +448,15 @@ function makedeb() { deblog "Priority" "${priority:-optional}" fi + if [[ -n ${bugs} ]]; then + deblog "Bugs" "${bugs}" + else + parse_repo_unraw "$REPO" + if [[ -n ${pISSUES} ]]; then + deblog "Bugs" "${pISSUES}" + fi + fi + if [[ $pacname == *-git ]]; then parse_source_entry "${source[0]}" # shellcheck disable=SC2031 @@ -871,24 +910,7 @@ function meta_log() { { ignore_stack=false; set -o pipefail; trap stacktrace ERR RETURN; } # Origin repo info parsing if [[ ${local} == "no" ]]; then - # shellcheck disable=SC2153 - case $REPO in - *"github"*) - pURL="${REPO/'raw.githubusercontent.com'/'github.com'}" - pURL="${pURL%/*}" - pBRANCH="${REPO##*/}" - branch="yes" - ;; - *"gitlab"*) - pURL="${REPO%/-/raw/*}" - pBRANCH="${REPO##*/-/raw/}" - branch="yes" - ;; - *) - pURL="$REPO" - branch="no" - ;; - esac + parse_repo_unraw "$REPO" fi # Metadata writing diff --git a/misc/scripts/checks.sh b/misc/scripts/checks.sh index 95c7295a5..fe3cd806a 100755 --- a/misc/scripts/checks.sh +++ b/misc/scripts/checks.sh @@ -659,6 +659,18 @@ function lint_mask() { { ignore_stack=true; return "${ret}"; } } +function lint_bugs() { + { ignore_stack=false; set -o pipefail; trap stacktrace ERR RETURN; } + local ret=0 + if [[ -n ${bugs} ]]; then + if [[ ${bugs} != *"://"* ]]; then + fancy_message error "'bugs' is improperly formatted" + ret=1 + fi + fi + { ignore_stack=true; return "${ret}"; } +} + function lint_priority() { { ignore_stack=false; set -o pipefail; trap stacktrace ERR RETURN; } shopt -s extglob @@ -700,7 +712,7 @@ function lint_license() { function checks() { { ignore_stack=false; set -o pipefail; trap stacktrace ERR RETURN; } - local ret=0 check linting_checks=(lint_pacname lint_gives lint_pkgrel lint_epoch lint_version lint_source lint_pkgdesc lint_maintainer lint_deps lint_ppa lint_relations lint_fields lint_hash lint_incompatible lint_arch lint_mask lint_priority lint_license) + local ret=0 check linting_checks=(lint_pacname lint_gives lint_pkgrel lint_epoch lint_version lint_source lint_pkgdesc lint_maintainer lint_deps lint_ppa lint_relations lint_fields lint_hash lint_incompatible lint_arch lint_mask lint_priority lint_license lint_bugs) for check in "${linting_checks[@]}"; do "${check}" || ret=1 done diff --git a/pacstall b/pacstall index 930325921..1c0545a08 100755 --- a/pacstall +++ b/pacstall @@ -185,7 +185,7 @@ function decl_scriptvars() { pacstallvars=(pkgbase pkgname repology pkgver git_pkgver epoch source_url source depends makedepends checkdepends conflicts breaks replaces gives pkgdesc hash optdepends ppa arch maintainer pacdeps NOBUILDDEP provides incompatible compatible srcdir url backup pkgrel mask pac_functions repo priority noextract nosubmodules _archive license - bwrapenv safeenv external_connection enhances recommends custom_fields makeconflicts checkconflicts) + bwrapenv safeenv external_connection enhances recommends custom_fields makeconflicts checkconflicts bugs) mapfile -t distros < <(awk -F ',' -v current_date="$(date +'%Y-%m-%d')" ' BEGIN { is_first = 1