etcd/etcd.spec
2021-02-02 16:58:51 +08:00

214 lines
7.4 KiB
RPMSpec

# Generated by go2rpm
%bcond_without check
%bcond_with bootstrap
%define debug_package %{nil}
# https://github.com/etcd-io/etcd
%global goipath go.etcd.io/etcd
%global forgeurl https://github.com/etcd-io/etcd
Version: 3.4.14
%gometa
%global goipaths0 go.etcd.io/etcd
%global goipathsex0 go.etcd.io/etcd/etcdserver/api/v3rpc/
%if %{without bootstrap}
%global goipaths1 go.etcd.io/etcd/etcdserver/api/v3rpc/
%endif
%global goaltipaths github.com/coreos/etcd go.etcd.io/etcd/v3
%global man_version 3.4.14
%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 integration/fixtures/* etcdserver/api/v2http/testdata/*
Name: etcd
Release: 1
Summary: Distributed reliable key-value store for the most critical data of a distributed system
# Upstream license specification: Apache-2.0
License: ASL 2.0 and MIT
URL: https://github.com/etcd-io/etcd
Source0: %{gosource}
Source1: %{name}.service
Source2: %{name}.conf
Source3: man-%{man_version}.tar.gz
# sh genmanpages.sh path_to_built_source
Source10: genmanpages.sh
# update grpc-go version to v1.32.0
Patch1: 0001-Convert-int-to-string-using-strconv.Itoa.patch
BuildRequires: go-compilers-golang-compiler
# BuildRequires: golang(github.com/bgentry/speakeasy)
# # BuildRequires: golang(github.com/cockroachdb/datadriven)
# BuildRequires: golang(github.com/coreos/go-semver/semver)
# BuildRequires: golang(github.com/coreos/go-systemd/daemon)
# BuildRequires: golang(github.com/coreos/go-systemd/journal)
# BuildRequires: golang(github.com/coreos/pkg/capnslog)
# BuildRequires: golang(github.com/creack/pty)
# BuildRequires: golang(github.com/dgrijalva/jwt-go)
# BuildRequires: golang(github.com/dustin/go-humanize)
# BuildRequires: golang(github.com/gogo/protobuf/gogoproto)
# BuildRequires: golang(github.com/gogo/protobuf/proto)
# BuildRequires: golang(github.com/golang/groupcache/lru)
# BuildRequires: golang(github.com/golang/protobuf/proto)
# BuildRequires: golang(github.com/google/btree)
# BuildRequires: golang(github.com/google/uuid)
# %%if %%{without bootstrap}
# BuildRequires: golang(github.com/grpc-ecosystem/go-grpc-middleware)
# %endif
# BuildRequires: golang(github.com/grpc-ecosystem/go-grpc-prometheus)
# BuildRequires: golang(github.com/grpc-ecosystem/grpc-gateway/runtime)
# BuildRequires: golang(github.com/grpc-ecosystem/grpc-gateway/utilities)
# BuildRequires: golang(github.com/jonboulle/clockwork)
# BuildRequires: golang(github.com/json-iterator/go)
# BuildRequires: golang(github.com/modern-go/reflect2)
# BuildRequires: golang(github.com/olekukonko/tablewriter)
# BuildRequires: golang(github.com/prometheus/client_golang/prometheus)
# BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promhttp)
# BuildRequires: golang(github.com/soheilhy/cmux)
# BuildRequires: golang(github.com/spf13/cobra)
# BuildRequires: golang(github.com/spf13/pflag)
# BuildRequires: golang(github.com/tmc/grpc-websocket-proxy/wsproxy)
# BuildRequires: golang(github.com/urfave/cli)
# BuildRequires: golang(github.com/xiang90/probing)
# BuildRequires: golang(go.etcd.io/bbolt)
# BuildRequires: golang(go.uber.org/zap)
# BuildRequires: golang(go.uber.org/zap/zapcore)
# BuildRequires: golang(golang.org/x/crypto/bcrypt)
# BuildRequires: golang(golang.org/x/net/context)
# BuildRequires: golang(golang.org/x/net/http2)
# BuildRequires: golang(golang.org/x/net/trace)
# BuildRequires: golang(golang.org/x/time/rate)
# BuildRequires: golang(google.golang.org/grpc)
# BuildRequires: golang(google.golang.org/grpc/balancer)
# BuildRequires: golang(google.golang.org/grpc/codes)
# BuildRequires: golang(google.golang.org/grpc/connectivity)
# BuildRequires: golang(google.golang.org/grpc/credentials)
# BuildRequires: golang(google.golang.org/grpc/grpclog)
# BuildRequires: golang(google.golang.org/grpc/health)
# BuildRequires: golang(google.golang.org/grpc/health/grpc_health_v1)
# BuildRequires: golang(google.golang.org/grpc/keepalive)
# BuildRequires: golang(google.golang.org/grpc/metadata)
# # BuildRequires: golang(google.golang.org/grpc/naming)
# BuildRequires: golang(google.golang.org/grpc/peer)
# BuildRequires: golang(google.golang.org/grpc/resolver)
# BuildRequires: golang(google.golang.org/grpc/resolver/dns)
# BuildRequires: golang(google.golang.org/grpc/resolver/passthrough)
# BuildRequires: golang(google.golang.org/grpc/status)
# BuildRequires: golang(gopkg.in/cheggaaa/pb.v1)
# BuildRequires: golang(gopkg.in/yaml.v2)
# BuildRequires: golang(sigs.k8s.io/yaml)
BuildRequires: openEuler-rpm-config
BuildRequires: python3-devel
# BuildRequires: %%{py3_dist sphinx sphinx-rtd-theme}
%{?systemd_requires}
BuildRequires: systemd
Requires(pre): shadow-utils
%if %{with check}
# Tests
# BuildRequires: golang(github.com/prometheus/client_model/go)
%endif
%description
%{common_description}
%gopkg
%prep
%setup -q -n man-%{man_version} -T -b 3
%forgesetup
%patch1 -p1
# For compatibility
cp -aR etcdserver/api/snap snap
cp -aR etcdserver/api/membership etcdserver/membership
cp -aR etcdserver/api/v2store store
for d in client clientv3 contrib etcdctl functional hack; do
mv $d/README.md README-$d.md
done
mv etcdctl/READMEv2.md READMEv2-etcdctl.md
mkdir -p man/man1
cp ../man-%{man_version}/*.1 man/man1/.
%if %{without bootstrap}
%build
GO111MODULE=on GOFLAGS=-mod=vendor go build -o %{gobuilddir}/bin/etcd %{goipath}
for cmd in etcdctl; do
GO111MODULE=on GOFLAGS=-mod=vendor go build -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done
%endif
# make -C docs help
# make -C docs html
%install
%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}
# install manpages
install -d %{buildroot}%{_mandir}/man1
install -pm 644 man/man1/* %{buildroot}%{_mandir}/man1
# And create /var/lib/etcd
install -dm 0755 %{buildroot}%{_sharedstatedir}/%{name}
%endif
%if %{without bootstrap}
%if %{with check}
%check
GO111MODULE=on GOFLAGS=-mod=vendor go test $( GO111MODULE=on GOFLAGS=-mod=vendor go list ./... | grep -v -E "tlsutil|expect|tester|integration|e2e|backend|auth|ordering|snapshot|etcdserver|mvcc")
%endif
%endif
%if %{without bootstrap}
%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 NOTICE
%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
%{_mandir}/man1/*.1*
%endif
%changelog
* Thu Jan 21 2021 jiangxinyu <jiangxinyu@kylinos.cn> - 3.4.14-1
- Update to 3.4.14
* Thu Aug 13 2020 jiangxinyu <jiangxinyu@kylinos.cn> - 3.4.7-1
- Init etcd project