diff --git a/metadata/md5-cache/net-p2p/syncthing-2.0.5 b/metadata/md5-cache/net-p2p/syncthing-2.0.5 new file mode 100644 index 0000000..9b148ae --- /dev/null +++ b/metadata/md5-cache/net-p2p/syncthing-2.0.5 @@ -0,0 +1,14 @@ +BDEPEND=>=dev-lang/go-1.21.0 >=dev-lang/go-1.20:= app-arch/unzip virtual/pkgconfig +DEFINED_PHASES=compile install postinst postrm prepare test unpack +DESCRIPTION=Open Source Continuous File Synchronization +EAPI=8 +HOMEPAGE=https://syncthing.net https://github.com/syncthing/syncthing +INHERIT=desktop go-module systemd xdg-utils +IUSE=selinux tools +KEYWORDS=amd64 arm arm64 ~loong ppc64 ~riscv x86 +LICENSE=MPL-2.0 Apache-2.0 BSD BSD-2 CC0-1.0 ISC MIT Unlicense +RDEPEND=acct-group/syncthing acct-user/syncthing tools? ( >=acct-user/stdiscosrv-1 >=acct-user/strelaysrv-1 ) selinux? ( sec-policy/selinux-syncthing ) +SLOT=0 +SRC_URI=https://github.com/syncthing/syncthing/releases/download/v2.0.5/syncthing-source-v2.0.5.tar.gz +_eclasses_=desktop 3a72ffe0d8e1dd73af3a1c8c15a59fed multiprocessing 1e32df7deee68372153dca65f4a7c21f toolchain-funcs a0b29008c671a362b505f96fa80ce9c0 flag-o-matic a7afe42e95fb46ce9691605acfb24672 go-env 0e2babf96e7d0b045fc07ad199eb2399 go-module d96f2a2fd6d8fbad6d94516bf238f885 systemd a964c0cbe818b5729da1dbfcee5be861 xdg-utils 42869b3c8d86a70ef3cf75165a395e09 +_md5_=3887522c848938cdb0cf9141a240b3b3 diff --git a/net-p2p/syncthing/Manifest b/net-p2p/syncthing/Manifest new file mode 100644 index 0000000..14a0a07 --- /dev/null +++ b/net-p2p/syncthing/Manifest @@ -0,0 +1 @@ +DIST syncthing-source-v2.0.5.tar.gz 62659547 BLAKE2B 27867445d2dccc21a363b203ced17515d7189f7c2f07e3e2617af28edb1299bf8f73f8a1c95f5e11887bc326ee791027df01d00cdbe42d617931c8aca29afaf1 SHA512 0e489bd409d52fca08221ac3d016125961b4c1d37e5de9db7be2e3703c78d12a436c61a3c6ca66891de5f53f5e22542308563fee88a5fa432ede5ed47321b113 diff --git a/net-p2p/syncthing/files/stdiscosrv.confd b/net-p2p/syncthing/files/stdiscosrv.confd new file mode 100644 index 0000000..e40a4b9 --- /dev/null +++ b/net-p2p/syncthing/files/stdiscosrv.confd @@ -0,0 +1,3 @@ +# Options to pass to discosrv +# see /usr/libexec/syncthing/stdiscosrv --help for more information +SD_OPTS= diff --git a/net-p2p/syncthing/files/stdiscosrv.initd-r1 b/net-p2p/syncthing/files/stdiscosrv.initd-r1 new file mode 100644 index 0000000..fee01c4 --- /dev/null +++ b/net-p2p/syncthing/files/stdiscosrv.initd-r1 @@ -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} +} diff --git a/net-p2p/syncthing/files/stdiscosrv.logrotate b/net-p2p/syncthing/files/stdiscosrv.logrotate new file mode 100644 index 0000000..406a112 --- /dev/null +++ b/net-p2p/syncthing/files/stdiscosrv.logrotate @@ -0,0 +1,6 @@ +/var/log/syncthing/stdiscosrv.log { + missingok + notifempty + sharedscripts + copytruncate +} diff --git a/net-p2p/syncthing/files/strelaysrv.confd b/net-p2p/syncthing/files/strelaysrv.confd new file mode 100644 index 0000000..00564f1 --- /dev/null +++ b/net-p2p/syncthing/files/strelaysrv.confd @@ -0,0 +1,3 @@ +# Options to pass to relaysrv +# see /usr/libexec/syncthing/strelaysrv --help for more information +SR_OPTS= diff --git a/net-p2p/syncthing/files/strelaysrv.initd-r1 b/net-p2p/syncthing/files/strelaysrv.initd-r1 new file mode 100644 index 0000000..3a8b36e --- /dev/null +++ b/net-p2p/syncthing/files/strelaysrv.initd-r1 @@ -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} +} diff --git a/net-p2p/syncthing/files/strelaysrv.logrotate b/net-p2p/syncthing/files/strelaysrv.logrotate new file mode 100644 index 0000000..eb40ac2 --- /dev/null +++ b/net-p2p/syncthing/files/strelaysrv.logrotate @@ -0,0 +1,6 @@ +/var/log/syncthing/strelaysrv.log { + missingok + notifempty + sharedscripts + copytruncate +} diff --git a/net-p2p/syncthing/files/syncthing-1.18.4-tool_users.patch b/net-p2p/syncthing/files/syncthing-1.18.4-tool_users.patch new file mode 100644 index 0000000..a023788 --- /dev/null +++ b/net-p2p/syncthing/files/syncthing-1.18.4-tool_users.patch @@ -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 diff --git a/net-p2p/syncthing/files/syncthing-1.23.2-tests_race.patch b/net-p2p/syncthing/files/syncthing-1.23.2-tests_race.patch new file mode 100644 index 0000000..8d9e681 --- /dev/null +++ b/net-p2p/syncthing/files/syncthing-1.23.2-tests_race.patch @@ -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, ",")) + } diff --git a/net-p2p/syncthing/files/syncthing-1.29.5-remove_race_in_tests.patch b/net-p2p/syncthing/files/syncthing-1.29.5-remove_race_in_tests.patch new file mode 100644 index 0000000..eb7b1fa --- /dev/null +++ b/net-p2p/syncthing/files/syncthing-1.29.5-remove_race_in_tests.patch @@ -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") diff --git a/net-p2p/syncthing/files/syncthing-1.3.4-TestIssue5063_timeout.patch b/net-p2p/syncthing/files/syncthing-1.3.4-TestIssue5063_timeout.patch new file mode 100644 index 0000000..3148dc8 --- /dev/null +++ b/net-p2p/syncthing/files/syncthing-1.3.4-TestIssue5063_timeout.patch @@ -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") + } diff --git a/net-p2p/syncthing/files/syncthing.confd b/net-p2p/syncthing/files/syncthing.confd new file mode 100644 index 0000000..eb70f1a --- /dev/null +++ b/net-p2p/syncthing/files/syncthing.confd @@ -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="" diff --git a/net-p2p/syncthing/files/syncthing.initd-r2 b/net-p2p/syncthing/files/syncthing.initd-r2 new file mode 100644 index 0000000..d8e4618 --- /dev/null +++ b/net-p2p/syncthing/files/syncthing.initd-r2 @@ -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} +} diff --git a/net-p2p/syncthing/files/syncthing.logrotate b/net-p2p/syncthing/files/syncthing.logrotate new file mode 100644 index 0000000..11310e3 --- /dev/null +++ b/net-p2p/syncthing/files/syncthing.logrotate @@ -0,0 +1,6 @@ +/var/log/syncthing/syncthing.log { + missingok + notifempty + sharedscripts + copytruncate +} diff --git a/net-p2p/syncthing/syncthing-2.0.5.ebuild b/net-p2p/syncthing/syncthing-2.0.5.ebuild new file mode 100644 index 0000000..428f516 --- /dev/null +++ b/net-p2p/syncthing/syncthing-2.0.5.ebuild @@ -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 +}