Allow to skip more options to update-walker in simple cases. Now just an URL can work if everything is set up in default way
This commit is contained in:
parent
fdf3ff7a21
commit
f8f54dc8d3
@ -3,6 +3,7 @@
|
|||||||
own_dir="$(cd "$(dirname "$0")"; pwd)"
|
own_dir="$(cd "$(dirname "$0")"; pwd)"
|
||||||
|
|
||||||
CURRENT_URL=
|
CURRENT_URL=
|
||||||
|
NEED_TO_CHOOSE_URL=1
|
||||||
|
|
||||||
url () {
|
url () {
|
||||||
CURRENT_URL="$1"
|
CURRENT_URL="$1"
|
||||||
@ -45,12 +46,14 @@ matching_links () {
|
|||||||
|
|
||||||
link () {
|
link () {
|
||||||
CURRENT_URL="$(matching_links "$1" | position_choice "$2" "$3")"
|
CURRENT_URL="$(matching_links "$1" | position_choice "$2" "$3")"
|
||||||
|
unset NEED_TO_CHOOSE_URL
|
||||||
echo "Linked by: $*"
|
echo "Linked by: $*"
|
||||||
echo "URL: $CURRENT_URL" >&2
|
echo "URL: $CURRENT_URL" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
version_link () {
|
version_link () {
|
||||||
CURRENT_URL="$(matching_links "$1" | version_sort | position_choice "$2" "$3")"
|
CURRENT_URL="$(matching_links "$1" | version_sort | position_choice "$2" "$3")"
|
||||||
|
unset NEED_TO_CHOOSE_URL
|
||||||
echo "Linked version by: $*"
|
echo "Linked version by: $*"
|
||||||
echo "URL: $CURRENT_URL" >&2
|
echo "URL: $CURRENT_URL" >&2
|
||||||
}
|
}
|
||||||
@ -86,6 +89,23 @@ ensure_target () {
|
|||||||
[ -z "$CURRENT_TARGET" ] && target default.nix
|
[ -z "$CURRENT_TARGET" ] && target default.nix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure_name () {
|
||||||
|
[ -z "$CURRENT_NAME" ] && name "$(basename "$CONFIG_DIR")"
|
||||||
|
echo "Resulting name: $CURRENT_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_choice () {
|
||||||
|
[ -n "NEED_TO_CHOOSE_URL" ] && {
|
||||||
|
version_link '[.]tar[.]([^./])+$'
|
||||||
|
unset NEED_TO_CHOOSE_URL
|
||||||
|
}
|
||||||
|
[ -z "$CURRENT_URL" ] && {
|
||||||
|
echo "Error: empty CURRENT_URL"
|
||||||
|
echo "Error: empty CURRENT_URL" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hash () {
|
hash () {
|
||||||
CURRENT_HASH="$(nix-prefetch-url "$CURRENT_URL")"
|
CURRENT_HASH="$(nix-prefetch-url "$CURRENT_URL")"
|
||||||
}
|
}
|
||||||
@ -183,9 +203,11 @@ do_overwrite () {
|
|||||||
|
|
||||||
process_config () {
|
process_config () {
|
||||||
CONFIG_DIR="$(directory_of "$1")"
|
CONFIG_DIR="$(directory_of "$1")"
|
||||||
source "$CONFIG_DIR/$(basename "$1")"
|
|
||||||
BEGIN_EXPRESSION='# Generated upstream information';
|
BEGIN_EXPRESSION='# Generated upstream information';
|
||||||
|
source "$CONFIG_DIR/$(basename "$1")"
|
||||||
|
ensure_name
|
||||||
retrieve_version
|
retrieve_version
|
||||||
|
ensure_choice
|
||||||
ensure_version
|
ensure_version
|
||||||
ensure_target
|
ensure_target
|
||||||
update_found && do_overwrite "$CURRENT_TARGET"
|
update_found && do_overwrite "$CURRENT_TARGET"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user