From 30185df714bb6cac3daa231ee771e1eef96f0741 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 23 May 2025 15:31:01 +0200 Subject: [PATCH] jlalkjadlkjdsalk --- justfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/justfile b/justfile index aa6eb6b..6a78570 100644 --- a/justfile +++ b/justfile @@ -38,15 +38,15 @@ export NIX_PATH := `echo "${NIX_PATH_ORIG:-"${NIX_PATH:-}"}"` list-packages +$cut_args="-c1-": _packages_json #!/usr/bin/env -S bash -euo pipefail cachefile=/tmp/nixpkgs-packages.json.tsv - if [[ -s "$cachefile" && "$cachefile" -nt packages.json ]]; then - cut <"$cachefile" "$@" - else + if ! [[ -s "$cachefile" && "$cachefile" -nt packages.json ]]; then jq "$cachefile" #| sed -e "s#\t$(realpath master)/#\t#" \ fi + cut <"$cachefile" "$@" + @_list_packages_fname_filtered: xargs -d $'\n' -n 2000 just __list_packages_fname_filtered \ @@ -746,7 +746,7 @@ setup: if [[ ! -d ../upstream/"$branch" ]]; then set -x $GIT fetch upstream "$branch" - $GIT worktree add ../upstream/"$branch" -B "$branch" upstream/"$branch" + $GIT worktree add ../upstream/"$branch" -B "upstream-$branch" upstream/"$branch" else cd ../upstream/"$branch" if [[ $(( "$epoch" - "$($GIT log --oneline --format="%ct" HEAD -n1)" )) -gt $(( 60*60*24 )) ]]; then @@ -756,8 +756,8 @@ setup: fi ) declare -a branches=() - readarray -td $'\n' branches < <( just _upstream_release_branches "" "" | grep -vxF master ) - # TODo: clean old release branches + readarray -td $'\n' branches < <( just _upstream_release_branches "" "" ) + # TODO: clean old release branches for branch in "${branches[@]}"; do add_upstream "$branch" done @@ -976,12 +976,13 @@ _packages_json: $(( "$epoch" - "$(stat -c %Y packages.json )" )) -gt $(( 60*60*24*7 )) ]]; then set -x - if ! $GIT -C master/ diff HEAD --exit-code --quiet 1>&2; then - echo >&2 "ERROR: $(realpath master) is dirty!" + [[ -d upstream/master/ ]] || just setup + if ! $GIT -C upstream/master/ diff HEAD --exit-code --quiet 1>&2; then + echo >&2 "ERROR: $(realpath upstream/master) is dirty!" false fi - git -C master/ pull upstream master --rebase --autostash 1>&2 - just mk-packages-json "packages.json" "./master" false + git -C upstream/master/ pull upstream master --rebase --autostash 1>&2 + just mk-packages-json "packages.json" "./upstream/master" false fi }