public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Dirkjan Ochtman" <djc@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/files/, net-p2p/syncthing/
Date: Fri, 24 Jun 2016 20:05:30 +0000 (UTC)	[thread overview]
Message-ID: <1466798691.7deebb7157b1b7713488676ad049926f6aaf7217.djc@gentoo> (raw)

commit:     7deebb7157b1b7713488676ad049926f6aaf7217
Author:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 20:04:51 2016 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 20:04:51 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7deebb71

net-p2p/syncthing: add tools flag

Thanks to Alexey Korepanov for implementing this.

Package-Manager: portage-2.2.28

 net-p2p/syncthing/files/relaysrv.systemd.patch     |  13 +++
 net-p2p/syncthing/files/syncthing-relaysrv.confd   |   3 +
 net-p2p/syncthing/files/syncthing-relaysrv.initd   |  30 ++++++
 .../syncthing/files/syncthing-relaysrv.logrotate   |   6 ++
 net-p2p/syncthing/files/syncthing.logrotate        |   5 +-
 net-p2p/syncthing/metadata.xml                     |   5 +
 net-p2p/syncthing/syncthing-0.13.7-r1.ebuild       | 108 +++++++++++++++++++++
 7 files changed, 166 insertions(+), 4 deletions(-)

diff --git a/net-p2p/syncthing/files/relaysrv.systemd.patch b/net-p2p/syncthing/files/relaysrv.systemd.patch
new file mode 100644
index 0000000..2cff1dc
--- /dev/null
+++ b/net-p2p/syncthing/files/relaysrv.systemd.patch
@@ -0,0 +1,13 @@
+diff --git src/github.com/syncthing/syncthing/cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service src/github.com/syncthing/syncthing/cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service
+index b9d3173..7f8e2c0 100644
+--- src/github.com/syncthing/syncthing/cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service
++++ src/github.com/syncthing/syncthing/cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service
+@@ -5,7 +5,7 @@ After=network.target
+ [Service]
+ User=syncthing-relaysrv
+ Group=syncthing-relaysrv
+-ExecStart=/usr/bin/relaysrv
++ExecStart=/usr/libexec/syncthing/relaysrv
+ WorkingDirectory=/var/lib/syncthing-relaysrv
+ 
+ PrivateTmp=true

diff --git a/net-p2p/syncthing/files/syncthing-relaysrv.confd b/net-p2p/syncthing/files/syncthing-relaysrv.confd
new file mode 100644
index 0000000..2effc39
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing-relaysrv.confd
@@ -0,0 +1,3 @@
+# Options to pass to relaysrv
+# see relaysrv --help for more information
+SR_OPTS=

diff --git a/net-p2p/syncthing/files/syncthing-relaysrv.initd b/net-p2p/syncthing/files/syncthing-relaysrv.initd
new file mode 100644
index 0000000..860c5f3
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing-relaysrv.initd
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+SR_USER=syncthing-relaysrv
+SR_GROUP=syncthing-relaysrv
+SR_HOMEDIR=/var/lib/syncthing-relaysrv
+SR_LOGFILE=/var/log/syncthing/relaysrv.log
+
+
+description="Relay service for syncthing"
+command="/usr/libexec/syncthing/relaysrv"
+command_args="${SR_OPTS}"
+pidfile="/run/relaysrv.pid"
+start_stop_daemon_args="--background
+  --user ${SR_USER}
+  --group ${SR_GROUP}
+  --chdir \"${SR_HOMEDIR}\"
+  --make-pidfile
+  --stdout \"${SR_LOGFILE}\"
+  --stderr \"${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/syncthing-relaysrv.logrotate b/net-p2p/syncthing/files/syncthing-relaysrv.logrotate
new file mode 100644
index 0000000..f168cbf
--- /dev/null
+++ b/net-p2p/syncthing/files/syncthing-relaysrv.logrotate
@@ -0,0 +1,6 @@
+/var/log/syncthing/relaysrv.log {
+    missingok
+    notifempty
+    sharedscripts
+    copytruncate
+}

diff --git a/net-p2p/syncthing/files/syncthing.logrotate b/net-p2p/syncthing/files/syncthing.logrotate
index 37c4320..11310e3 100644
--- a/net-p2p/syncthing/files/syncthing.logrotate
+++ b/net-p2p/syncthing/files/syncthing.logrotate
@@ -2,8 +2,5 @@
     missingok
     notifempty
     sharedscripts
-    postrotate
-        kill -0 $(</run/syncthing.pid) && \
-          /etc/init.d/syncthing restart > /dev/null 2>&1 || true
-    endscript
+    copytruncate
 }

diff --git a/net-p2p/syncthing/metadata.xml b/net-p2p/syncthing/metadata.xml
index 78bfd30..df7f002 100644
--- a/net-p2p/syncthing/metadata.xml
+++ b/net-p2p/syncthing/metadata.xml
@@ -18,6 +18,11 @@
 	  Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized.
 	  Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet.
   </longdescription>
