fish: 4.7.1 -> 4.8.0 (#534907)

This commit is contained in:
Adam C. Stephens
2026-06-24 18:57:48 +00:00
committed by GitHub
4 changed files with 51 additions and 46 deletions
+29 -17
View File
@@ -262,22 +262,17 @@ in
(lib.mkIf cfg.generateCompletions {
etc."fish/generated_completions".source =
let
patchedGenerator = pkgs.stdenv.mkDerivation {
name = "fish_patched-completion-generator";
srcs = [
"${cfg.package}/share/fish/tools/create_manpage_completions.py"
];
unpackCmd = "cp $curSrc $(basename $curSrc)";
sourceRoot = ".";
patches = [ ./fish_completion-generator.patch ]; # to prevent collisions of identical completion files
dontBuild = true;
installPhase = ''
mkdir -p $out
cp * $out/
'';
preferLocalBuild = true;
allowSubstitutes = false;
};
# fish embeds the generator script in the binary, so extract it.
generator =
pkgs.runCommandLocal "fish_completion-generator"
{
nativeBuildInputs = [ cfg.package ];
}
''
mkdir -p $out
fish --no-config -c 'status get-file tools/create_manpage_completions.py' \
> $out/create_manpage_completions.py
'';
generateCompletions =
package:
pkgs.runCommandLocal
@@ -298,8 +293,25 @@ in
''
mkdir -p $out
if [ -d $package/share/man ]; then
find -L $package/share/man -type f | xargs ${pkgs.python3.pythonOnBuildForHost.interpreter} ${patchedGenerator}/create_manpage_completions.py --directory $out >/dev/null
find -L $package/share/man -type f \
| xargs ${pkgs.python3.pythonOnBuildForHost.interpreter} \
${generator}/create_manpage_completions.py --directory $out \
>/dev/null
fi
# The generator emits a header comment containing the man page store
# path. Strip it so identical completions from different packages
# don't collide and so we don't retain runtime references to the
# inputs. Fail if generated files lack the expected header so that a
# change in the upstream format gets noticed.
shopt -s nullglob
for f in $out/*.fish; do
if ! grep -q '^# Autogenerated from ' "$f"; then
echo "error: expected '# Autogenerated from' header not found in $f" >&2
exit 1
fi
sed -i '/^# Autogenerated from /d' "$f"
done
'';
packages =
if
@@ -1,14 +0,0 @@
--- a/create_manpage_completions.py
+++ b/create_manpage_completions.py
@@ -879,10 +879,6 @@ def parse_manpage_at_path(manpage_path, output_directory):
)
return False
- # Output the magic word Autogenerated so we can tell if we can overwrite this
- built_command_output.insert(
- 0, "# " + CMDNAME + "\n# Autogenerated from man page " + manpage_path
- )
# built_command_output.insert(2, "# using " + parser.__class__.__name__) # XXX MISATTRIBUTES THE CULPABLE PARSER! Was really using Type2 but reporting TypeDeroffManParser
for line in built_command_output:
+8 -8
View File
@@ -1,12 +1,12 @@
diff --git a/share/config.fish b/share/config.fish
index 73148ac25..1964e30be 100644
index b246916a5..05252c35f 100644
--- a/share/config.fish
+++ b/share/config.fish
@@ -175,6 +175,7 @@ and __fish_set_locale
@@ -132,6 +132,7 @@ and __fish_set_locale
# This used to be in etc/config.fish - keep it here to keep the semantics
#
if status --is-login
if command -sq /usr/libexec/path_helper
+ and not set -q __NIX_DARWIN_SET_ENVIRONMENT_DONE
__fish_macos_set_env PATH /etc/paths '/etc/paths.d'
if test -n "$MANPATH"
__fish_macos_set_env MANPATH /etc/manpaths '/etc/manpaths.d'
if status is-login && command -sq /usr/libexec/path_helper
+ and not set -q __NIX_DARWIN_SET_ENVIRONMENT_DONE
__fish_macos_set_env PATH /etc/paths '/etc/paths.d'
if test -n "$MANPATH"
__fish_macos_set_env MANPATH /etc/manpaths '/etc/manpaths.d'
+14 -7
View File
@@ -150,13 +150,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "fish";
version = "4.7.1";
version = "4.8.0";
src = fetchFromGitHub {
owner = "fish-shell";
repo = "fish-shell";
tag = finalAttrs.version;
hash = "sha256-u0mBdWkxP4zI6NUhJ0LJrEDrbAAfTDi8IapsWWC9yWc=";
hash = "sha256-ttjLM1uBY8sL+jVcxdHUnHYlRFe5jGjnkgBLy17qGso=";
};
env = {
@@ -169,7 +169,7 @@ stdenv.mkDerivation (finalAttrs: {
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) src patches;
hash = "sha256-d4YA9fnDQyfyK675nP+tiTqJ1o2jqjwPHU1trXd8MCA=";
hash = "sha256-w8MuabpZ5ronQL3iaXbLErxPlTe1Mg8OsRb5foR59II=";
};
patches = [
@@ -404,10 +404,17 @@ stdenv.mkDerivation (finalAttrs: {
fishConfig =
let
fishScript = writeText "test.fish" ''
set -x __fish_bin_dir ${finalAttrs.finalPackage}/bin
echo $__fish_bin_dir
cp -r ${finalAttrs.finalPackage}/share/fish/tools/web_config/* .
chmod -R +w *
# webconfig.py locates fish via $fish_bin_dir, which fish_config
# normally exports from the read-only $__fish_bin_dir.
set -x fish_bin_dir $__fish_bin_dir
echo $fish_bin_dir
# The web_config tool is embedded in the binary, so extract it.
for f in (status list-files tools/web_config)
mkdir -p (path dirname $f)
status get-file $f > $f
end
cd tools/web_config
# if we don't set `delete=False`, the file will get cleaned up
# automatically (leading the test to fail because there's no