# Generated by go2rpm 1.8.2
%bcond_without check
%bcond_with bootstrap
%if %{with bootstrap}
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^golang\\(.*\\)$
%endif
# https://github.com/etcd-io/etcd
%global goipath go.etcd.io/etcd
%global forgeurl https://github.com/etcd-io/etcd
Version: 3.5.10
%gometa
%global common_description %{expand:
Distributed reliable key-value store for the most critical data of a distributed
system.}
%global golicenses LICENSE NOTICE
%global godocs CONTRIBUTING.md README.md Documentation\\\
README-*.md READMEv2-etcdctl.md
%global gosupfiles client/v2/example_keys_test.go\\\
client/v3/clientv3util/example_key_test.go\\\
client/v3/concurrency/example_election_test.go\\\
client/v3/concurrency/example_mutex_test.go\\\
client/v3/concurrency/example_stm_test.go\\\
client/v3/example_auth_test.go\\\
client/v3/example_cluster_test.go\\\
client/v3/example_kv_test.go\\\
client/v3/example_lease_test.go\\\
client/v3/example_maintenance_test.go\\\
client/v3/example_metrics_test.go\\\
client/v3/example_test.go\\\
client/v3/example_watch_test.go
Name: etcd
Release: %autorelease
Summary: Distributed reliable key-value store for the most critical data of a distributed system
License: Apache-2.0
URL: %{gourl}
# git archive -o ../etcd-3.5.10.tar.gz --prefix=etcd-3.5.10/ v3.5.10
Source0: %{gosource}
Source1: %{name}.service
Source2: %{name}.conf
BuildRequires: python3-devel
BuildRequires: systemd-rpm-macros
Requires(pre): shadow-utils
%description %{common_description}
%gopkg
%prep
%goprep -k
rm -rf vendor/
rm -rf cmd/vendor
rm -rf raft/rafttest
for d in contrib etcdctl etcdutl pkg raft hack security; do
mv $d/README.md README-$d.md
done
mv etcdctl/READMEv2.md READMEv2-etcdctl.md
mv client/v2/README.md README-clientv2.md
mv client/v3/README.md README-clientv3.md
mkdir -p api/v3/ client/pkg/v3 etcdctl/v3 etcdutl/v3 pkg/v3 raft/v3 server/v3 tools/v3
shopt -s extglob
mv api/!(v3) api/v3/.
mv client/pkg/!(v3) client/pkg/v3/.
mv etcdctl/!(v3) etcdctl/v3/.
mv etcdutl/!(v3) etcdutl/v3/.
mv pkg/!(v3) pkg/v3/.
mv raft/!(v3) raft/v3/.
mv server/!(v3) server/v3/.
mv tools/!(v3) tools/v3/.
shopt -u extglob
%if %{without bootstrap}
%generate_buildrequires
%go_generate_buildrequires
%build
%gobuild -o %{gobuilddir}/bin/etcd %{goipath}/server/v3
%gobuild -o %{gobuilddir}/bin/etcdctl %{goipath}/etcdctl/v3
%gobuild -o %{gobuilddir}/bin/etcdutl %{goipath}/etcdutl/v3
%endif
%install
%gopkginstall
%if %{without bootstrap}
install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
install -Dpm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -dm 0755 %{buildroot}%{_sysconfdir}/%{name}
install -pm 644 -t %{buildroot}%{_sysconfdir}/%{name} %{SOURCE2}
# And create /var/lib/etcd
install -dm 0755 %{buildroot}%{_sharedstatedir}/%{name}
%if %{with check}
%check
%gocheck -d client/v2 \
-d client/v3 \
-d raft/v3 \
-d server/v3/auth \
-d server/v3/wal/walpb \
-d tests/e2ev \
-d tests/integration \
-d tests/e2e \
-d tests/integration/client \
-t tests/integration/clientv3 \
-d server/v3/etcdserver/api/membership \
-d server/v3/mvcc/backend \
-d pkg/v3/proxy
%endif
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{_sharedstatedir}/%{name} \
-s /sbin/nologin -c "etcd user" %{name}
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun %{name}.service
%files
%license LICENSE
%doc CONTRIBUTING.md README.md
%doc Documentation README-*.md READMEv2-etcdctl.md
%{_bindir}/*
%config(noreplace) %{_sysconfdir}/%{name}
%dir %attr(-,%{name},%{name}) %{_sharedstatedir}/%{name}
%{_unitdir}/%{name}.service
%endif
%gopkgfiles
%changelog
%autochangelog