commit:     a3001edf4622cfbdaffcc888ddb5a43a4c96c65f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 23:53:47 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep  8 00:08:45 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3001edf

net-analyzer/flow-tools: EAPI 8; fix modern C issues & LTO; fix config path

* EAPI 8

* Modern C porting
** Fix a C99 issue (missing 'config.h' include in lexer)
** Fix a C23 issue (mismatched function pointer types)
** Fix an LTO issue (yy* prefix clash, linker warning)

* Fix config location

  The upstream location was fixed in 6bccc64533fcc32597a4cc8de07fd031019ea2fd
  but we retained our --sysconfdir workaround with the bump to 0.68.6, which
  meant configs were installed to /etc/flow-tools/flow-tools/.

  Fix that and add a warning...

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

 .../files/flow-tools-0.68.6-c99-c23.patch          | 41 ++++++++++++++++++
 .../flow-tools/files/flow-tools-0.68.6-lto.patch   | 31 ++++++++++++++
 ....68.6-r1.ebuild => flow-tools-0.68.6-r2.ebuild} | 49 +++++++++++++++-------
 3 files changed, 106 insertions(+), 15 deletions(-)

diff --git a/net-analyzer/flow-tools/files/flow-tools-0.68.6-c99-c23.patch 
b/net-analyzer/flow-tools/files/flow-tools-0.68.6-c99-c23.patch
new file mode 100644
index 000000000000..06f56bf440c5
--- /dev/null
+++ b/net-analyzer/flow-tools/files/flow-tools-0.68.6-c99-c23.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/945075
+--- a/lib/ftstat.c
++++ b/lib/ftstat.c
+@@ -831,11 +831,11 @@ struct jump {
+ 
+ struct typelookup {
+   char *name;
+-  void* (*f_new)();
+-  void* (*f_accum)();
+-  void* (*f_calc)();
+-  void* (*f_dump)();
+-  void* (*f_free)();
++  void* (*f_new)(struct ftstat_rpt *);
++  void* (*f_accum)(struct ftstat_rpt *, char *, struct fts3rec_offsets *);
++  void* (*f_calc)(struct ftstat_rpt *);
++  void* (*f_dump)(FILE *, struct ftio *, struct ftstat_rpt *);
++  void* (*f_free)(void *);
+   int allowed_fields; /* FT_STAT_FIELD_* */
+   int allowed_options;/* FT_STAT_OPT_* */
+   uint64_t xfields; /* FT_XFIELD_* */
+--- a/src/acllex.l
++++ b/src/acllex.l
+@@ -1,4 +1,5 @@
+ %{
++#include <ftconfig.h>
+ #include <ftlib.h>
+ 
+ #if HAVE_STRINGS_H
+--- a/src/flow-print.c
++++ b/src/flow-print.c
+@@ -89,9 +89,7 @@ struct jump format[] = {{format0}, {format1}, {format2},
+ 
+ void usage(void);
+ 
+-int main(argc, argv)
+-int argc;
+-char **argv;
++int main(int argc, char **argv)
+ {
+   struct ftio ftio;
+   struct ftprof ftp;

diff --git a/net-analyzer/flow-tools/files/flow-tools-0.68.6-lto.patch 
b/net-analyzer/flow-tools/files/flow-tools-0.68.6-lto.patch
new file mode 100644
index 000000000000..0111d356e0e7
--- /dev/null
+++ b/net-analyzer/flow-tools/files/flow-tools-0.68.6-lto.patch
@@ -0,0 +1,31 @@
+We get a linker warning otherwise from YYSTYPE changing.
+--- a/lib/getdate.y
++++ b/lib/getdate.y
+@@ -1,3 +1,5 @@
++%define api.prefix {getdate}
++
+ %{
+ /*
+ **  Originally written by Steven M. Bellovin <[email protected]> while
+@@ -117,10 +119,6 @@ extern struct tm  *localtime();
+ extern time_t get_date(char * p, struct timeb * now);
+ /*@=exportheader@*/
+ 
+-#define yyparse getdate_yyparse
+-#define yylex getdate_yylex
+-#define yyerror getdate_yyerror
+-
+ static int yyparse (void);
+ static int yylex (void);
+ static int yyerror(const char * s);
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,7 +1,7 @@
+ 
+ noinst_HEADERS = flow-dscan.h pcap.h cflowd.h acl2.h
+ 
+-BUILT_SOURCES = aclyacc.h
++BUILT_SOURCES = aclyacc.h acllex.c
+ AM_YFLAGS = -d
+ 
+ EXTRA_DIST = ftbuild.sh

diff --git a/net-analyzer/flow-tools/flow-tools-0.68.6-r1.ebuild 
b/net-analyzer/flow-tools/flow-tools-0.68.6-r2.ebuild
similarity index 62%
rename from net-analyzer/flow-tools/flow-tools-0.68.6-r1.ebuild
rename to net-analyzer/flow-tools/flow-tools-0.68.6-r2.ebuild
index aced4bca3177..c4daef4fdbd4 100644
--- a/net-analyzer/flow-tools/flow-tools-0.68.6-r1.ebuild
+++ b/net-analyzer/flow-tools/flow-tools-0.68.6-r2.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
-inherit autotools
+inherit autotools eapi9-ver
 
 DESCRIPTION="library and programs to process reports from NetFlow data"
 HOMEPAGE="https://github.com/5u623l20/flow-tools/";
@@ -19,39 +19,49 @@ RDEPEND="
        acct-user/flows
        sys-apps/tcp-wrappers
        sys-libs/zlib
-       mysql? ( dev-db/mysql-connector-c:0= )
+       mysql? ( dev-db/mysql-connector-c:= )
        postgres? ( dev-db/postgresql:* )
-       ssl? ( dev-libs/openssl:0= )
-"
-DEPEND="
-       ${RDEPEND}
+       ssl? ( dev-libs/openssl:= )
 "
+DEPEND="${RDEPEND}"
 BDEPEND="
        app-text/docbook-sgml-utils
-       app-alternatives/yacc
        app-alternatives/lex
+       sys-devel/bison
 "
+
 DOCS=( ChangeLog.old README README.fork SECURITY TODO TODO.old )
+
 PATCHES=(
        "${FILESDIR}"/${PN}-0.68.5.1-run.patch
        "${FILESDIR}"/${PN}-0.68.5.1-openssl11.patch
        "${FILESDIR}"/${PN}-0.68.5.1-fno-common.patch
        "${FILESDIR}"/${PN}-0.68.6-mysql.patch
+       "${FILESDIR}"/${PN}-0.68.6-c99-c23.patch
+       "${FILESDIR}"/${PN}-0.68.6-lto.patch
 )
 
 src_prepare() {
        default
+
        sed -i -e 's|docbook-to-man|docbook2man|g' docs/Makefile.am || die
        eautoreconf
 }
 
 src_configure() {
-       econf \
-               $(use_enable static-libs static) \
-               $(usex mysql --with-mysql '') \
-               $(usex postgres --with-postgresql=yes --with-postgresql=no) \
-               $(usex ssl --with-openssl '') \
-               --sysconfdir=/etc/flow-tools
+       # Needs bison specifically for LTO patch (for setting a prefix)
+       unset YACC
+
+       local myeconfargs=(
+               $(use_enable static-libs static)
+
+               # configure logic is buggy
+               $(usev mysql --with-mysql)
+               --with-postgresql=$(usex postgres yes no)
+               $(usev ssl --with-openssl)
+       )
+
+       econf "${myeconfargs[@]}"
 }
 
 src_install() {
@@ -74,3 +84,12 @@ src_install() {
 
        find "${ED}" -name '*.la' -delete || die
 }
+
+pkg_postinst() {
+       if ver_replacing -lt 0.68.6-r2 ; then
+               ewarn "Config files have been moved bak to 
${EPREFIX}/etc/flow-tools"
+               ewarn "after temporarily being in the wrong location of"
+               ewarn " ${EPREFIX}/etc/flow-tools/flow-tools"
+               ewarn "See bug #785040."
+       fi
+}

Reply via email to