From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1488918-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 4EE6315800F
	for <garchives@archives.gentoo.org>; Tue, 21 Feb 2023 20:03:22 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 9B976E0AB2;
	Tue, 21 Feb 2023 20:03:20 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 6DC03E0AB2
	for <gentoo-commits@lists.gentoo.org>; Tue, 21 Feb 2023 20:03:20 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 5EC33340B0B
	for <gentoo-commits@lists.gentoo.org>; Tue, 21 Feb 2023 20:03:19 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id ACD328AC
	for <gentoo-commits@lists.gentoo.org>; Tue, 21 Feb 2023 20:03:17 +0000 (UTC)
From: "Conrad Kostecki" <conikost@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Conrad Kostecki" <conikost@gentoo.org>
Message-ID: <1677009784.4ce8d9d1308a6ba99dd16d66a091b943b960258b.conikost@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-im/prosody/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-im/prosody/Manifest net-im/prosody/prosody-0.12.3.ebuild
X-VCS-Directories: net-im/prosody/
X-VCS-Committer: conikost
X-VCS-Committer-Name: Conrad Kostecki
X-VCS-Revision: 4ce8d9d1308a6ba99dd16d66a091b943b960258b
X-VCS-Branch: master
Date: Tue, 21 Feb 2023 20:03:17 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: dd294b55-0836-4a7e-8998-08477de3566f
X-Archives-Hash: 2e3efa2cf3bf320d7a1e0c5cb40dbd2c

commit:     4ce8d9d1308a6ba99dd16d66a091b943b960258b
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 21 19:01:01 2023 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Tue Feb 21 20:03:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ce8d9d1

net-im/prosody: add 0.12.3

Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 net-im/prosody/Manifest              |   1 +
 net-im/prosody/prosody-0.12.3.ebuild | 164 +++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+)

diff --git a/net-im/prosody/Manifest b/net-im/prosody/Manifest
index 52dda5957103..1f4522faf7ff 100644
--- a/net-im/prosody/Manifest
+++ b/net-im/prosody/Manifest
@@ -1 +1,2 @@
 DIST prosody-0.12.2.tar.gz 614303 BLAKE2B f44f2106e3064b6ecb5d75718997ed980309e9debbd9f0b17eaeb3261d27421774097ba16bfd8d86d4bf1dd8f427c653b494b199676738d8781ffa37f9b73c5f SHA512 dd14d2740b67127e7edcf79db7d1fd81b4566d4a285430edb9dd7263ad109fdd6e581a1d93fcbf971f73fa5ba051ae7935a121d31e3e7448cacfcd8ecbd802bb
+DIST prosody-0.12.3.tar.gz 615302 BLAKE2B 07dc16950449086b5d1643efc29a13cde8e55f38b3402e6355665eed9dd4f7fbf38db237f511cb4f0e8cf08be536ce47a8aec502eff1961556dc47d8ec4b2b88 SHA512 5654aabd83561bea8a10387a242800e92df8db183b6273579d710599ffc458c5b545758ee742fb929a19a2fad9c33700787bc7aa348a8527caef03e80bc2edc4

