net-analyzer/greenbone-feed-sync: revert "drop config file patching in src_test"

This essentially reverts commit 0375a7b2b5, but
adjusts the sed comment to remove the reference to sandbox violations,
because this are not what we are seeing without the sed.

We also now use T to store config.py.orig, as it brings down the line
length.

Furthermore, we keep the "${WORKDIR}/${P}"/ part dropped, as it is
unnecessary.

Closes: https://bugs.gentoo.org/932836
Signed-off-by: Florian Schmaus <flow@gentoo.org>
This commit is contained in:
Florian Schmaus
2024-07-04 10:21:16 +02:00
parent 18a404dcab
commit 1fb919b834
@@ -38,6 +38,16 @@ RDEPEND="
distutils_enable_tests unittest
src_test() {
# Make a copy of the original config
cp greenbone/feed/sync/config.py "${T}"/config.py.orig || die
# Patch the config.py to not use files from /etc/gvm, as this may
# cause a PermissionError. See https://bugs.gentoo.org/932836#c10
sed -i \
-e 's:DEFAULT_CONFIG_FILE = "/etc/gvm/greenbone-feed-sync.toml":DEFAULT_CONFIG_FILE = "'"${WORKDIR}/${P}-${TARGET}"'/install/etc/gvm/greenbone-feed-sync.toml":' \
-e 's:DEFAULT_ENTERPRISE_KEY_PATH = "/etc/gvm/greenbone-enterprise-feed-key":DEFAULT_ENTERPRISE_KEY_PATH = "'"${WORKDIR}/${P}-${TARGET}"'/install/etc/gvm/greenbone-enterprise-feed-key":' \
greenbone/feed/sync/config.py || die
# Disable tests that require network access.
sed -i \
-e 's:test_do_not_run_as_root:_&:' \
@@ -50,6 +60,9 @@ src_test() {
tests/test_main.py || die
distutils-r1_src_test
# Restore config.py after test.
mv "${T}"/config.py.orig greenbone/feed/sync/config.py || die
}
python_install() {