File step-cli.spec of Package step-cli
#
# spec file for package step-cli
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%define configdir /etc/step-ca
%define datadir /var/lib/step-ca
%define user_group _step-ca
Name: step-cli
Version: 0.14.0~rc4
Release: 1
%define pkg_name cli
%define pkg_version 0.14.0-rc.4
Summary: Smallstep CA - CLI
License: Apache-2.0
Group: Productivity/Networking/Security
Url: https://smallstep.com/cli
# https://github.com/smallstep/cli/releases
Source: %{pkg_name}-%{pkg_version}.tar.gz
Source1: vendor.tar.xz
BuildRequires: golang-packaging
BuildRequires: golang(API) >= 1.14
BuildRequires: golang-github-golang-dep
Conflicts: step
%go_nostrip
%description
A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
%package bash-completion
Summary: Bash Completion for %{name}
Group: Productivity/Networking/Security
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: packageand(%{name}:bash-completion)
BuildArch: noarch
%description bash-completion
Bash completion script for %{name}.
%package zsh-completion
Summary: ZSH completion for %{name}
Group: Productivity/Networking/Security
Supplements: packageand(%{name}:zsh)
BuildArch: noarch
%description zsh-completion
zsh shell completions for %{name}.
%prep
%autosetup -p1 -n %{pkg_name}-%{pkg_version} -a 1
%build
%goprep github.com/smallstep/cli/
source_date=$(date -u '+%Y-%m-%d %H:%M UTC' -d "@${SOURCE_DATE_EPOCH}")
%gobuild -mod=vendor -ldflags="-w -X 'main.Version=%{version}' -X 'main.BuildTime=${source_date}'" cmd/...
%install
%goinstall
# replaced with the Conflict of the step package
# mv %{buildroot}%{_bindir}/step{,-cli}
# shell completions
sed -i -e '/^#!\ \//, 1d' autocomplete/bash_autocomplete
install -Dm0644 autocomplete/bash_autocomplete %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm0644 autocomplete/zsh_autocomplete %{buildroot}%{_sysconfdir}/zsh_completion.d/%{name}
%files
%doc README.md
%license LICENSE
%{_bindir}/step*
%files bash-completion
%{_datadir}/bash-completion/completions/%{name}
%files zsh-completion
%dir %{_sysconfdir}/zsh_completion.d
%config %{_sysconfdir}/zsh_completion.d/%{name}