File influx-cli.spec of Package influx-cli

#
# spec file for package influx-cli
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           influx-cli
Summary:        CLI for managing resources in InfluxDB
License:        MIT
Group:          Productivity/Databases/Servers
Version:        2.7.5
Release:        0
URL:            https://github.com/influxdata/influx-cli
Source:         %{name}-%{version}.tar.xz
Source99:       vendor.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  go >= 1.17
BuildRequires:  golang-packaging >= 15.0.8
BuildRequires:  systemd-rpm-macros

%description
CLI for managing resources in InfluxDB v2.

%package bash-completion
Summary:        Bash Completion for %{name}
Group:          Productivity/Databases/Servers
Requires:       bash-completion
Supplements:    (%{name} and bash)
BuildArch:      noarch

%description bash-completion
The official bash completion script for influx. It includes support
for every argument that can currently be passed to influx.

%package zsh-completion
Summary:        ZSH Completion for %{name}
Group:          Productivity/Databases/Servers
Supplements:    (%{name} and zsh)
BuildArch:      noarch

%description zsh-completion
The official zsh completion script for influx.

%prep
%setup -q
%setup -q -T -D -a 99

%build
export GO111MODULE=on
%goprep github.com/influxdata/influx-cli/v2
%gobuild -mod=vendor -ldflags="-X main.version=%{version}" cmd/...

%install
install -D -m 0755 -t %{buildroot}%{_bindir} %{_builddir}/go/bin/*

mkdir -p %{buildroot}/%{_datadir}/bash-completion/completions
%{_builddir}/go/bin/influx completion bash > %{buildroot}/%{_datadir}/bash-completion/completions/influx

mkdir -p %{buildroot}/%{_datadir}/zsh/site-functions
%{_builddir}/go/bin/influx completion zsh > %{buildroot}/%{_datadir}/zsh/site-functions/_influx

%files
%license LICENSE
%doc README.md CHANGELOG.md
%{_bindir}/influx

%files bash-completion
%{_datadir}/bash-completion

%files zsh-completion
%{_datadir}/zsh

%changelog
openSUSE Build Service is sponsored by