stuff
This commit is contained in:
41
update.sh
41
update.sh
@@ -15,9 +15,15 @@ svl_assert_probably_in_script_dir
|
|||||||
|
|
||||||
what="${1-}"
|
what="${1-}"
|
||||||
|
|
||||||
if ! git diff --quiet --exit-code HEAD; then
|
function assert_no_changes() {
|
||||||
svl_die "there must be no changes in working tree to run this"
|
svl_max_args $# 1
|
||||||
fi
|
declare msg="${1-expected no changes in working tree}"
|
||||||
|
if ! git diff --quiet --exit-code HEAD; then
|
||||||
|
svl_die "$msg"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_no_changes "there must be no changes in working tree to run this"
|
||||||
|
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
trap '[[ -d $tmpdir ]] && rm -rf "$tmpdir"' EXIT
|
trap '[[ -d $tmpdir ]] && rm -rf "$tmpdir"' EXIT
|
||||||
@@ -36,6 +42,32 @@ if [[ $what == 'flake' ]] || [[ -z $what ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $what == 'units' ]] || [[ -z $what ]]; then
|
||||||
|
assert_no_changes
|
||||||
|
declare units_path="$tmpdir/units_path"
|
||||||
|
v nix build '.#stable.units' --out-link "$units_path"
|
||||||
|
v "$units_path/bin/units_cur" --verbose units/currency.units units/cpi.units
|
||||||
|
declare version_string
|
||||||
|
version_string="$("$units_path/bin/units" --version | head -n 1)"
|
||||||
|
if ! git diff --quiet --exit-code HEAD; then
|
||||||
|
declare -a cmd=(
|
||||||
|
git
|
||||||
|
commit
|
||||||
|
--message "units: update currency data"
|
||||||
|
--message "Auto-update by <nix-stuff>/update.sh"
|
||||||
|
--message "Used $version_string"
|
||||||
|
--
|
||||||
|
./units
|
||||||
|
)
|
||||||
|
v "${cmd[@]}"
|
||||||
|
unset cmd
|
||||||
|
fi
|
||||||
|
unset version_string
|
||||||
|
rm "$units_path"
|
||||||
|
unset units_path
|
||||||
|
assert_no_changes
|
||||||
|
fi
|
||||||
|
|
||||||
function standard_package() {
|
function standard_package() {
|
||||||
svl_min_args $# 1
|
svl_min_args $# 1
|
||||||
declare -a names=("$@")
|
declare -a names=("$@")
|
||||||
@@ -59,10 +91,13 @@ function standard_package() {
|
|||||||
fi
|
fi
|
||||||
nix_common build "$flake_path" --no-link
|
nix_common build "$flake_path" --no-link
|
||||||
v git commit --file="$commit_message_path" -- packages/"$primary_name"
|
v git commit --file="$commit_message_path" -- packages/"$primary_name"
|
||||||
|
unset flake_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
remove_commit_message
|
remove_commit_message
|
||||||
fi
|
fi
|
||||||
|
unset primary_name
|
||||||
|
unset names
|
||||||
}
|
}
|
||||||
|
|
||||||
standard_package bandcamp-collection-downloader bcd
|
standard_package bandcamp-collection-downloader bcd
|
||||||
|
Reference in New Issue
Block a user