ljksdlkasdlkj

This commit is contained in:
2025-06-06 22:41:11 +02:00
parent ef5180ab5d
commit c1df5793ac

View File

@@ -445,7 +445,13 @@ _build_package_sources $system +packages:
commit-dirty-packages +$message=`gum input --placeholder="commit message, (attrpath: this message)"`:
#!/usr/bin/env -S bash -euo pipefail
[[ -n "$message" ]]
$GIT ls-files --modified | sort -u | xe nixfmt --check || ! echo >&2 "Consider running 'just format-files-dirty'" || false
if ! $GIT ls-files --modified | sort -u | xe -j0 nixfmt --check; then
if gum confirm "Run 'just format-files-dirty'?"; then
just format-files-dirty
else
false
fi
fi
just list-dirty-packages |
while read attrpath position row; do
[[ -f "$position" ]] || continue
@@ -487,6 +493,25 @@ fixup-commit-staged commit=`cd "$invokedir"; just _a_commit`:
rebase-commits commit=`cd "$invokedir"; just _a_commit`:
cd "$invokedir"; $GIT rebase -i --autostash --autosquash "$($GIT log -n1 --pretty=%P {{ commit }})"
[no-cd]
bisect $repro_cmd $bad_commit=`just _a_commit` $good_commit=`just _a_commit`:
#!/usr/bin/env -S bash -euo pipefail
[[ -n "$repro_cmd" ]]
[[ -n "$good_commit" ]]
[[ -n "$bad_commit" ]]
#[[ -x "$repro_cmd" ]] || ! echo >&2 "ERROR: '$repro_cmd' is not an executable file!" || false
declare -a args=()
declare -a possible_args=(
"--first-parent Follow only the first parent commit upon seeing a merge commit."
"--no-checkout Do not checkout the new working tree, instead just update BISECT_HEAD "
)
readarray -td $'\n' args < <(gum choose --no-limit -- "${possible_args[@]}" | cut -d' ' -f1)
(set -x
$GIT bisect start "${args[@]}" "$bad_commit" "$good_commit" --
$GIT bisect run "$repro_cmd"
)
echo >&2 "Conclude with 'git bisect reset'"
# === pr helper ===
[no-cd]
@@ -921,7 +946,7 @@ get-maintainers-for-packages *attrpaths: _packages_json
[[ "${#attrpaths[@]}" -gt 0 ]]
#grep </tmp/nixpkgs-maintainers.tsv -F "$(printf "%s\t\n" "${attrpaths[@]}")"
attrpath_json=$(printf "%s\n" "${attrpaths[@]}" | jq -sR 'split("\n")|map(select(.==""|not))' -c)
jq <packages.json --argjson attrs "$attrpath_json" '. as $pkgs | $attrs[] | $pkgs[.].meta.maintainers // [] | .[] | .github' -r
jq <packages.json --argjson attrs "$attrpath_json" '. as $pkgs | $attrs[] | $pkgs[.].meta.maintainers // [] | .[] | .github' -r | sort -u
get-versions $attrpath=`just _a_package` *paths: setup
@@ -1075,7 +1100,7 @@ enqueue-nixpkgs-review *$prs:
[no-cd]
format-files-dirty:
#!/usr/bin/env -S bash -euo pipefail
git ls-files --modified | sort -u | grep . | xe nixfmt
git ls-files --modified | sort -u | grep . | xe -j0 nixfmt
[no-cd]
format-files-touched-by-commit *commits:
@@ -1207,6 +1232,7 @@ _a_maintainer:
nix eval {{NIX_EVAL_OPTS}} --file upstream/master/maintainers/maintainer-list.nix \
--apply 'x: builtins.attrValues (builtins.mapAttrs (k: v: let user = v.github or k; name = v.name or null; in [user (if name != user then name else null) (v.email or null)]) x)' --json \
| jq '.[]|@tsv' -r \
| sort --ignore-case \
| column -t -s$'\t' \
| fzf --sync --layout=reverse \
| cut -d' ' -f1
@@ -1217,10 +1243,56 @@ _some_maintainers:
nix eval {{NIX_EVAL_OPTS}} --file upstream/master/maintainers/maintainer-list.nix \
--apply 'x: builtins.attrValues (builtins.mapAttrs (k: v: let user = v.github or k; name = v.name or null; in [user (if name != user then name else null) (v.email or null)]) x)' --json \
| jq '.[]|@tsv' -r \
| sort --ignore-case \
| column -t -s$'\t' \
| fzf --sync --layout=reverse --multi \
| cut -d' ' -f1
_a_committer: _committers_jsonl
#!/usr/bin/env -S bash -euo pipefail
[[ -n "${JUST_COMMITTERS:-}" ]] && { head -n1 <<<"$JUST_COMMITTERS"; exit 0; } ||:
nix eval {{NIX_EVAL_OPTS}} --file upstream/master/maintainers/maintainer-list.nix \
--apply 'x: builtins.attrValues (builtins.mapAttrs (k: v: let user = v.github or k; name = v.name or null; in [user (if name != user then name else null) (v.email or null)]) x)' --json \
| jq --argjson committers "$(jq <.direnv/nixpkgs-committers.jsonl -s 'map(.login)' -c)" '.[] | .[0] as $github| select([$committers[]|.==$github]|any) | @tsv' -r \
| sort --ignore-case \
| column -t -s$'\t' \
| fzf --sync --layout=reverse \
| cut -d' ' -f1
_some_committers: _committers_jsonl
#!/usr/bin/env -S bash -euo pipefail
[[ -n "${JUST_COMMITTERS:-}" ]] && { cat <<<"$JUST_COMMITTERS"; exit 0; } ||:
nix eval {{NIX_EVAL_OPTS}} --file upstream/master/maintainers/maintainer-list.nix \
--apply 'x: builtins.attrValues (builtins.mapAttrs (k: v: let user = v.github or k; name = v.name or null; in [user (if name != user then name else null) (v.email or null)]) x)' --json \
| jq --argjson committers "$(jq <.direnv/nixpkgs-committers.jsonl -s 'map(.login)' -c)" '.[] | .[0] as $github| select([$committers[]|.==$github]|any) | @tsv' -r \
| sort --ignore-case \
| column -t -s$'\t' \
| fzf --sync --layout=reverse --multi \
| cut -d' ' -f1
_committers_jsonl:
#!/usr/bin/env -S bash -euo pipefail
# TODO: this requires 'gh login'?
cachefile=.direnv/nixpkgs-committers.jsonl
if [[ ! -s "$cachefile" ||
$(( "$epoch" - "$(stat -c %Y "$cachefile" )" )) -gt $(( 60*60*24*7*4 ))
]]; then
[[ ! -f "${cachefile}.staging" ]] || rm -v "${cachefile}.staging"
let page=0 ||:
while
((page++))
resp="$(
gh api -H 'X-GitHub-Api-Version: 2022-11-28' "/orgs/nixos/teams/nixpkgs-committers/members?per_page=100&page=${page}" | jq '.[]' -c
)"
cat <<<"$resp" >>"${cachefile}.staging"
[[ "$(wc -l <<<"$resp" )" -ge 100 ]]
do true; done
sort <"${cachefile}.staging" -u --ignore-case > "$cachefile"
rm "${cachefile}.staging"
fi
_a_pr:
#!/usr/bin/env -S bash -euo pipefail
[[ -n "${JUST_PR:-}" ]] && { head -n1 <<<"$JUST_PR"; exit 0; } ||: