This commit is contained in:
Shelvacu
2025-08-22 16:00:46 -07:00
committed by Shelvacu on fw
parent c738e46c40
commit e72e57822d
6 changed files with 38 additions and 3 deletions

View File

@@ -15,9 +15,15 @@ svl_assert_probably_in_script_dir
what="${1-}"
function assert_no_changes() {
svl_max_args $# 1
declare msg="${1-expected no changes in working tree}"
if ! git diff --quiet --exit-code HEAD; then
svl_die "there must be no changes in working tree to run this"
svl_die "$msg"
fi
}
assert_no_changes "there must be no changes in working tree to run this"
tmpdir="$(mktemp -d)"
trap '[[ -d $tmpdir ]] && rm -rf "$tmpdir"' EXIT
@@ -36,6 +42,32 @@ if [[ $what == 'flake' ]] || [[ -z $what ]]; then
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() {
svl_min_args $# 1
declare -a names=("$@")
@@ -59,10 +91,13 @@ function standard_package() {
fi
nix_common build "$flake_path" --no-link
v git commit --file="$commit_message_path" -- packages/"$primary_name"
unset flake_path
fi
remove_commit_message
fi
unset primary_name
unset names
}
standard_package bandcamp-collection-downloader bcd