syncthing 2.0.5

This commit is contained in:
Hadrien Dussuel
2025-09-03 10:51:03 +02:00
parent d0418bc437
commit d465dde2aa
16 changed files with 347 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST syncthing-source-v2.0.5.tar.gz 62659547 BLAKE2B 27867445d2dccc21a363b203ced17515d7189f7c2f07e3e2617af28edb1299bf8f73f8a1c95f5e11887bc326ee791027df01d00cdbe42d617931c8aca29afaf1 SHA512 0e489bd409d52fca08221ac3d016125961b4c1d37e5de9db7be2e3703c78d12a436c61a3c6ca66891de5f53f5e22542308563fee88a5fa432ede5ed47321b113

View File

@@ -0,0 +1,3 @@
# Options to pass to discosrv
# see /usr/libexec/syncthing/stdiscosrv --help for more information
SD_OPTS=

View File

@@ -0,0 +1,27 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
SD_USER=stdiscosrv
SD_GROUP=syncthing
SD_HOMEDIR=/var/lib/syncthing-discosrv
SD_LOGFILE=/var/log/syncthing/discosrv.log
description="Discovery service for syncthing"
command="/usr/libexec/syncthing/stdiscosrv"
command_args="${SD_OPTS}"
pidfile="/run/syncthing-discosrv.pid"
command_background="yes"
command_user="${SD_USER}:${SD_GROUP}"
directory="${SD_HOMEDIR}"
output_log="${SD_LOGFILE}"
error_log="${SD_LOGFILE}"
depend() {
need net
}
start_pre() {
checkpath -q -d -o ${SD_USER}:${SD_GROUP} ${SD_HOMEDIR}
checkpath -q -f -o ${SD_USER}:${SD_GROUP} ${SD_LOGFILE}
}

View File

@@ -0,0 +1,6 @@
/var/log/syncthing/stdiscosrv.log {
missingok
notifempty
sharedscripts
copytruncate
}

View File

@@ -0,0 +1,3 @@
# Options to pass to relaysrv
# see /usr/libexec/syncthing/strelaysrv --help for more information
SR_OPTS=

View File

@@ -0,0 +1,27 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
SR_USER=strelaysrv
SR_GROUP=syncthing
SR_HOMEDIR=/var/lib/syncthing-relaysrv
SR_LOGFILE=/var/log/syncthing/relaysrv.log
description="Relay service for syncthing"
command="/usr/libexec/syncthing/strelaysrv"
command_args="${SR_OPTS}"
pidfile="/run/syncthing-relaysrv.pid"
command_background="yes"
command_user="${SR_USER}:${SR_GROUP}"
directory="${SR_HOMEDIR}"
output_log="${SR_LOGFILE}"
error_log="${SR_LOGFILE}"
depend() {
need net
}
start_pre() {
checkpath -q -d -o ${SR_USER}:${SR_GROUP} ${SR_HOMEDIR}
checkpath -q -f -o ${SR_USER}:${SR_GROUP} ${SR_LOGFILE}
}

View File

@@ -0,0 +1,6 @@
/var/log/syncthing/strelaysrv.log {
missingok
notifempty
sharedscripts
copytruncate
}

View File

@@ -0,0 +1,25 @@
Let us save ourselves the pain of messing with renamed system accounts
use the old names, for now at least.
--- a/cmd/stdiscosrv/etc/linux-systemd/stdiscosrv.service
+++ b/cmd/stdiscosrv/etc/linux-systemd/stdiscosrv.service
@@ -9,7 +9,7 @@
ExecStart=/usr/bin/stdiscosrv $DISCOSRV_OPTS
# Hardening
-User=syncthing-discosrv
+User=stdiscosrv
Group=syncthing
ProtectSystem=strict
ReadWritePaths=/var/lib/syncthing-discosrv
--- a/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service
+++ b/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service
@@ -9,7 +9,7 @@
ExecStart=/usr/bin/strelaysrv -nat=${NAT} $RELAYSRV_OPTS
# Hardening
-User=syncthing-relaysrv
+User=strelaysrv
Group=syncthing
ProtectSystem=strict
ReadWritePaths=/var/lib/syncthing-relaysrv

View File

