Skip to content

treewide: change ${pname} to string literal, pt2#336195

Merged
philiptaron merged 85 commits intoNixOS:masterfrom
pbsds:migrate-pname-1724195181
Aug 21, 2024
Merged

treewide: change ${pname} to string literal, pt2#336195
philiptaron merged 85 commits intoNixOS:masterfrom
pbsds:migrate-pname-1724195181

Conversation

@pbsds
Copy link
Member

@pbsds pbsds commented Aug 20, 2024

Description of changes

repeat of #336172, done with

#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p ripgrep sd jq git lix

export NIXPKGS_ALLOW_UNFREE=1
export NIXPKGS_ALLOW_INSECURE=1
export NIXPKGS_ALLOW_BROKEN=1

git restore .

test -s packages.json || ( set -x;
  time nix-env --extra-experimental-features no-url-literals --option system x86_64-linux -f ./. -qaP --json --meta --show-trace --no-allow-import-from-derivation > packages.json
)

jq <packages.json 'to_entries[] | select(.value.meta.position==null|not) | "\(.key)\t\(.value.meta.position)"' -r |
    sed -e "s#\t$(realpath .)/#\t#" |
    sed -e 's#:\([0-9]*\)$#\t\1#' |
    grep --fixed-strings "$( rg -F '${pname}' pkgs/tools/misc/ -tnix -l | sort | head -n 2500 )" |
    grep . |
    grep -iv haskell |
    grep -iv /top-level/ |
    grep -iv chicken |
    grep -iv build |
    grep -E '/(package|default)\.nix' |
    while read attrpath fname col; do
        echo "$attrpath"
        data="$(nix eval --impure  --expr 'with import ./. {}; { inherit ('"$attrpath"') pname drvPath passthru meta; drvPath2='"$attrpath"'.src.drvPath; }' --json)"
        test -n "$data" || continue
        pname="$(jq <<<"$data" .pname -r)"
        test -n "$pname" || continue
        (set -x
            sd -F '${pname}' "$pname" "$fname"
            sd -F ' = pname;' " = \"$pname\";" "$fname"
        )
        data2="$(nix eval --impure  --expr 'with import ./. {}; { inherit ('"$attrpath"') pname drvPath passthru meta; drvPath2='"$attrpath"'.src.drvPath; }' --json)"
        if ! test "$data" = "$data2"; then
            (set -x; git restore "$fname")
        fi
    done

primarily in pkgs/tools/misc this time around, and i selected the ones that made sense using GIT_DIFF_OPTS=-u2000 git add --patch.

should be 0 rebuilds.

Please squash merge, I spam-commit in treewides for easier handling of merge conflicts.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

pbsds added 30 commits August 21, 2024 01:22
@pbsds pbsds marked this pull request as ready for review August 20, 2024 23:39
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Aug 21, 2024
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan on merging once OfBorg says 0.

@philiptaron philiptaron merged commit 3a83109 into NixOS:master Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants