pkgmeek: add some pattern-matching functions

(for better pkgmk compatibility)
This commit is contained in:
John McQuah 2023-11-16 23:56:53 +00:00
parent 9f5096eb27
commit 79dbac7647

View File

@ -349,6 +349,21 @@ check_pkg_mtime() { # can be called even if some sources are missing
[ "$PKGMK_MTIME_ONLY" = "yes" ] && info "$msg"; return $utd
}
get_basename() {
echo "${1##*/}"
}
get_filename() {
local ABSOLUTE=""
[ "$1" = "-a" ] && { ABSOLUTE=1; shift; }
if [[ $1 =~ ^(http|https|ftp|file)://.*/(.+) ]]; then
echo "$PKGMK_SOURCE_DIR/${BASH_REMATCH[2]}"
else
[ "$ABSOLUTE" ] && echo "$PKGMK_ROOT/$1" || echo "$1"
fi
}
fetch_url() {
local u="$1"; local h="$2"; local finished=0; local giturl tag CLONE_ARGS
local SAVE_AS REPO OCONTINUE OOUT; local m=0