pkgmeek: reduced the chance of false positives when identifying git urls

This commit is contained in:
John McQuah 2022-06-23 13:58:54 -04:00
parent 46ded7d692
commit c67a446cbb

View File

@ -367,7 +367,7 @@ fetch_url() {
[ -x "$PKGMK_GIT_COMMAND" ] || PKGMK_GIT_COMMAND="/bin/false"
# Is this a url that requires git?
if [[ $u =~ ^(https|http|ssh|git)://.*/(.+)\.git(.*)$ ]]; then
if [[ $u =~ ^(https|http|ssh|git)://.+/(.+)\.git($|#.*) ]]; then
# Did the port maintainer specify a branch other than 'master'?
tag=${BASH_REMATCH[3]#\#}; gitsrc="${u%.git*}.git"
[ -z "$tag" ] || CLONE_ARGS="--branch $tag"
@ -397,8 +397,7 @@ fetch_url() {
# start with the mirrors defined in pkgmk.conf, then go to the url found in the Pkgfile
while [ $m -le ${#PKGMK_SOURCE_MIRRORS[@]} ] && [ $finished = 0 ] && [[ ! $SAVE_AS =~ false$ ]]; do
[ "${PKGMK_SOURCE_MIRRORS[m]}" = "" ] && um=$u || \
{ REPO=$(echo ${PKGMK_SOURCE_MIRRORS[m]} | sed 's,/$,,');
um=$REPO/$(echo $u | sed 's,.*/,,'); }
{ REPO=${PKGMK_SOURCE_MIRRORS[m]%/}; um=$REPO/${u##*/}; }
m=$(( m+1 ))
# interrupted downloads from a previous run should be put where wget or curl will find them