fix
This commit is contained in:
59
justfile
59
justfile
@@ -1169,6 +1169,7 @@ enqueue-nixpkgs-review *$prs:
|
||||
$'eple\t~/repos/nixpkgs/master/' \
|
||||
$'garp\t~/repos/nixpkgs/master/'
|
||||
)"
|
||||
delay_pueue=$(gum confirm "Add '--delay 15m' to pueue?" --default=no && echo true || echo false)
|
||||
gum confirm
|
||||
for pr in $prs; do
|
||||
declare -a cmd
|
||||
@@ -1187,7 +1188,11 @@ enqueue-nixpkgs-review *$prs:
|
||||
# TODO: --eval local
|
||||
|
||||
# pueue
|
||||
cmd=( pueue add --escape "${cmd[@]}" )
|
||||
if $delay_pueue; then
|
||||
cmd=( pueue add --delay 15m --escape "${cmd[@]}" )
|
||||
elses
|
||||
cmd=( pueue add --escape "${cmd[@]}" )
|
||||
fi
|
||||
|
||||
# ssh
|
||||
if [[ -n "$prefix" ]]; then
|
||||
@@ -1201,7 +1206,33 @@ enqueue-nixpkgs-review *$prs:
|
||||
# === patch helpers ===
|
||||
|
||||
[no-cd]
|
||||
make-cargo-lock-patch $attrpath=`just _a_package`:
|
||||
make-cargo-lock-file $attrpath=`just _a_package` $dest="":
|
||||
#!/usr/bin/env -S bash -euo pipefail
|
||||
cargo_path=$( nix-build . -A cargo --no-out-link )
|
||||
src_unpacked=$( NIX_PATH="nixpkgs-overlays=$(realpath "{{rootdir}}/overlays.nix")" nix-build . -A ${attrpath}.src.unpacked --no-out-link )
|
||||
cargo_toml=$(fzf --walker=file,hidden --walker-root "$src_unpacked/" --query Cargo.toml)
|
||||
[[ -s "$cargo_toml" ]]
|
||||
|
||||
# ask where to put the file
|
||||
if [[ -z "${dest}" && -t 0 ]]; then
|
||||
attrdir=$(dirname "$(nix eval --log-format raw --file default.nix "$attrpath".meta.position --raw | cut -d: -f1 ||:)" ||:)
|
||||
if [[ -n "${attrdir:-}" && -d "$attrdir" ]]; then
|
||||
fd . "${attrdir}/" --type file --max-depth 1 --list-details
|
||||
fi
|
||||
echo "Where to put the lock file?"
|
||||
dest=$(gum input --value="$(realpath --canonicalize-missing "${attrdir:-.}/Cargo.lock")")
|
||||
[[ -n "$dest" ]]
|
||||
[[ ! -f "$dest" ]] || gum confirm "WARNING: '$dest' exists, overwrite?"
|
||||
fi
|
||||
|
||||
# make it
|
||||
"$cargo_path"/bin/cargo generate-lockfile --manifest-path "$cargo_toml" -Z unstable-options --lockfile-path "$dest"
|
||||
if [[ -t 1 ]]; then
|
||||
echo "$dest"
|
||||
fi
|
||||
|
||||
[no-cd]
|
||||
make-cargo-lock-patch $attrpath=`just _a_package` $dest="":
|
||||
#!/usr/bin/env -S bash -euo pipefail
|
||||
cargo_path=$( nix-build . -A cargo --no-out-link )
|
||||
src_unpacked=$( NIX_PATH="nixpkgs-overlays=$(realpath "{{rootdir}}/overlays.nix")" nix-build . -A ${attrpath}.src.unpacked --no-out-link )
|
||||
@@ -1210,21 +1241,27 @@ make-cargo-lock-patch $attrpath=`just _a_package`:
|
||||
cargo_toml=$(sed <<<"$cargo_lock" -e "s/\.lock$/.toml/")
|
||||
[[ -s "$cargo_toml" ]]
|
||||
|
||||
# make lock file
|
||||
TMP_DIR=$(mktemp -d)
|
||||
$cargo_path/bin/cargo generate-lockfile --manifest-path "$cargo_toml" -Z unstable-options --lockfile-path "$TMP_DIR/Cargo.lock"
|
||||
delta "$cargo_lock" "$TMP_DIR/Cargo.lock" --paging never ||:
|
||||
|
||||
attrdir=$(dirname "$(nix eval --log-format raw --file default.nix "$attrpath".meta.position --raw | cut -d: -f1 ||:)" ||:)
|
||||
if [[ -n "${attrdir:-}" && -d "$attrdir" ]]; then
|
||||
fd . "${attrdir}/" --type file --list-details
|
||||
# ask where to put it
|
||||
if [[ -z "${dest}" && -t 0 ]]; then
|
||||
attrdir=$(dirname "$(nix eval --log-format raw --file default.nix "$attrpath".meta.position --raw | cut -d: -f1 ||:)" ||:)
|
||||
if [[ -n "${attrdir:-}" && -d "$attrdir" ]]; then
|
||||
fd . "${attrdir}/" --type file --max-depth 1 --list-details
|
||||
fi
|
||||
echo "Where to put the patch?"
|
||||
dest=$(gum input --value="$(realpath --canonicalize-missing "${attrdir:-.}/cargo-lock.patch")")
|
||||
[[ -n "$dest" ]]
|
||||
[[ ! -f "$dest" ]] || gum confirm "WARNING: '$dest' exists, overwrite?"
|
||||
fi
|
||||
echo "Where to put the patch?"
|
||||
dest=$(gum input --value="$(realpath --canonicalize-missing "${attrdir:-.}/cargo-lock.patch")")
|
||||
[[ -n "$dest" ]]
|
||||
[[ ! -f "$dest" ]] || gum confirm "WARNING: '$dest' exists, overwrite?"
|
||||
|
||||
# make it
|
||||
{
|
||||
echo "--- $(realpath "$cargo_lock" | cut -d/ -f5-)"
|
||||
echo "+++ $(realpath "$cargo_lock" | cut -d/ -f5-)"
|
||||
echo "--- a/$(realpath "$cargo_lock" | cut -d/ -f5-)"
|
||||
echo "+++ b/$(realpath "$cargo_lock" | cut -d/ -f5-)"
|
||||
diff --unified "$cargo_lock" "$TMP_DIR/Cargo.lock" | tail -n+3
|
||||
} >"$dest" ||:
|
||||
echo "$dest"
|
||||
|
||||
Reference in New Issue
Block a user