mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-25 00:20:05 -07:00
kiss: only split version once per package
This commit is contained in:
parent
aa0c62fe4a
commit
679d145434
29
kiss
29
kiss
@ -184,6 +184,15 @@ pkg_find_version() {
|
|||||||
|
|
||||||
read -r repo_ver repo_rel 2>/dev/null < "$repo_dir/version" ||
|
read -r repo_ver repo_rel 2>/dev/null < "$repo_dir/version" ||
|
||||||
die "$1" "Failed to read version file ($repo_dir/version)"
|
die "$1" "Failed to read version file ($repo_dir/version)"
|
||||||
|
|
||||||
|
case $2 in *?*)
|
||||||
|
# Split the version on '.+-' to obtain individual components.
|
||||||
|
# Intentional, globbing disabled.
|
||||||
|
# shellcheck disable=2086
|
||||||
|
IFS=.+- read -r repo_major repo_minor repo_patch repo_ident <<EOF
|
||||||
|
$repo_ver
|
||||||
|
EOF
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_find_die() {
|
pkg_find_die() {
|
||||||
@ -276,24 +285,14 @@ source_resolve_vars() {
|
|||||||
_src_sub() { _src_res=${_src_res%"$1"*}${2}${_src_res##*"$1"}; }
|
_src_sub() { _src_res=${_src_res%"$1"*}${2}${_src_res##*"$1"}; }
|
||||||
_src_res=$1
|
_src_res=$1
|
||||||
|
|
||||||
# Split the version on '.+-' to obtain MAJOR, MINOR and PATCH.
|
|
||||||
# Fields beyond this are currently unsupported, the entire
|
|
||||||
# version string is still available via VERSION.
|
|
||||||
#
|
|
||||||
# Intentional, globbing disabled.
|
|
||||||
# shellcheck disable=2086
|
|
||||||
IFS=.+- read -r major minor patch ident <<EOF
|
|
||||||
$repo_ver
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Loop until no identifiers are found and all have been removed.
|
# Loop until no identifiers are found and all have been removed.
|
||||||
# This works backwards replacing each identifier with its value.
|
# This works backwards replacing each identifier with its value.
|
||||||
while :; do case $_src_res in
|
while :; do case $_src_res in
|
||||||
*VERSION*) _src_sub VERSION "$repo_ver" ;;
|
*VERSION*) _src_sub VERSION "$repo_ver" ;;
|
||||||
*MAJOR*) _src_sub MAJOR "$major" ;;
|
*MAJOR*) _src_sub MAJOR "$repo_major" ;;
|
||||||
*MINOR*) _src_sub MINOR "$minor" ;;
|
*MINOR*) _src_sub MINOR "$repo_minor" ;;
|
||||||
*PATCH*) _src_sub PATCH "$patch" ;;
|
*PATCH*) _src_sub PATCH "$repo_patch" ;;
|
||||||
*IDENT*) _src_sub IDENT "$ident" ;;
|
*IDENT*) _src_sub IDENT "$repo_ident" ;;
|
||||||
*PKG*) _src_sub PKG "${repo_dir##*/}" ;;
|
*PKG*) _src_sub PKG "${repo_dir##*/}" ;;
|
||||||
*) break
|
*) break
|
||||||
esac done
|
esac done
|
||||||
@ -349,7 +348,7 @@ pkg_source_resolve() {
|
|||||||
pkg_source() {
|
pkg_source() {
|
||||||
# Download any remote package sources. The existence of local files is
|
# Download any remote package sources. The existence of local files is
|
||||||
# also checked.
|
# also checked.
|
||||||
pkg_find_version "$1"
|
pkg_find_version "$1" 1
|
||||||
|
|
||||||
# Support packages without sources. Simply do nothing.
|
# Support packages without sources. Simply do nothing.
|
||||||
[ -f "$repo_dir/sources" ] || return 0
|
[ -f "$repo_dir/sources" ] || return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user