[net-irc/znc] version without adding user

This commit is contained in:
Robert Förster 2019-01-18 22:59:31 +01:00
parent 29c0947a76
commit 1e01138a21
4 changed files with 209 additions and 1 deletions

View File

@ -132,7 +132,7 @@ src_configure() {
"prefix=\"${ED%/}/usr\""
"install_docdir=\"${ED%/}/usr/share/doc/${PF}\""
"install_configdir=\"${ED%/}/usr/share/${P}/config\""
"install_mandir=\"${ED%/}/usr/share/man\""
"install_mandir=\"${ED%/}/usr/share/man/man1\""
"embedded_runpath_prefix=\"${EPREFIX}/usr\""
"LP64=yes"
"new_dtags=yes"

View File

@ -0,0 +1,64 @@
commit 95f1c7e9081866ea1e716743ea039a74565f80c6
Author: Louis Sautier <sautier.louis@gmail.com>
Date: Sun Jul 15 15:36:21 2018 +0200
Allow integration tests to be run inside a different root
Based on DarthGandalf's patch submitted in
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15112014e7605d13624297d7601504b5d187a6de
diff --git a/include/znc/znc.h b/include/znc/znc.h
index ecb2b41a..a791a648 100644
--- a/include/znc/znc.h
+++ b/include/znc/znc.h
@@ -251,6 +251,7 @@ class CZNC : private CCoreTranslationMixin {
void DisableConfigTimer();
static void DumpConfig(const CConfig* Config);
+ static CString UnusualRoot();
private:
static CString FormatBindError();
diff --git a/src/Modules.cpp b/src/Modules.cpp
index 5aec7805..6f9c34ae 100644
--- a/src/Modules.cpp
+++ b/src/Modules.cpp
@@ -1899,9 +1899,10 @@ CModules::ModDirList CModules::GetModDirs() {
sDir = CZNC::Get().GetModPath() + "/";
ret.push(std::make_pair(sDir, sDir));
+ CString sUnusualRoot = CZNC::UnusualRoot();
// <moduledir> and <datadir> (<prefix>/lib/znc)
- ret.push(std::make_pair(_MODDIR_ + CString("/"),
- _DATADIR_ + CString("/modules/")));
+ ret.push(std::make_pair(sUnusualRoot + _MODDIR_ + CString("/"),
+ sUnusualRoot + _DATADIR_ + CString("/modules/")));
return ret;
}
diff --git a/src/WebModules.cpp b/src/WebModules.cpp
index a5841987..f1b8a421 100644
--- a/src/WebModules.cpp
+++ b/src/WebModules.cpp
@@ -565,7 +565,7 @@ CString CWebSock::GetSkinPath(const CString& sSkinName) {
sRet = CZNC::Get().GetCurPath() + "/webskins/" + sSkin;
if (!CFile::IsDir(sRet)) {
- sRet = CString(_SKINDIR_) + "/" + sSkin;
+ sRet = CZNC::UnusualRoot() + CString(_SKINDIR_) + "/" + sSkin;
}
}
diff --git a/src/znc.cpp b/src/znc.cpp
index 4e7216ee..dd901497 100644
--- a/src/znc.cpp
+++ b/src/znc.cpp
@@ -2130,3 +2130,8 @@ void CZNC::DisableConfigTimer() {
m_pConfigTimer = nullptr;
}
}
+
+CString CZNC::UnusualRoot() {
+ char* szUnusualRoot = getenv("ZNC_UNUSUAL_ROOT");
+ return szUnusualRoot ? szUnusualRoot : "";
+}

15
net-irc/znc/metadata.xml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>sbraz@gentoo.org</email>
<name>Louis Sautier</name>
</maintainer>
<use>
<flag name="zlib">Enable mod_deflate-like gzip support for znc's web interface using <pkg>sys-libs/zlib</pkg>.</flag>
</use>
<upstream>
<remote-id type="github">znc/znc</remote-id>
<bugs-to>https://github.com/znc/znc/issues</bugs-to>
</upstream>
</pkgmetadata>

129
net-irc/znc/znc-9999.ebuild Normal file
View File

@ -0,0 +1,129 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python3_{4,5,6} )
inherit cmake-utils python-single-r1 readme.gentoo-r1 systemd user
GTEST_VER="ba96d0b1161f540656efdaed035b3c062b60e006" # 1.8.0 is too old, but newer version not released yet
GTEST_URL="https://github.com/google/googletest/archive/${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz"
DESCRIPTION="An advanced IRC Bouncer"
if [[ ${PV} == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI=${EGIT_REPO_URI:-"https://github.com/znc/znc.git"}
SRC_URI=""
else
MY_PV=${PV/_/-}
MY_P=${PN}-${MY_PV}
SRC_URI="
https://znc.in/releases/archive/${MY_P}.tar.gz
test? ( ${GTEST_URL} )
"
KEYWORDS="~amd64 ~arm ~x86"
S=${WORKDIR}/${MY_P}
fi
HOMEPAGE="https://znc.in"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="+ipv6 +icu libressl nls perl python +ssl sasl tcl test +zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )"
RDEPEND="
icu? ( dev-libs/icu:= )
nls? ( dev-libs/boost:=[nls] )
perl? ( >=dev-lang/perl-5.10:= )
python? ( ${PYTHON_DEPS} )
sasl? ( >=dev-libs/cyrus-sasl-2 )
ssl? (
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
)
tcl? ( dev-lang/tcl:0= )
zlib? ( sys-libs/zlib:0= )
"
DEPEND="
${RDEPEND}
virtual/pkgconfig
nls? ( sys-devel/gettext )
perl? ( >=dev-lang/swig-3.0.0 )
python? ( >=dev-lang/swig-3.0.0 )
test? ( dev-qt/qtnetwork:5 )
"
PATCHES=( "${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch )
pkg_setup() {
if use python; then
python-single-r1_pkg_setup
fi
}
src_prepare() {
# Let SWIG rebuild modperl/modpython to make user patching easier.
if [[ ${PV} != *9999* ]]; then
rm modules/modperl/generated.tar.gz || die
rm modules/modpython/generated.tar.gz || die
fi
sed -i -e "s|DZNC_BIN_DIR:path=|DZNC_BIN_DIR:path=${T}/inttest|" \
test/CMakeLists.txt || die
cmake-utils_src_prepare
}
src_configure() {
local mycmakeargs=(
-DWANT_ICU="$(usex icu)"
-DWANT_IPV6="$(usex ipv6)"
-DWANT_I18N="$(usex nls)"
-DWANT_PERL="$(usex perl)"
-DWANT_PYTHON="$(usex python)"
-DWANT_CYRUS="$(usex sasl)"
-DWANT_OPENSSL="$(usex ssl)"
-DWANT_TCL="$(usex tcl)"
-DWANT_ZLIB="$(usex zlib)"
)
if [[ ${PV} != *9999* ]] && use test; then
export GTEST_ROOT="${WORKDIR}/googletest-${GTEST_VER}/googletest"
export GMOCK_ROOT="${WORKDIR}/googletest-${GTEST_VER}/googlemock"
fi
cmake-utils_src_configure
}
src_test() {
cmake-utils_src_make unittest
if has network-sandbox ${FEATURES}; then
cmake-utils_src_make install DESTDIR="${T}/inttest"
local filter='-'
if ! use perl; then
filter="${filter}:ZNCTest.Modperl*"
fi
if ! use python; then
filter="${filter}:ZNCTest.Modpython*"
fi
# CMAKE_PREFIX_PATH and CXXFLAGS are needed for znc-buildmod
# invocations from inside the test
GTEST_FILTER="${filter}" ZNC_UNUSUAL_ROOT="${T}/inttest" \
CMAKE_PREFIX_PATH="${T}/inttest/usr/share/znc/cmake" \
CXXFLAGS="${CXXFLAGS} -isystem ${T}/inttest/usr/include" \
cmake-utils_src_make inttest
else
# TODO: don't require sandbox after
# https://github.com/znc/znc/pull/1363 is implemented
ewarn "FEATURES=-network-sandbox; skipping integration tests which"
ewarn "temporary open local ports."
fi
}
src_install() {
cmake-utils_src_install
dodoc NOTICE
}