Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37570516
en ru br
ALT Linux repos
S:3.5.9-alt1

Group :: System/Servers
RPM: etcd

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

%global import_path github.com/etcd-io/etcd

%define etcd_group etcd
%define etcd_user  etcd

%global _unpackaged_files_terminate_build 1

Name:    etcd
Version: 3.5.9
Release: alt1
Summary: A highly-available key value store for shared configuration
Group:   System/Servers

URL:     https://etcd.io/
License: Apache-2.0

Source0: %name-%version.tar

ExclusiveArch: %go_arches
BuildRequires(pre): rpm-build-golang

%description
Etcd is a distributed key value store that provides a reliable way to store data
across a cluster of machines. Etcd gracefully handles leader elections during network
partitions and will tolerate machine failure, including the leader.

%prep
%setup -q

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

%build
export CGO_ENABLED=0
export BUILDDIR="$PWD/.build"
export IMPORT_PATH="%import_path"
export LDFLAGS="-X %import_path/version.GitSHA=%release"

%golang_prepare

cd .build/src/%import_path

%golang_build \
   server \
   etcdctl \
   etcdutl \
   tools/etcd-dump-db \
   tools/etcd-dump-logs \
   tools/etcd-dump-metrics \
#

%install
export BUILDDIR="$PWD/.build"

%golang_install

mkdir -p -- \
   %buildroot%_sbindir \
   %buildroot%_unitdir \
   %buildroot%_sysconfdir/%name \
   %buildroot%_sharedstatedir/%name \
#

mv -f -- %buildroot%_bindir/server %buildroot%_sbindir/%name

sed \
   -e 's, at USER at ,%etcd_user,g' \
   -e 's, at STATEDIR at ,%_sharedstatedir/%name,g' \
   -e 's, at SYSCONFDIR at ,%_sysconfdir/%name,g' \
   -e 's, at BINDIR at ,%_sbindir,g' \
   < rpm/etcd.service > %buildroot%_unitdir/%name.service

install -D -p -m 0644 rpm/etcd.conf    %buildroot%_sysconfdir/%name/%name.conf

# remove unused files

rm -rf -- %buildroot/%go_root

%pre
groupadd -r -f %etcd_group
useradd -r -g %etcd_group -d /dev/null -s /dev/null -n %etcd_user >/dev/null 2>&1 ||:

%post
%post_service %name

%preun
%preun_service %name

%files
%doc README.md etcd.conf.yml.sample
%doc README-*.md READMEv2-etcdctl.md
%dir %attr(770,%etcd_user,%etcd_group) %_sharedstatedir/%name
%dir %_sysconfdir/%name
%config(noreplace) %_sysconfdir/%name/%name.conf
%_bindir/*
%_sbindir/*
%_unitdir/%name.service

%changelog

Full changelog you can see here

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin