[gentoo-commits] repo/gentoo:master commit in: net-irc/soju/files/, net-irc/soju/

2024-10-30 Thread Sam James
commit: 521bd2bc26491f73dcb5e680116b0d247d960f12
Author: Alfred Persson Forsberg  catcream  org>
AuthorDate: Wed Oct 30 14:28:15 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Oct 30 15:10:49 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=521bd2bc

net-irc/soju: add tmpfiles.d config

Closes: https://bugs.gentoo.org/942477
Signed-off-by: Alfred Persson Forsberg  catcream.org>
Signed-off-by: Sam James  gentoo.org>

 net-irc/soju/files/soju.tmpfiles | 1 +
 net-irc/soju/{soju-0.8.2.ebuild => soju-0.8.2-r1.ebuild} | 7 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/net-irc/soju/files/soju.tmpfiles b/net-irc/soju/files/soju.tmpfiles
new file mode 100644
index ..6280a148121c
--- /dev/null
+++ b/net-irc/soju/files/soju.tmpfiles
@@ -0,0 +1 @@
+d /run/soju 0750 soju soju

diff --git a/net-irc/soju/soju-0.8.2.ebuild b/net-irc/soju/soju-0.8.2-r1.ebuild
similarity index 94%
rename from net-irc/soju/soju-0.8.2.ebuild
rename to net-irc/soju/soju-0.8.2-r1.ebuild
index f92c219dc9f1..0d8a5761bc01 100644
--- a/net-irc/soju/soju-0.8.2.ebuild
+++ b/net-irc/soju/soju-0.8.2-r1.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 EAPI=8
 
-inherit go-module systemd
+inherit go-module systemd tmpfiles
 
 DESCRIPTION="soju is a user-friendly IRC bouncer"
 HOMEPAGE="https://soju.im/";
@@ -61,6 +61,9 @@ src_install() {
doman doc/soju.1
doman doc/sojuctl.1
systemd_dounit contrib/soju.service
+
+   newtmpfiles "${FILESDIR}/soju.tmpfiles" soju.conf
+
keepdir /etc/soju
insinto /etc/soju
newins config.in config
@@ -69,6 +72,8 @@ src_install() {
 }
 
 pkg_postinst() {
+   tmpfiles_process soju.conf
+
elog "${PN} requires a user database for authenticating clients."
elog "As the soju user, create a database using:"
elog "$ sojudb -config ${EROOT}/etc/soju/config create-user  
[-admin]"



[gentoo-commits] repo/gentoo:master commit in: net-irc/soju/files/, net-irc/soju/

2023-04-09 Thread Sam James
commit: df056a8be36b580156a0d198e1a141efdb5a2dd7
Author: Alfred Persson Forsberg  catcream  org>
AuthorDate: Wed Apr  5 18:38:35 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Apr 10 02:51:54 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df056a8b

net-irc/soju: add patch for dup upstream connections

https://todo.sr.ht/~emersion/soju/207

Signed-off-by: Alfred Persson Forsberg  catcream.org>
Signed-off-by: Sam James  gentoo.org>

 .../soju-0.6.0-fix-dup-upstream-connections.patch  | 69 ++
 net-irc/soju/soju-0.6.0.ebuild |  4 ++
 2 files changed, 73 insertions(+)

diff --git a/net-irc/soju/files/soju-0.6.0-fix-dup-upstream-connections.patch 
b/net-irc/soju/files/soju-0.6.0-fix-dup-upstream-connections.patch
new file mode 100644
index ..ca1f0fdf41c7
--- /dev/null
+++ b/net-irc/soju/files/soju-0.6.0-fix-dup-upstream-connections.patch
@@ -0,0 +1,69 @@
+https://todo.sr.ht/~emersion/soju/207
+
+diff -u b/user.go b/user.go
+--- b/user.go
 b/user.go
+@@ -218,6 +218,7 @@
+   net.user.srv.metrics.upstreams.Add(1)
+   defer net.user.srv.metrics.upstreams.Add(-1)
+ 
++  done := ctx.Done()
+   ctx, cancel := context.WithTimeout(ctx, time.Minute)
+   defer cancel()
+ 
+@@ -227,6 +228,12 @@
+   }
+   defer uc.Close()
+ 
++  // The context is cancelled by the caller when the network is stopped.
++  go func() {
++  <-done
++  uc.Close()
++  }()
++
+   if net.user.srv.Identd != nil {
+   net.user.srv.Identd.Store(uc.RemoteAddr().String(), 
uc.LocalAddr().String(), userIdent(&net.user.User))
+   defer net.user.srv.Identd.Delete(uc.RemoteAddr().String(), 
uc.LocalAddr().String())
+@@ -239,9 +246,6 @@
+   return fmt.Errorf("failed to register: %w", err)
+   }
+ 
+-  // TODO: this is racy with net.stopped. If the network is stopped
+-  // before the user goroutine receives eventUpstreamConnected, the
+-  // connection won't be closed.
+   net.user.events <- eventUpstreamConnected{uc}
+   defer func() {
+   net.user.events <- eventUpstreamDisconnected{uc}
+@@ -259,6 +263,12 @@
+   return
+   }
+ 
++  ctx, cancel := context.WithCancel(context.TODO())
++  go func() {
++  <-net.stopped
++  cancel()
++  }()
++
+   var lastTry time.Time
+   backoff := newBackoffer(retryConnectMinDelay, retryConnectMaxDelay, 
retryConnectJitter)
+   for {
+@@ -273,7 +283,7 @@
+   }
+   lastTry = time.Now()
+ 
+-  if err := net.runConn(context.TODO()); err != nil {
++  if err := net.runConn(ctx); err != nil {
+   text := err.Error()
+   temp := true
+   var regErr registrationError
+@@ -299,10 +309,6 @@
+   if !net.isStopped() {
+   close(net.stopped)
+   }
+-
+-  if net.conn != nil {
+-  net.conn.Close()
+-  }
+ }
+ 
+ func (net *network) detach(ch *database.Channel) {

diff --git a/net-irc/soju/soju-0.6.0.ebuild b/net-irc/soju/soju-0.6.0.ebuild
index 6a410939fdc3..cec8de059876 100644
--- a/net-irc/soju/soju-0.6.0.ebuild
+++ b/net-irc/soju/soju-0.6.0.ebuild
@@ -24,6 +24,10 @@ RDEPEND="
 "
 DEPEND="${RDEPEND}"
 
+PATCHES=(
+   "${FILESDIR}"/${PN}-0.6.0-fix-dup-upstream-connections.patch
+)
+
 src_compile() {
GOFLAGS+=" -tags=moderncsqlite"
use pam && GOFLAGS+=" -tags=pam"