From b06c5c7e8159ab3141a8efc45aabc5c8bc0b3b2d Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Fri, 21 Feb 2025 12:52:33 -0800 Subject: [PATCH] fzf: fix go cache protection to allow delete (#49151) --- .../repos/builtin/packages/fzf/package.py | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/var/spack/repos/builtin/packages/fzf/package.py b/var/spack/repos/builtin/packages/fzf/package.py index 249728d2964..85d15f50621 100644 --- a/var/spack/repos/builtin/packages/fzf/package.py +++ b/var/spack/repos/builtin/packages/fzf/package.py @@ -7,7 +7,7 @@ from spack.package import * -class Fzf(MakefilePackage): +class Fzf(GoPackage): """A general-purpose command-line fuzzy finder that provides fast, interactive filtering for files, processes, git commits, and more. It supports fuzzy search with real-time preview and various input sources.""" @@ -21,7 +21,6 @@ class Fzf(MakefilePackage): license("MIT") sanity_check_is_file = ["bin/fzf"] - sanity_check_is_dir = ["share/fzf/shell"] # Versions from newest to oldest version("master", branch="master") @@ -64,26 +63,22 @@ def url_for_version(self, version): def setup_build_environment(self, env): """Set up the build environment for fzf.""" - # Point GOPATH at the top of the staging dir for the build step - env.prepend_path("GOPATH", self.stage.path) + # Setup build env from GoPackage builder + super().setup_build_environment(env) # Set required environment variables for non-git builds env.set("FZF_VERSION", self.spec.version) env.set("FZF_REVISION", "tarball") - def install(self, spec, prefix): - """Install fzf and its components.""" - make("install") + @run_after("install") + def install_completions(self): + mkdirp(bash_completion_path(self.prefix)) + mkdirp(zsh_completion_path(self.prefix)) - # Install binary - mkdir(prefix.bin) - install("bin/fzf", prefix.bin) + install("shell/completion.bash", bash_completion_path(self.prefix) / "fzf.bash") + install("shell/completion.zsh", zsh_completion_path(self.prefix) / "_fzf") - # Install shell integration scripts - mkdirp(prefix.share.fzf.shell) - install_tree("shell", prefix.share.fzf.shell) - - # Install vim plugin if requested - if spec.satisfies("+vim"): - mkdirp(prefix.share.fzf.plugins) - install("plugin/fzf.vim", prefix.share.fzf.plugins) + @run_after("install", when="+vim") + def install_vim_plugin(self): + mkdirp(self.prefix.share.fzf.plugins) + install("plugin/fzf.vim", self.prefix.share.fzf.plugins)