functions.sh: APORTSDIR has subpar defaults and does not detect in a lot of cases
.rootbld_repositories (used in rootbld or during bootstrapping), is set from $repo_template
, and that is sourced from:
repo_template=$aportsgit/$repo/.rootbld-repositories
where $aportsgit
is:
APORTSDIR=${_APORTSDIR-$APORTSDIR}
gitbase=$(git rev-parse --show-toplevel 2>/dev/null) || true # already is -P
if [ -d "$APORTSDIR" ]; then
APORTSDIR=$(cd "$APORTSDIR"; pwd -P)
elif [ -z "$APORTSDIR" ] && [ -d "$HOME/aports" ]; then
APORTSDIR=$(cd "$HOME/aports"; pwd -P)
else
if [ -n "$gitbase" ]; then
case $(git remote get-url origin) in
# '.git' for SSH URLs, and no suffix for HTTPS URLs
*/aports|*/aports.git) APORTSDIR=$gitbase ;;
*) APORTSDIR= ;;
esac
else
APORTSDIR=
fi
fi
this fails to detect anything that has a trailing slash (for instance a url such as https://gitlab.alpinelinux.org/ alpine/aports.git/
).
since we already check for a manual setting, and for $HOME/aports
, etc.. perhaps it makes sense to simply set it to $gitbase as a fallback instead of checking the remotes at all? this also prevents it from working in custom third party repos, because those usually don't have 'aports' in their urls, and it's annoying to need to export APORTSDIR all the time.