diff --git a/net-im/prosody/prosody-0.12.3.ebuild b/net-im/prosody/prosody-0.12.3.ebuild
new file mode 100644
index 000000000000..8ec80145aecc
--- /dev/null
+++ b/net-im/prosody/prosody-0.12.3.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..4} luajit )
+LUA_REQ_USE="deprecated(+)"
+
+inherit lua-single systemd tmpfiles toolchain-funcs
+
+DESCRIPTION="Prosody is a modern XMPP communication server"
+HOMEPAGE="https://prosody.im/"
+SRC_URI="https://prosody.im/downloads/source/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="icu +idn +libevent ldap mysql postgres selinux +sqlite +ssl test +zlib"
+REQUIRED_USE="
+	^^ ( icu idn )
+	${LUA_REQUIRED_USE}
+"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+	acct-group/prosody
+	acct-user/prosody
+	$(lua_gen_cond_dep 'dev-lua/luaexpat[${LUA_USEDEP}]')
+	$(lua_gen_cond_dep 'dev-lua/luafilesystem[${LUA_USEDEP}]')
+	dev-lua/luarocks[${LUA_SINGLE_USEDEP}]
+	$(lua_gen_cond_dep 'dev-lua/luasocket[${LUA_USEDEP}]')
+	$(lua_gen_cond_dep 'dev-lua/lua-unbound[${LUA_USEDEP}]')
+	$(lua_gen_cond_dep 'dev-lua/readline[${LUA_USEDEP}]')
+	icu? ( dev-libs/icu:= )
+	idn? ( net-dns/libidn:= )
+	ldap? ( $(lua_gen_cond_dep 'dev-lua/lualdap[${LUA_USEDEP}]') )
+	libevent? ( $(lua_gen_cond_dep 'dev-lua/luaevent[${LUA_USEDEP}]') )
+	dev-libs/openssl:0=
+	lua_single_target_lua5-1? ( $(lua_gen_cond_dep 'dev-lua/lua-bit32[lua_targets_lua5-1(-)]') )
+	mysql? ( $(lua_gen_cond_dep 'dev-lua/luadbi[mysql,${LUA_USEDEP}]') )
+	postgres? ( $(lua_gen_cond_dep 'dev-lua/luadbi[postgres,${LUA_USEDEP}]') )
+	sqlite? ( $(lua_gen_cond_dep 'dev-lua/luadbi[sqlite,${LUA_USEDEP}]') )
+	ssl? ( $(lua_gen_cond_dep 'dev-lua/luasec[${LUA_USEDEP}]') )
+	zlib? ( $(lua_gen_cond_dep 'dev-lua/lua-zlib[${LUA_USEDEP}]') )
+	${LUA_DEPS}
+"
+
+RDEPEND="
+	${DEPEND}
+	selinux? ( sec-policy/selinux-jabber )
+"
+
+BDEPEND="
+	virtual/pkgconfig
+	test? ( $(lua_gen_cond_dep 'dev-lua/busted[${LUA_USEDEP}]') )
+"
+
+PATCHES=( "${FILESDIR}/${PN}-0.12.0-gentoo.patch" )
+
+src_prepare() {
+	default
+
+	# Set correct plugin path for optional net-im/prosody-modules package
+	sed -e "s/GENTOO_LIBDIR/$(get_libdir)/g" -i prosody.cfg.lua.dist || die
+}
+
+src_configure() {
+	local myeconfargs=(
+		--add-cflags="${CFLAGS}"
+		--add-ldflags="${LDFLAGS}"
+		--c-compiler="$(tc-getCC)"
+		--datadir="${EPREFIX}/var/lib/prosody"
+		--idn-library="$(usex idn 'idn' 'icu')"
+		--libdir="${EPREFIX}/usr/$(get_libdir)"
+		--linker="$(tc-getCC)"
+		--lua-version="$(usex lua_single_target_luajit '5.1' $(ver_cut 1-2 $(lua_get_version)))"
+		--no-example-certs
+		--ostype="linux"
+		--prefix="${EPREFIX}/usr"
+		--runwith="${ELUA}"
+		--sysconfdir="${EPREFIX}/etc/prosody"
+		--with-lua-include="${EPREFIX}/$(lua_get_include_dir)"
+		--with-lua-lib="${EPREFIX}/$(lua_get_cmod_dir)"
+	)
+
+	# Since the configure script is handcrafted,
+	# and yells at unknown options, do not use 'econf'.
+	./configure "${myeconfargs[@]}" || die
+
+	rm makefile || die
+	mv GNUmakefile Makefile || die
+}
+
+src_install() {
+	default
+
+	keepdir /var/lib/prosody
+
+	newinitd "${FILESDIR}"/prosody.initd-r6 prosody
+	systemd_newunit "${FILESDIR}"/prosody.service-r3 prosody.service
+
+	newtmpfiles "${FILESDIR}"/prosody.tmpfilesd-r2 prosody.conf
+}
+
+pkg_postinst() {
+	local migrate_to_prosody_user="false"
+	tmpfiles_process prosody.conf
+
+	if [[ ${REPLACING_VERSIONS} ]]; then
+		for v in ${REPLACING_VERSIONS}; do
+			if ver_test "${v}" -lt 0.12.0; then
+				migrate_to_prosody_user="true"
+				break
+			fi
+		done
+	fi
+
+	# Sarting with >=0.12.0, the prosody configuration is now in
+	# /etc/prosody and no longer in /etc/jabber.
+	# See if we need to migrate the configuration. Furthermore,
+	# prosody no longer runs under the, shared via net-im/jabber-base,
+	# 'jabber' use, but under its own user.
+	# This increase isolation and hence robustness and security.
+	if ${migrate_to_prosody_user}; then
+		local -A dirs_to_migrate=(
+			[/etc/jabber]=/etc/prosody
+			[/var/log/jabber]=/var/log/prosody
+			[/var/spool/jabber]=/var/lib/prosody
+		)
+
+		for src_dir in "${!dirs_to_migrate[@]}"; do
+			local eroot_src_dir="${EROOT}/${src_dir}"
+			local eroot_dst_dir="${EROOT}/${dirs_to_migrate[${src_dir}]}"
+
+			cp -r "${eroot_src_dir}"/. "${eroot_dst_dir}" || die "Could not copy ${eroot_src_dir} to ${eroot_dst_dir}"
+
+			if [[ -f "${eroot_dst_dir}"/.keep_net-im_jabber-base-0 ]]; then
+				rm "${eroot_dst_dir}"/.keep_net-im_jabber-base-0 || die
+			fi
+
+			if ! use prefix; then
+				chown --recursive prosody:prosody "${eroot_dst_dir}" || die
+			fi
+		done
+
+		# Update configuration file to match new pathes and permissions
+		local mysedargs=(
+			-e "'s#/etc/jabber#/etc/prosody#g'"
+			-e "'s#/run/jabber#/run/prosody#g'"
+			-e "'s#/var/log/jabber#/var/log/prosody#g'"
+			-e "'s/prosody_user.*/prosody_user = \"prosody\";/g'"
+			-e "'s/prosody_group.*/prosody_group = \"prosody\";/g'"
+			-i /etc/prosody/prosody.cfg.lua
+		)
+
+		eval sed "${mysedargs[@]}" || die
+
+		ewarn "Newer versions of the prosody (Gentoo) package use ${EROOT}/etc/prosody"
+		ewarn "(just as upstream) and *not* anymore ${EROOT}/etc/jabber."
+		ewarn "The files from ${EROOT}/etc/jabber where copied to ${EROOT}/etc/prosody."
+		ewarn "Also prosody's spool directory became ${EROOT}/var/lib/prosody (was ${EROOT}/var/spool/jabbber)."
+		ewarn "Please check your configuration."
+	fi
+}