commit:     26aef8c9f95ea9627701060c73022d6c12a120ca
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 19 02:36:19 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 19 02:36:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26aef8c9

net-analyzer/zmap: fix config file installation

We always want to install configs as the host machine may be different from
the one where zmap is installed to. Plus we have CONFIG_PROTECT in Gentoo
for protecting the user's existing configuration.

Unrelated to Clang 16, but an interesting bug! Sync live while at it.

Closes: https://bugs.gentoo.org/885707
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/zmap-2.1.1-always-install-config.patch   | 20 ++++++++++++++++
 .../{zmap-2.1.1-r4.ebuild => zmap-2.1.1-r5.ebuild} | 27 ++++++++++++++--------
 net-analyzer/zmap/zmap-9999.ebuild                 | 21 +++++++++++------
 3 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/net-analyzer/zmap/files/zmap-2.1.1-always-install-config.patch 
b/net-analyzer/zmap/files/zmap-2.1.1-always-install-config.patch
new file mode 100644
index 000000000000..b3a8f9003dc5
--- /dev/null
+++ b/net-analyzer/zmap/files/zmap-2.1.1-always-install-config.patch
@@ -0,0 +1,20 @@
+We always want to install configs as the host machine may be different from
+the one where zmap is installed to. Plus we have CONFIG_PROTECT in Gentoo
+for protecting the user's existing configuration.
+
+Bug: https://bugs.gentoo.org/885707
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -135,11 +135,7 @@ message(STATUS "Default ZMap configuration file location 
is /etc/zmap")
+ foreach(EACH_CONF ${CONF_FILES})
+     get_filename_component(CONF_BASENAME ${EACH_CONF} NAME)
+     message(STATUS "Checking if ${CONF_BASENAME} exists there...")
+-    if(NOT EXISTS "/etc/zmap/${CONF_BASENAME}")
+-        install(FILES ${EACH_CONF} DESTINATION ${CONFIG_DESTINATION})
+-    else()
+-        message(WARNING "Existing configuration file detected at 
/etc/zmap/${CONF_BASENAME}, ${CONF_BASENAME} from sources will NOT be 
installed. Please check and install manually!")
+-    endif()
++    install(FILES ${EACH_CONF} DESTINATION ${CONFIG_DESTINATION})
+ endforeach()
+ 
+ # Allow Debian Packaging

diff --git a/net-analyzer/zmap/zmap-2.1.1-r4.ebuild 
b/net-analyzer/zmap/zmap-2.1.1-r5.ebuild
similarity index 79%
rename from net-analyzer/zmap/zmap-2.1.1-r4.ebuild
rename to net-analyzer/zmap/zmap-2.1.1-r5.ebuild
index 6b1d7f0b8261..97210a199bd6 100644
--- a/net-analyzer/zmap/zmap-2.1.1-r4.ebuild
+++ b/net-analyzer/zmap/zmap-2.1.1-r5.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 inherit cmake fcaps
 
@@ -14,18 +14,28 @@ SLOT="0"
 KEYWORDS="amd64 arm ~arm64 x86"
 IUSE="mongo redis"
 
-RDEPEND="dev-libs/gmp:=
+RDEPEND="
+       dev-libs/gmp:=
        net-libs/libpcap
        dev-libs/json-c:=
        mongo? (
                dev-db/mongodb
                dev-libs/mongo-c-driver
        )
-       redis? ( dev-libs/hiredis:= )"
-DEPEND="${RDEPEND}
+       redis? ( dev-libs/hiredis:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
        dev-util/gengetopt
        sys-devel/flex
-       dev-util/byacc"
+       dev-util/byacc
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.1.1-always-install-config.patch
+)
+
+FILECAPS=( cap_net_raw=ep usr/sbin/zmap )
 
 src_prepare() {
        sed \
@@ -40,8 +50,7 @@ src_configure() {
                -DWITH_WERROR=OFF
                -DWITH_MONGO="$(usex mongo)"
                -DWITH_REDIS="$(usex redis)"
-               )
+       )
+
        cmake_src_configure
 }
-
-FILECAPS=( cap_net_raw=ep usr/sbin/zmap )

diff --git a/net-analyzer/zmap/zmap-9999.ebuild 
b/net-analyzer/zmap/zmap-9999.ebuild
index 6a7cb8480b94..b8a99df048df 100644
--- a/net-analyzer/zmap/zmap-9999.ebuild
+++ b/net-analyzer/zmap/zmap-9999.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 inherit cmake fcaps git-r3
 
@@ -17,20 +17,27 @@ RDEPEND="
        dev-libs/gmp:=
        net-libs/libpcap
        dev-libs/json-c:=
-       redis? ( dev-libs/hiredis:= )"
-DEPEND="${RDEPEND}
+       redis? ( dev-libs/hiredis:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
        dev-util/gengetopt
        sys-devel/flex
        dev-util/byacc
 "
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.1.1-always-install-config.patch
+)
+
+FILECAPS=( cap_net_raw=ep usr/sbin/zmap )
+
 src_configure() {
        local mycmakeargs=(
                -DENABLE_DEVELOPMENT=OFF
                -DWITH_WERROR=OFF
                -DWITH_REDIS="$(usex redis)"
-               )
+       )
+
        cmake_src_configure
 }
-
-FILECAPS=( cap_net_raw=ep usr/sbin/zmap )

Reply via email to