@@ -0,0 +1,25 @@
--- a/build.go
+++ b/build.go
@@ -32,8 +32,6 @@
"strings"
"text/template"
"time"
-
- buildpkg "github.com/syncthing/syncthing/lib/build"
)
var (
@@ -409,13 +409,6 @@
}
args = append(args, "-timeout", timeout)
- if runtime.GOARCH == "amd64" {
- switch runtime.GOOS {
- case buildpkg.Darwin, buildpkg.Linux, buildpkg.FreeBSD: // , "windows": # See https://github.com/golang/go/issues/27089
- args = append(args, "-race")
- }
- }
-
if coverage {
args = append(args, "-covermode", "atomic", "-coverprofile", "coverage.txt", "-coverpkg", strings.Join(pkgs, ","))
}

View File

@@ -0,0 +1,15 @@
This patch removes conditional appending of "-race" flag.
It is needed as we build in PIE mode and race is incompatible with that.
https://bugs.gentoo.org/955442
--- a/build.go
+++ b/build.go
@@ -396,7 +396,7 @@
}
args = append(args, "-timeout", timeout)
- if runtime.GOARCH == "amd64" {
+ if false {
switch runtime.GOOS {
case buildpkg.Darwin, buildpkg.Linux, buildpkg.FreeBSD: // , "windows": # See https://github.com/golang/go/issues/27089
args = append(args, "-race")

View File

@@ -0,0 +1,18 @@
As of early April 2020, running the Syncthing test suite on the Gentoo ppc64
buildhost fails due to TestIssue5063 timing out. Increase the time-out
threshold for this test to allow it to pass.
Other arches we currently support (i.e. amd64, arm and x86) shouldn't be
affected by the change because thay have always passed so far anyway.
--- a/lib/model/model_test.go
+++ b/lib/model/model_test.go
@@ -914,7 +914,7 @@
}()
select {
case <-finished:
- case <-time.After(10 * time.Second):
+ case <-time.After(20 * time.Second):
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
t.Fatal("Timed out before all devices were added")
}

View File

@@ -0,0 +1,28 @@
# /etc/conf.d/syncthing: config file for /etc/init.d/syncthing
# User and group as which to run
#SYNCTHING_USER="syncthing"
#SYNCTHING_GROUP="syncthing"
# Configuration directory
#SYNCTHING_HOMEDIR="/var/lib/syncthing/.config/syncthing"
# Log file location
#SYNCTHING_LOGFILE="/var/log/syncthing/syncthing.log"
# umask used to create files
# The default allows group access
#SYNCTHING_UMASK=007
# I/O nice level of syncthing
#SYNCTHING_IONICE="0"
# Nice level of syncthing
#SYNCTHING_NICE="0"
# Where the syncthing GUI should listen. Can be a http(s) URI or a Unix domain socket
#SYNCTHING_GUI_ADDRESS="http://127.0.0.1:8384"
#SYNCTHING_GUI_ADDRESS="unix:/run/syncthing.sock"
# Extra options for syncthing
#SYNCTHING_OPTS=""

View File

@@ -0,0 +1,33 @@
#!/sbin/openrc-run
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
SYNCTHING_USER=${SYNCTHING_USER:-syncthing}
SYNCTHING_GROUP=${SYNCTHING_GROUP:-syncthing}
SYNCTHING_HOMEDIR=${SYNCTHING_HOMEDIR:-/var/lib/syncthing/.config/syncthing}
SYNCTHING_LOGFILE=${SYNCTHING_LOGFILE:-/var/log/syncthing/syncthing.log}
SYNCTHING_UMASK=${SYNCTHING_UMASK:-007}
SYNCTHING_IONICE=${SYNCTHING_IONICE:-0}
SYNCTHING_NICE=${SYNCTHING_NICE:-0}
SYNCTHING_GUI_ADDRESS=${SYNCTHING_GUI_ADDRESS:-http://127.0.0.1:8384}
description="Syncthing is an open, trustworthy and decentralized cloud storage system"
command="/usr/bin/syncthing"
command_args="-no-browser -home=${SYNCTHING_HOMEDIR} -gui-address=${SYNCTHING_GUI_ADDRESS} ${SYNCTHING_OPTS}"
pidfile="/run/${RC_SVCNAME}.pid"
command_background="yes"
command_user="${SYNCTHING_USER}:${SYNCTHING_GROUP}"
umask="${SYNCTHING_UMASK}"
start_stop_daemon_args="--ionice ${SYNCTHING_IONICE} \
--nicelevel ${SYNCTHING_NICE}"
output_log="\"${SYNCTHING_LOGFILE}\""
error_log="\"${SYNCTHING_LOGFILE}\""
depend() {
need localmount net
}
start_pre() {
checkpath -q -d -o ${SYNCTHING_USER}:${SYNCTHING_GROUP} ${SYNCTHING_HOMEDIR}
checkpath -q -f -o ${SYNCTHING_USER}:${SYNCTHING_GROUP} ${SYNCTHING_LOGFILE}
}

View File

@@ -0,0 +1,6 @@
/var/log/syncthing/syncthing.log {
missingok
notifempty
sharedscripts
copytruncate
}

View File

@@ -0,0 +1,110 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop go-module systemd xdg-utils
DESCRIPTION="Open Source Continuous File Synchronization"
HOMEPAGE="https://syncthing.net https://github.com/syncthing/syncthing"
SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${PN}-source-v${PV}.tar.gz"
S="${WORKDIR}"/${PN}
LICENSE="MPL-2.0 Apache-2.0 BSD BSD-2 CC0-1.0 ISC MIT Unlicense"
SLOT="0"
KEYWORDS="amd64 arm arm64 ~loong ppc64 ~riscv x86"
IUSE="selinux tools"
RDEPEND="
acct-group/syncthing
acct-user/syncthing
tools? (
>=acct-user/stdiscosrv-1
>=acct-user/strelaysrv-1
)
selinux? ( sec-policy/selinux-syncthing )
"
BDEPEND=">=dev-lang/go-1.21.0"
DOCS=( AUTHORS {GOALS,README}.md )
PATCHES=(
"${FILESDIR}"/${PN}-1.3.4-TestIssue5063_timeout.patch
"${FILESDIR}"/${PN}-1.18.4-tool_users.patch
"${FILESDIR}"/${PN}-1.29.5-remove_race_in_tests.patch #955442
)
src_prepare() {
# Bug #679280
xdg_environment_reset
default
local srv
for srv in st{disco,relay}srv; do
sed -i \
's|^ExecStart=.*|ExecStart=/usr/libexec/${PN}/${srv}|' \
cmd/${srv}/etc/linux-systemd/${srv}.service || die
done;
}
src_compile() {
GOARCH= CGO_ENABLED=1 go run build.go -version "v${PV}" -no-upgrade -build-out=bin/ \
${GOARCH:+-goarch="${GOARCH}"} \
build $(usev tools all) || die "build failed"
}
src_test() {
go run build.go test || die "test failed"
}
src_install() {
dobin bin/${PN}
doman man/*.[157]
einstalldocs
domenu etc/linux-desktop/${PN}-{start,ui}.desktop
local -i icon_size
for icon_size in 32 64 128 256 512; do
newicon -s ${icon_size} assets/logo-${icon_size}.png ${PN}.png
done
newicon -s scalable assets/logo-only.svg ${PN}.svg
systemd_dounit etc/linux-systemd/system/${PN}@.service
systemd_douserunit etc/linux-systemd/user/${PN}.service
newconfd "${FILESDIR}"/${PN}.confd ${PN}
newinitd "${FILESDIR}"/${PN}.initd-r2 ${PN}
keepdir /var/log/${PN}
insinto /etc/logrotate.d
newins "${FILESDIR}"/${PN}.logrotate ${PN}
insinto /etc/ufw/applications.d
doins etc/firewall-ufw/${PN}
if use tools; then
exeinto /usr/libexec/${PN}
insinto /etc/logrotate.d
local srv
for srv in st{disco,relay}srv; do
doexe bin/${srv}
systemd_dounit cmd/${srv}/etc/linux-systemd/${srv}.service
newconfd "${FILESDIR}"/${srv}.confd ${srv}
newinitd "${FILESDIR}"/${srv}.initd-r1 ${srv}
newins "${FILESDIR}"/${srv}.logrotate ${srv}
done
fi
}
pkg_postinst() {
xdg_desktop_database_update
xdg_icon_cache_update
}
pkg_postrm() {
xdg_desktop_database_update
xdg_icon_cache_update
}