From c67a446cbbac8a29d6baf8d20fae75e203149b19 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Thu, 23 Jun 2022 13:58:54 -0400 Subject: [PATCH] pkgmeek: reduced the chance of false positives when identifying git urls --- scripts/pkgmeek | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/pkgmeek b/scripts/pkgmeek index 992e24f..18c9c77 100755 --- a/scripts/pkgmeek +++ b/scripts/pkgmeek @@ -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