From 10bb5c84069a179923d03b2fda351e8d2e44095b0ef07df3695752033a39be07 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 12 Jan 2020 14:49:53 +0000
Subject: [PATCH] - Rename the SRPM from iptraf to iptraf-ng. Effectively no
 change for the produced BRPMs. - Add
 0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch from
 upstream.

OBS-URL: https://build.opensuse.org/package/show/network:utilities/iptraf-ng?expand=0&rev=3
---
 ...t-by-ifname-the-only-mode-of-operati.patch | 27 +++++++++
 iptraf-ng-1.1.4.tar.xz                        |  3 -
 iptraf-ng.changes                             |  9 +++
 iptraf-ng.spec                                | 59 +++++++------------
 v1.1.4.tar.gz                                 |  3 +
 5 files changed, 60 insertions(+), 41 deletions(-)
 create mode 100644 0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch
 delete mode 100644 iptraf-ng-1.1.4.tar.xz
 create mode 100644 v1.1.4.tar.gz

diff --git a/0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch b/0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch
new file mode 100644
index 0000000..1993655
--- /dev/null
+++ b/0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch
@@ -0,0 +1,27 @@
+From 96b7a5e17dce341b083ae802501d5c1c1966a0a9 Mon Sep 17 00:00:00 2001
+From: Jan Engelhardt <jengelh@inai.de>
+Date: Mon, 6 Jan 2020 16:40:58 +0100
+Subject: [PATCH] ifstats: make sort-by-ifname the only mode of operation
+
+https://github.com/iptraf-ng/iptraf-ng/pull/2
+
+Signed-off-by: Jan Engelhardt <jengelh@inai.de>
+---
+ src/ifstats.c | 13 +++----------
+ src/options.c | 50 ++++++++++++++++++++------------------------------
+ src/options.h |  2 +-
+ 3 files changed, 24 insertions(+), 41 deletions(-)
+
+diff --git a/src/ifstats.c b/src/ifstats.c
+index 0ae9b08..f871fc7 100644
+--- a/src/ifstats.c
++++ b/src/ifstats.c
+@@ -194,7 +194,7 @@ static void initiflist(struct iflist **list)
+ 
+ 		/* make the linked list sorted by ifindex */
+ 		struct iflist *cur = *list, *last = NULL;
+-		while (cur != NULL && cur->ifindex < ifindex) {
++		while (cur != NULL && strcmp(cur->ifname, ifname) < 0) {
+ 			last = cur;
+ 			cur = cur->next_entry;
+ 		}
diff --git a/iptraf-ng-1.1.4.tar.xz b/iptraf-ng-1.1.4.tar.xz
deleted file mode 100644
index e26629b..0000000
--- a/iptraf-ng-1.1.4.tar.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7647e7db4bb5e300216a200a3e8985ab83149af3004c74042ce35775c9e13058
-size 403028
diff --git a/iptraf-ng.changes b/iptraf-ng.changes
index 2133ec1..71f4d4a 100644
--- a/iptraf-ng.changes
+++ b/iptraf-ng.changes
@@ -1,3 +1,12 @@
+-------------------------------------------------------------------
+Sun Jan 12 14:45:33 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
+
+- Employ new homepage URLs.
+- Rename the SRPM from iptraf to iptraf-ng. Effectively no change
+  for the produced BRPMs.
+- Add 0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch
+  from upstream.
+
 -------------------------------------------------------------------
 Wed Aug 12 11:56:36 UTC 2015 - jslaby@suse.com
 
diff --git a/iptraf-ng.spec b/iptraf-ng.spec
index da42e84..8bc4e41 100644
--- a/iptraf-ng.spec
+++ b/iptraf-ng.spec
@@ -1,7 +1,7 @@
 #
-# spec file for package iptraf
+# spec file for package iptraf-ng
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,24 +12,26 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
-Name:           iptraf
+Name:           iptraf-ng
 Version:        1.1.4
 Release:        0
 Summary:        TCP/IP Network Monitor
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Productivity/Networking/Diagnostic
-Url:            https://fedorahosted.org/iptraf-ng/
+URL:            https://github.com/iptraf-ng/iptraf-ng/
 
-#Git-Clone:	git://git.fedorahosted.org/git/iptraf-ng
-#DL-URL:	http://fedorahosted.org/releases/i/p/iptraf-ng/iptraf-ng-%version.tar.gz
-Source:         %name-ng-%version.tar.xz
+Source:         https://github.com/iptraf-ng/iptraf-ng/archive/v%version.tar.gz
 Patch1:         iptraf-ng-1.1.4-fix-Floating-point-exception-in-tcplog_flowra.patch
 Patch2:         build-use-wide-version-of-lpanel-when-needed.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+Patch3:         0001-ifstats-make-sort-by-ifname-the-only-mode-of-operati.patch
+Obsoletes:      iptraf < 4
+# Just pick a number that is >3
+Provides:       iptraf = 4
+BuildRequires:  automake
 BuildRequires:  ncurses-devel
 BuildRequires:  xz
 
@@ -39,41 +41,22 @@ variety of information such as TCP connection packet and byte counts,
 interface statistics and activity indicators, TCP/UDP traffic
 breakdowns, and LAN station packet and byte counts.
 
-%package ng
-# 2010-04: We really want to have a iptraf-ng binrpm so that Obsoletes can
-# easily work (and make the user somewhat aware of the change by seeing a
-# new install in zypper). puzel wanted to keep the iptraf name in OBS however,
-# so we now have this nifty construct with an empty main package.
-Summary:        TCP/IP Network Monitor
-Group:          Productivity/Networking/Diagnostic
-# Just pick a number that is >3
-Provides:       iptraf = 4
-Obsoletes:      iptraf < 4
-
-%description ng
-IPTraf-ng is a console-based network statistics utility. It gathers a
-variety of information such as TCP connection packet and byte counts,
-interface statistics and activity indicators, TCP/UDP traffic
-breakdowns, and LAN station packet and byte counts.
-
 %prep
-%setup -qn %name-ng-%version
-%patch1 -p1
-%patch2 -p1
+%autosetup -n %name-%version -p1
 
 %build
+if [ ! -e configure ]; then autoreconf -fi; fi
 %configure
-make %{?_smp_mflags};
+make %{?_smp_mflags}
 
 %install
-b="%buildroot";
-make install DESTDIR="$b";
-install -dm 0755 "$b/%_localstatedir/lib/iptraf-ng";
-ln -s iptraf-ng "$b/%_sbindir/iptraf";
-ln -s iptraf-ng.8 "$b/%_mandir/man8/iptraf.8";
+%make_install
+b="%buildroot"
+install -dm 0755 "$b/%_localstatedir/lib/iptraf-ng"
+ln -s iptraf-ng "$b/%_sbindir/iptraf"
+ln -s iptraf-ng.8 "$b/%_mandir/man8/iptraf.8"
 
-%files ng
-%defattr(-,root,root)
+%files
 %_sbindir/iptraf*
 %_sbindir/rvnamed*
 %_mandir/man8/iptraf*
diff --git a/v1.1.4.tar.gz b/v1.1.4.tar.gz
new file mode 100644
index 0000000..ae76276
--- /dev/null
+++ b/v1.1.4.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:16b9b05bf5d3725d86409b901696639ad46944d02de6def87b1ceae5310dd35c
+size 556843