ljdsjklasdjkl

This commit is contained in:
2025-06-06 20:45:44 +02:00
parent bd8622f9b2
commit 0536371a80

112
justfile
View File

@@ -452,7 +452,7 @@ commit-dirty-packages +$message=`gum input --placeholder="commit message, (attrp
$GIT diff -s --exit-code "$position" || (
set -x
$GIT add "$position"
$GIT commit -m "$attrpath: $*"
$GIT commit -m "$(just _attrpaths_2_aliases <<<"$attrpath"): $*"
)
done
@@ -494,7 +494,7 @@ push-new-pr:
#!/usr/bin/env -S bash -euo pipefail -x
# TODO: verify "origin" is a nixpkgs fork and not NixOS/nixpkgs
if gum confirm --default=no "Test merging into upstream branches?"; then
just test-merge
just test-merge || gum confirm --default=no "Continue?"
fi
declare title
title="$(just _a_commit_title ||:)"
@@ -509,60 +509,70 @@ push-new-pr:
# === speed worktrees ===
bump-new-worktree *packages:
#!/usr/bin/env -S bash -euo pipefail -x
#!/usr/bin/env -S bash -euo pipefail
declare -a packages=("$@")
[[ -n "${packages[*]}" ]] || packages=($(JUST_USE_ALIASES=1 just _some_packages))
[[ "${#packages[@]}" -gt 0 ]] || readarray -td $'\n' packages <<<"$( just _some_packages )"
[[ "${#packages[@]}" -gt 0 ]]
export JUST_SYSTEM="$(just _a_system)"
just get-versions "${packages[0]}"
just get-versions "${packages[0]}" # TODO: timeout?
worktree=$(just _new_worktree bump "$(printf "%s\n" "${packages[0]}" | rev | cut -d. -f1 | rev)")
[[ -n "worktree" ]]
[[ -n "$worktree" ]]
[[ -d "$worktree" ]]
cd "$worktree"
just bump-here "${packages[@]}"
NIXPKGS_ALLOW_UNFREE=1 "$SHELL"
NIXPKGS_ALLOW_UNFREE=1 exec just _enter_interactive_shell
[no-cd]
bump-here *packages:
#!/usr/bin/env -S bash -euo pipefail -x
#!/usr/bin/env -S bash -euo pipefail
[[ -e .git && flake.nix ]]
declare -a packages=("$@")
[[ -n "${packages[*]}" ]] || packages=($(JUST_USE_ALIASES=1 just _some_packages))
[[ "${#packages[@]}" -gt 0 ]] || readarray -td $'\n' packages <<<"$( just _some_packages )"
[[ "${#packages[@]}" -gt 0 ]]
declare -a package_aliases=()
readarray -td $'\n' package_aliases <<<"$( printf "%s\n" "${packages[@]}" | just _attrpaths_2_aliases )"
[[ "${#package_aliases[@]}" -gt 0 ]] || package_aliases=("${#packages[@]}")
[[ "${#package_aliases[@]}" -gt 0 ]]
system="$(just _a_system)"
printf "%s.src\n" "${packages[@]}" | xargs {{XARGS_NL}} just __build_packages "$system" results-src-old ||: # TODO: unpack?
config=(
config1=(
env
NIXPKGS_ALLOW_UNFREE=1
NIXPKGS_ALLOW_BROKEN=1
NIXPKGS_ALLOW_INSECURE=1
)
for package in "${packages[@]}"; do
config2=(
"${config1[@]}"
NIXPKGS_ALLOW_BROKEN=1
)
printf "%s.src\n" "${package_aliases[@]}" | "${config2[@]}" xargs {{XARGS_NL}} just __build_packages "$system" results-src-old ||: # TODO: unpack?
for package in "${package_aliases[@]}"; do
if nix eval {{NIX_EVAL_OPTS}} --file default.nix "$package".passthru.updateScript >&/dev/null; then
HEAD=$($GIT rev-parse HEAD)
"${config[@]}" nix-update "$package" --use-update-script --update-script-args "--argstr skip-prompt true" --commit
"${config2[@]}" nix-update "$package" --use-update-script --update-script-args "--argstr skip-prompt true" --commit
if [[ $($GIT rev-parse HEAD) = "$HEAD" ]]; then
echo "no commit found, trying without the updateScript..."
$GIT restore .
"${config[@]}" nix-update "$package" --commit || true
"${config2[@]}" nix-update "$package" --commit || true
fi
else
"${config[@]}" nix-update "$package" --commit || true
"${config2[@]}" nix-update "$package" --commit || true
fi
done
set +e
printf "%s.src\n" "${packages[@]}" | xargs {{XARGS_NL}} just __build_packages "$system" results-src-new # TODO: unpack?
just __build_packages "$system" results "${packages[@]}"
printf "%s.src\n" "${package_aliases[@]}" | "${config2[@]}" xargs {{XARGS_NL}} just __build_packages "$system" results-src-new # TODO: unpack?
"${config1[@]}" just __build_packages "$system" results "${packages[@]}"
# TODO: filter non-existing tests:
printf "%s.tests\n" "${packages[@]}" | env _JUST_NIX_BUILD_ARGS="-j1" xargs {{XARGS_NL}} just __build_packages "$system" results-tests
printf "HEAD^%s " $(seq 0 $(( "${#packages[@]}" - 1 ))) | xe $GIT show
printf "%s.tests\n" "${packages[@]}" | "${config1[@]}" _JUST_NIX_BUILD_ARGS="-j1" xargs {{XARGS_NL}} just __build_packages "$system" results-tests
printf "HEAD^%s " $(seq 0 $(( "${#package_aliases[@]}" - 1 ))) | xe $GIT show
fd . -l results results-tests --max-depth 1
# test -L result && fd . result --type x --color=always | tee update-executables.txt
# $GIT show --name-only --pretty="" | xe statix fix
$GIT diff
printf "\n"
printf "delta results-src-{old,new}/%s.src/.\n" "${packages[@]}"
printf "delta results-src-{old,new}/%s.src/.\n" "${package_aliases[@]}"
printf "\n"
printf > delta-cmds.sh '#!/usr/bin/env bash\n'
printf >>delta-cmds.sh 'tail "$0" -n+3 | bat --style plain -l bash; exit 1\n'
printf >>delta-cmds.sh "delta results-src-{old,new}/%s.src/.\n" "${packages[@]}"
printf >>delta-cmds.sh "delta results-src-{old,new}/%s.src/.\n" "${package_aliases[@]}"
fix *packages:
#!/usr/bin/env -S bash -euo pipefail
@@ -577,7 +587,7 @@ fix *packages:
rm -rf results-src
just bump-here "${packages[@]}"
fi
$SHELL
exec just _enter_interactive_shell
[no-cd]
_fix +packages:
@@ -629,7 +639,7 @@ pr $number=`just _a_pr`:
git branch -D just-nixpkgs-pr-"$number"-tmp
[[ -z "$upstream_branch" ]] || do_rebase "$upstream_branch"
fi
$SHELL
exec just _enter_interactive_shell
@pr-comment-diff:
cd "$invokedir"; just _pr_post_diff comment
@@ -671,19 +681,21 @@ remote-branch $remote_ref=`just _a_remote_branch origin | cut -d/ -f2-`:
cd master
$GIT worktree add --track ../"$branch_dir/$branch_base" -b "$remote_ref" origin/"$remote_ref"
cd ../"$branch_dir/$branch_base"
$SHELL
exec just _enter_interactive_shell
# === worktrees ===
# TODO: onto release-xx.yy doesn't work
# TODO: python-updates
@new-worktree *args:
cd "$(just _new_worktree "$@")"; $SHELL
cd "$(just _new_worktree "$@")"; exec just _enter_interactive_shell
@_a_wt_type:
gum choose feat fix init bump doc migrate
@_a_wt_name:
gum input --placeholder="Branch name?"
_new_worktree $type=`just _a_wt_type` $name=`just _a_wt_name` $base=`just _a_upstream_release_branch "Base?"` $onto=`just _a_upstream_release_branch "Onto?" ""`:
#!/usr/bin/env -S bash -euo pipefail
[[ -n "$type" ]]
@@ -734,12 +746,12 @@ pop-commits-to-new-worktree $commits=`cd "$invokedir"; just _some_commits`:
git rebase "$(tail -n1 <<<"$commits")"^^ -i
)
git log -n "$(wc -l <<<"$commits" )"
$SHELL
exec just _enter_interactive_shell
else
echo >&2 "The commits have not been popped."
git status
echo >&2 "The commits have not been popped."
$SHELL
exec just _enter_interactive_shell
fi
[no-cd]
@@ -777,7 +789,7 @@ fix-periodic-merge-conflict $from=`just _a_upstream_release_branch "From?"` $to=
@echo " $GIT ls-files --modified | sort -u | xe -N0 $GIT reset"
@echo " $GIT commit"
@echo " $GIT push upstream HEAD:$to"
cd fix/merge-conflict-"$from"-to-"$to"-{{ epoch }}; $SHELL
cd fix/merge-conflict-"$from"-to-"$to"-{{ epoch }}; exec just _enter_interactive_shell
# === setup ===
@@ -1009,14 +1021,16 @@ enqueue-nixpkgs-review *$prs:
declare -a systems=()
readarray -td $'\n' systems < <( printf "%s\n" "${all_systems[@]}" | fzf --sync --layout=reverse --multi )
declare -a all_configs=(
""
"allowInsecurePredicate = x: true;"
"cudaSupport = true;"
"rocmSupport = true;"
# "allowUnfree = true;" # default in nixpkgs-review
"allowUnfree = false;"
"allowBroken = true;"
# "allowUnsupportedSystem = true;"
''
# 'crossSystem = "aarch64-linux";' # TODO: test
'crossSystem = "aarch64-unknown-linux-gnu";' # TODO: test
'allowInsecurePredicate = x: true;'
'cudaSupport = true;'
'rocmSupport = true;'
# 'allowUnfree = true;' # default in nixpkgs-review
'allowUnfree = false;'
'allowBroken = true;'
# 'allowUnsupportedSystem = true;'
)
declare -a configs=()
readarray -td $'\n' "configs" < <( printf "%s\n" "${all_configs[@]}" | fzf --sync --layout=reverse --multi )
@@ -1037,8 +1051,10 @@ enqueue-nixpkgs-review *$prs:
--no-shell
--post-result
--systems "${systems[*]}"
--extra-nixpkgs-config "{ ${configs[*]} }"
)
if [[ "${#configs[@]}" -gt 0 ]]; then
cmd+=(--extra-nixpkgs-config "{ ${configs[*]} }")
fi
# TODO: --checkout commit
# TODO: --eval local
@@ -1152,11 +1168,7 @@ _some_packages: _packages_json
[[ -n "${JUST_PACKAGE:-}" ]] && { cat <<<"$JUST_PACKAGE" ; exit 0; } ||:
#gum spin --show-output just list-packages | cut -f1 | fzf --sync --layout=reverse --multi | grep .
just list-packages >/dev/null
if [[ -n "${JUST_USE_ALIASES:-}" ]]; then
just list-packages | cut -f1 | fzf --sync --layout=reverse --multi | grep . | just _attrpaths_2_aliases
else
just list-packages | cut -f1 | fzf --sync --layout=reverse --multi | grep .
fi
just list-packages | cut -f1 | fzf --sync --layout=reverse --multi | grep .
@_attrpaths_2_aliases:
sed -E 's/^python3[0-9]+Packages\./python3Packages./g' \
@@ -1246,6 +1258,20 @@ _some_prs:
cd master; $GIT fetch "$remote"
cd master; $GIT for-each-ref --sort=committerdate refs/remotes --format='%(committerdate:short) %(refname:short)' | sort -r | grep " $remote/" | gum filter --height=15 --no-sort | cut -d' ' -f2-
[no-cd]
[no-exit-message]
_enter_interactive_shell *_:
#!/usr/bin/env -S bash -euo pipefail
# report new working dir to terminal so that tab are spawned relative
# based on ghostty:src/shell-integration/bash/ghostty.bash
if [[ -n "$GHOSTTY_RESOURCES_DIR" ]]; then
_ghostty_last_reported_cwd="$PWD"
builtin printf "\e]7;kitty-shell-cwd://%s%s\a" "$HOSTNAME" "$PWD"
fi
# TODO: -l ?
exec "$SHELL" "$@"
# TODO: go back to the old PWD here
# maintenance
@_fmt_justfile: