# Version is substituted by scripts/prepare-sources.sh. %global upstream_version 0.11.0 Name: kubectx Version: %{upstream_version} Release: 1%{?dist} Summary: Faster way to switch between clusters and namespaces in kubectl # kubectx itself is Apache-2.0. The rest comes from vendored Go modules. License: Apache-2.0 AND BSD-3-Clause AND ISC AND MIT URL: https://github.com/ahmetb/kubectx Source0: %{url}/archive/v%{upstream_version}/%{name}-%{upstream_version}.tar.gz # Produced by scripts/prepare-sources.sh with `go mod vendor`, because mock # builds without network access. Source1: %{name}-%{upstream_version}-vendor.tar.gz BuildRequires: golang >= 1.25 BuildRequires: go-rpm-macros # Interactive selection when called without arguments in a terminal. Recommends: fzf # Generated from vendor/modules.txt by scripts/prepare-sources.sh. Provides: bundled(golang(facette.io/natsort)) = 0.0.0~20181210072756~2cd4dd1e2dcb Provides: bundled(golang(github.com/davecgh/go-spew)) = 1.1.1 Provides: bundled(golang(github.com/emicklei/go-restful/v3)) = 3.12.2 Provides: bundled(golang(github.com/fatih/color)) = 1.19.0 Provides: bundled(golang(github.com/fxamacker/cbor/v2)) = 2.9.0 Provides: bundled(golang(github.com/go-errors/errors)) = 1.4.2 Provides: bundled(golang(github.com/go-logr/logr)) = 1.4.3 Provides: bundled(golang(github.com/go-openapi/jsonpointer)) = 0.21.0 Provides: bundled(golang(github.com/go-openapi/jsonreference)) = 0.20.2 Provides: bundled(golang(github.com/go-openapi/swag)) = 0.23.0 Provides: bundled(golang(github.com/google/gnostic-models)) = 0.7.0 Provides: bundled(golang(github.com/google/go-cmp)) = 0.7.0 Provides: bundled(golang(github.com/google/uuid)) = 1.6.0 Provides: bundled(golang(github.com/josharian/intern)) = 1.0.0 Provides: bundled(golang(github.com/json-iterator/go)) = 1.1.12 Provides: bundled(golang(github.com/mailru/easyjson)) = 0.7.7 Provides: bundled(golang(github.com/mattn/go-colorable)) = 0.1.14 Provides: bundled(golang(github.com/mattn/go-isatty)) = 0.0.20 Provides: bundled(golang(github.com/modern-go/concurrent)) = 0.0.0~20180306012644~bacd9c7ef1dd Provides: bundled(golang(github.com/modern-go/reflect2)) = 1.0.3~0.20250322232337~35a7c28c31ee Provides: bundled(golang(github.com/munnerz/goautoneg)) = 0.0.0~20191010083416~a7dc8b61c822 Provides: bundled(golang(github.com/spf13/pflag)) = 1.0.9 Provides: bundled(golang(github.com/x448/float16)) = 0.8.4 Provides: bundled(golang(go.yaml.in/yaml/v2)) = 2.4.3 Provides: bundled(golang(go.yaml.in/yaml/v3)) = 3.0.4 Provides: bundled(golang(golang.org/x/net)) = 0.47.0 Provides: bundled(golang(golang.org/x/oauth2)) = 0.30.0 Provides: bundled(golang(golang.org/x/sys)) = 0.42.0 Provides: bundled(golang(golang.org/x/term)) = 0.37.0 Provides: bundled(golang(golang.org/x/text)) = 0.31.0 Provides: bundled(golang(golang.org/x/time)) = 0.9.0 Provides: bundled(golang(google.golang.org/protobuf)) = 1.36.8 Provides: bundled(golang(gopkg.in/evanphx/json-patch.v4)) = 4.13.0 Provides: bundled(golang(gopkg.in/inf.v0)) = 0.9.1 Provides: bundled(golang(gopkg.in/yaml.v3)) = 3.0.1 Provides: bundled(golang(k8s.io/api)) = 0.35.3 Provides: bundled(golang(k8s.io/apimachinery)) = 0.35.3 Provides: bundled(golang(k8s.io/client-go)) = 0.35.3 Provides: bundled(golang(k8s.io/klog/v2)) = 2.130.1 Provides: bundled(golang(k8s.io/kube-openapi)) = 0.0.0~20250910181357~589584f1c912 Provides: bundled(golang(k8s.io/utils)) = 0.0.0~20251002143259~bc988d571ff4 Provides: bundled(golang(sigs.k8s.io/json)) = 0.0.0~20250730193827~2d320260d730 Provides: bundled(golang(sigs.k8s.io/kustomize/kyaml)) = 0.21.1 Provides: bundled(golang(sigs.k8s.io/randfill)) = 1.0.0 Provides: bundled(golang(sigs.k8s.io/structured-merge-diff/v6)) = 6.3.0 Provides: bundled(golang(sigs.k8s.io/yaml)) = 1.6.0 %description kubectx is a tool to switch between contexts (clusters) on kubectl faster. kubens is a tool to switch between Kubernetes namespaces (and configure them for kubectl) easily. %prep %autosetup -p1 # The vendor tarball unpacks to vendor/. tar -xzf %{SOURCE1} %build export GO111MODULE=on export GOFLAGS=-mod=vendor # goreleaser injects the tag without its leading "v". export LDFLAGS="-X main.version=%{version}" mkdir -p bin for cmd in kubectx kubens; do %gobuild -o bin/${cmd} ./cmd/${cmd} done %install install -Dpm0755 bin/kubectx %{buildroot}%{_bindir}/kubectx install -Dpm0755 bin/kubens %{buildroot}%{_bindir}/kubens install -Dpm0644 completion/kubectx.bash %{buildroot}%{bash_completions_dir}/kubectx install -Dpm0644 completion/kubens.bash %{buildroot}%{bash_completions_dir}/kubens install -Dpm0644 completion/_kubectx.zsh %{buildroot}%{zsh_completions_dir}/_kubectx install -Dpm0644 completion/_kubens.zsh %{buildroot}%{zsh_completions_dir}/_kubens install -Dpm0644 completion/kubectx.fish %{buildroot}%{fish_completions_dir}/kubectx.fish install -Dpm0644 completion/kubens.fish %{buildroot}%{fish_completions_dir}/kubens.fish # Collect the vendored modules' license texts for %%license. find vendor -type f \( -iname 'LICENSE*' -o -iname 'COPYING*' \ -o -iname 'NOTICE*' -o -iname 'PATENTS*' \) ! -name '*.go' \ -printf '%%%%license %%p\n' | sort > vendor-licenses.list %check export GO111MODULE=on export GOFLAGS=-mod=vendor go test ./... for cmd in kubectx kubens; do test "$(bin/${cmd} --version)" = "%{version}" done %files -f vendor-licenses.list %license LICENSE %doc README.md %{_bindir}/kubectx %{_bindir}/kubens %{bash_completions_dir}/kubectx %{bash_completions_dir}/kubens %{zsh_completions_dir}/_kubectx %{zsh_completions_dir}/_kubens %{fish_completions_dir}/kubectx.fish %{fish_completions_dir}/kubens.fish %changelog * Wed Oct 07 2026 Squiddim <82903357+Squiddim@users.noreply.github.com> - 0.11.0-1 - Update to upstream release 0.11.0 - https://github.com/ahmetb/kubectx/releases/tag/v0.11.0