+  <use>
+	<flag name="tools">
+	  Install discosrv, relaysrv and other tools to /usr/libexec/synsthing/.
+	</flag>
+  </use>
   <upstream>
     <remote-id type="github">syncthing/syncthing</remote-id>
     <bugs-to>https://github.com/syncthing/syncthing/issues</bugs-to>

diff --git a/net-p2p/syncthing/syncthing-0.13.7-r1.ebuild b/net-p2p/syncthing/syncthing-0.13.7-r1.ebuild
new file mode 100644
index 0000000..fdc4011
--- /dev/null
+++ b/net-p2p/syncthing/syncthing-0.13.7-r1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+EGO_PN="github.com/syncthing/syncthing"
+EGIT_COMMIT=v${PV}
+
+inherit golang-vcs-snapshot systemd user versionator
+
+DESCRIPTION="Open Source Continuous File Synchronization"
+HOMEPAGE="https://syncthing.net"
+SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MPL-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~arm"
+IUSE="tools"
+
+DEPEND=""
+RDEPEND=""
+
+DOCS="README.md AUTHORS CONTRIBUTING.md"
+
+pkg_setup() {
+	enewgroup ${PN}
+	enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
+
+	if use tools ; then
+		# separate user for relaysrv
+		enewgroup ${PN}-relaysrv
+		enewuser ${PN}-relaysrv -1 -1 /var/lib/${PN}-relaysrv ${PN}-relaysrv
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/relaysrv.systemd.patch"
+	eapply_user
+}
+
+src_compile() {
+	export GOPATH="${S}:$(get_golibdir_gopath)"
+	cd src/${EGO_PN}
+	# If we pass "build" to build.go, it builds only syncthing itself, and
+	# places the binary in the root folder. If we do not pass "build", all the
+	# tools are built, and all binaries are placed in folder ./bin.
+	ST_BUILD="build"
+	if use tools ; then
+		ST_BUILD=""
+	fi
+	go run build.go -version "v${PV}" -no-upgrade ${ST_BUILD} || die "build failed"
+}
+
+src_test() {
+	cd src/${EGO_PN}
+	go run build.go test || die "test failed"
+}
+
+src_install() {
+	cd src/${EGO_PN}
+	doman man/*.[157]
+
+	if use tools ; then
+		dobin bin/syncthing
+		exeinto /usr/libexec/syncthing
+		for exe in bin/* ; do
+			[ "${exe}" = "bin/syncthing" ] || doexe "${exe}"
+		done
+	else
+		dobin syncthing
+	fi
+
+	# openrc and systemd service files
+	systemd_dounit "${S}"/src/${EGO_PN}/etc/linux-systemd/system/${PN}@.service \
+		"${S}"/src/${EGO_PN}/etc/linux-systemd/system/${PN}-resume.service
+	systemd_douserunit "${S}"/src/${EGO_PN}/etc/linux-systemd/user/${PN}.service
+	newconfd "${FILESDIR}/${PN}.confd" ${PN}
+	newinitd "${FILESDIR}/${PN}.initd" ${PN}
+
+	keepdir /var/{lib,log}/${PN}
+	fowners ${PN}:${PN} /var/{lib,log}/${PN}
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+	if use tools ; then
+		# openrc and systemd service files
+		systemd_dounit "${S}"/src/${EGO_PN}/cmd/relaysrv/etc/linux-systemd/${PN}-relaysrv.service
+		newconfd "${FILESDIR}/${PN}-relaysrv.confd" ${PN}-relaysrv
+		newinitd "${FILESDIR}/${PN}-relaysrv.initd" ${PN}-relaysrv
+
+		keepdir /var/lib/${PN}-relaysrv
+		fowners ${PN}-relaysrv:${PN}-relaysrv /var/{lib,log}/${PN}
+
+		insinto /etc/logrotate.d
+		newins "${FILESDIR}/syncthing-relaysrv.logrotate" syncthing-relaysrv
+	fi
+}
+
+pkg_postinst() {
+	if [[ $(get_version_component_range 2) -gt \
+			$(get_version_component_range 2 ${REPLACING_VERSIONS}) ]]; then
+		ewarn "Version ${PV} is not protocol-compatible with version" \
+			"0.$(($(get_version_component_range 2) - 1)).x or lower."
+		ewarn "Make sure all your devices are running at least version" \
+			"0.$(get_version_component_range 2).0."
+	fi
+}


             reply	other threads:[~2016-06-24 20:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 20:05 Dirkjan Ochtman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-23 17:12 [gentoo-commits] repo/gentoo:master commit in: net-p2p/syncthing/files/, net-p2p/syncthing/ Marek Szuba
2023-03-08 13:22 Marek Szuba
2022-01-18 16:40 Marek Szuba
2022-01-18 16:40 Marek Szuba
2016-02-17 20:43 Dirkjan Ochtman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466798691.7deebb7157b1b7713488676ad049926f6aaf7217.djc@gentoo \
    --to=djc@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox