- vendor-update.sh: Fix static /tmp file issue (bsc#1199031)

OBS-URL: https://build.opensuse.org/package/show/devel:kubic/etcd?expand=0&rev=29
This commit is contained in:
Alexandre Vicenzi 2024-10-07 13:31:30 +00:00 committed by Git OBS Bridge
commit 1912d74762
13 changed files with 2477 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

10
README.security Normal file
View File

@ -0,0 +1,10 @@
By default etcd doesn't require authentication. If you configure etcd to be reachable
over the network, have untrustworthy local users on the system where etc runs or store
data in etcd that needs to be kept confidential please make sure to enable authentication.
You can do that by configuring the settings under [security] in /etc/sysconfig/etcd.
For additional guidance please read
https://etcd.io/docs/v3.5/op-guide/configuration/#security
and
https://etcd.io/docs/v3.5/op-guide/authentication
to ensure that you enforce proper access control

19
_service Normal file
View File

@ -0,0 +1,19 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="url">https://github.com/etcd-io/etcd.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="revision">v3.5.12</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="changesgenerate">enable</param>
<param name="versionrewrite-pattern">v(.*)</param>
</service>
<service mode="disabled" name="set_version">
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="go_modules" mode="disabled">
</service>
</services>

8
_servicedata Normal file
View File

@ -0,0 +1,8 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/coreos/etcd.git</param>
<param name="changesrevision">94745a4eed0425653b3b4275a208d38babceeaec</param></service><service name="tar_scm">
<param name="url">git://github.com/etcd-io/etcd.git</param>
<param name="changesrevision">99018a77bea9a9d29962e5169876c64e02739c52</param></service><service name="tar_scm">
<param name="url">https://github.com/etcd-io/etcd.git</param>
<param name="changesrevision">e7b3bb6ccac840770f108ef9a0f013fa51b83256</param></service></servicedata>

3
etcd-3.5.12.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de10f81bb463e1e057d3a76eaf252c360e5b2b082f2b646539b1ab6e1509d84e
size 4138338

2113
etcd.changes Normal file

File diff suppressed because it is too large Load Diff

56
etcd.conf Normal file
View File

@ -0,0 +1,56 @@
# set commandline options
# example: ETCD_OPTIONS="--enable-v2=true" to enable the v2 API
#ETCD_OPTIONS=
# [member]
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR=""
#ETCD_SNAPSHOT_COUNT="10000"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
# Before changing this setting allowing etcd to be reachable over the network
# or if you have untrustworthy local users on the system where etc runs please
# make sure to enable authentication in the [security] section below. Please
# also read README.security for this package
#ETCD_LISTEN_PEER_URLS="http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
#ETCD_CORS=""
#
#[cluster]
#ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..."
#ETCD_INITIAL_CLUSTER="default=http://localhost:2380"
#ETCD_INITIAL_CLUSTER_STATE="new"
#ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
#ETCD_DISCOVERY=""
#ETCD_DISCOVERY_SRV=""
#ETCD_DISCOVERY_FALLBACK="proxy"
#ETCD_DISCOVERY_PROXY=""
#
#[security]
#ETCD_CERT_FILE=""
#ETCD_KEY_FILE=""
#ETCD_CLIENT_CERT_AUTH="false"
#ETCD_TRUSTED_CA_FILE=""
#ETCD_PEER_CERT_FILE=""
#ETCD_PEER_KEY_FILE=""
#ETCD_PEER_CLIENT_CERT_AUTH="false"
#ETCD_PEER_TRUSTED_CA_FILE=""
#
#[logging]
#ETCD_LOG_LEVEL="debug"
# examples for -log-package-levels etcdserver=WARNING,security=DEBUG
#ETCD_LOG_PACKAGE_LEVELS=""
#
#[proxy] Note: flags will be deprecated in v3.6. "proxy" supports v2 API only.
#ETCD_PROXY="off"
#ETCD_PROXY_FAILURE_WAIT="5000"
#ETCD_PROXY_REFRESH_INTERVAL="30000"
#ETCD_PROXY_DIAL_TIMEOUT="1000"
#ETCD_PROXY_WRITE_TIMEOUT="5000"
#ETCD_PROXY_READ_TIMEOUT="0"

34
etcd.service Normal file
View File

@ -0,0 +1,34 @@
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions
Type=notify
WorkingDirectory=/var/lib/etcd/
EnvironmentFile=-/etc/sysconfig/etcd
User=etcd
# set GOMAXPROCS to number of processors
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/sbin/etcd $ETCD_OPTIONS"
Restart=on-failure
LimitNOFILE=65536
Nice=-10
IOSchedulingClass=best-effort
IOSchedulingPriority=2
[Install]
WantedBy=multi-user.target

154
etcd.spec Normal file
View File

@ -0,0 +1,154 @@
#
# spec file for package etcd
#
# Copyright (c) 2024 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/
#
%define project go.etcd.io/etcd
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
Name: etcd
Version: 3.5.12
Release: 0
Summary: Highly-available key value store for configuration and service discovery
License: Apache-2.0
Group: System/Management
URL: https://github.com/etcd-io/etcd
Source: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
Source11: %{name}.conf
Source12: %{name}.service
Source15: README.security
Source16: system-user-etcd.conf
Source17: vendor-update.sh
BuildRequires: golang(API) >= 1.20
BuildRequires: golang-packaging
BuildRequires: systemd-rpm-macros
BuildRequires: sysuser-tools
BuildRequires: xz
Requires(post): %fillup_prereq
ExcludeArch: s390 %{ix86}
%sysusers_requires
%description
etcd is a distributed, consistent key-value store for shared configuration and
service discovery, with a focus on being:
- Simple: well-defined, user-facing API (gRPC)
- Secure: automatic TLS with optional client cert authentication
- Fast: benchmarked 10,000 writes/sec
- Reliable: properly distributed using Raft
%package -n etcdctl
Summary: A simple command line client for etcd
Group: System/Management
%description -n etcdctl
A command line client for etcd. It can be used in scripts or for administrators
to explore an etcd cluster.
%package -n etcdutl
Summary: A simple command line client for etcd
Group: System/Management
%description -n etcdutl
A command line administration utility for etcd.
It's designed to operate directly on etcd data files.
For operations over a network, please use `etcdctl`.
%prep
%setup -q -a1
cp %{SOURCE15} .
cp -rla vendor/* ./ && rm -r vendor/
%build
%{goprep} %{project}
mkdir -p ./bin
dir=$(pwd)
for item in server etcdctl etcdutl;do
cd "$dir/$item"
go build -v \
-buildmode=pie \
-mod=vendor \
-trimpath \
-ldflags="-s -w -X main.Version=%{version}" \
-o ../bin/"$item"
done
cd "$dir"
%sysusers_generate_pre %{SOURCE16} %{name} system-user-etcd.conf
%install
install -d %{buildroot}%{_sbindir}
install -D -m 0755 ./bin/server %{buildroot}%{_sbindir}/etcd
install -d %{buildroot}/%{_bindir}
install -D -m 0755 ./bin/etcdctl %{buildroot}%{_bindir}/etcdctl
install -D -m 0755 ./bin/etcdutl %{buildroot}%{_bindir}/etcdutl
# Service
install -D -p -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}.service
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
# Sysconfig
install -D -p -m 0644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.%{name}
# Additional
install -d -m 750 %{buildroot}%{_localstatedir}/lib/%{name}
install -Dm0644 %{SOURCE16} %{buildroot}%{_sysusersdir}/system-user-etcd.conf
%pre -f %{name}.pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%{fillup_only -n %{name}}
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license LICENSE
%doc CONTRIBUTING.md README.md DCO README.security
%{_sbindir}/%{name}
%{_sysusersdir}/system-user-etcd.conf
# Service
%{_unitdir}/%{name}.service
%{_sbindir}/rc%{name}
# Sysconfig
%{_fillupdir}/sysconfig.%{name}
# Additional
%dir %attr(0750,%{name},%{name}) %{_localstatedir}/lib/%{name}
%files -n etcdctl
%{_bindir}/etcdctl
%doc etcdctl/README.md etcdctl/READMEv2.md
%files -n etcdutl
%{_bindir}/etcdutl
%doc etcdutl/README.md
%changelog

2
system-user-etcd.conf Normal file
View File

@ -0,0 +1,2 @@
#Type Name ID GECOS Home directory Shell
u etcd - "etcd daemon" /var/lib/etcd -

51
vendor-update.sh Normal file
View File

@ -0,0 +1,51 @@
#!/usr/bin/bash
#
# Script to update the vendor tarball
# Author: Elisei Roca
#------------------------------------
set -eo pipefail
# set -x
NAME=etcd
STACK=("server" "etcdctl" "etcdutl")
VERSION=$(grep -oP '(?<=Version:)(.*)' etcd.spec | xargs)
[ ! -f "$NAME-$VERSION".tar.gz ] && echo "$NAME-$VERSION.tar.gz does not exist" && exit 1
echo "Updating vendor file..."
tempdir="$(mktemp -d --suffix=.etcd)"
function cleanup() {
rm -rf "${tempdir}"
}
trap cleanup EXIT
mkdir -p "${tempdir}/vendor"
tar --strip-components=1 -xvf "$NAME-$VERSION".tar.gz -C "${tempdir}" &> /dev/null
dir=$(pwd)
for item in ${STACK[*]}; do
mkdir "${tempdir}/vendor/${item}"
cd "${tempdir}/${item}"
go mod vendor
mv vendor/ ../vendor/"$item"
done
cd "$dir"
fdupes -r -1 "${tempdir}/vendor/" |
while read line; do
target="";
for file in ${line[*]}; do
if [ "x${target}" == "x" ]; then
target=$file;
else
ln -f "${target}" "${file}";
fi;
done;
done
tar -czvf vendor.tar.gz -C "${tempdir}" vendor &> /dev/null
echo "Repacked to vendor.tar.gz"

3
vendor.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b617a120bb3aba3a12f7c06a129ecfbdacbe1456a0470e4cc73e4aeb3a9732be
size 5406488