From 0a941e4714d527e71b072bef9e4439216a776c0e2596af3f06c96564f73cdff9 Mon Sep 17 00:00:00 2001
From: Lars Vogdt <lrupp@suse.com>
Date: Sun, 9 May 2021 13:02:51 +0000
Subject: [PATCH] Accepting request 890365 from
 home:badshah400:branches:network:utilities

- Update to version 1.0.0:
  * Manpage was converted to markdown.
- Switch to using meson for building; BuildRequires: meson >=
  0.49.
- Addtional BuildRequires now needed: pkgconfig(libmaxminddb),
  rubygem(ronn).
- Add ipcalc-disable-network-tests.patch: Disable tests requiring
  network.
- Run tests as part of %check section.
- New upstream URL and Source URL.
- Drop patch patch-queue: no longer needed.

OBS-URL: https://build.opensuse.org/request/show/890365
OBS-URL: https://build.opensuse.org/package/show/network:utilities/ipcalc?expand=0&rev=6
---
 ipcalc-0.41.tar.gz                 |  3 --
 ipcalc-1.0.0.tar.bz2               |  3 ++
 ipcalc-disable-network-tests.patch | 50 +++++++++++++++++++++++++++
 ipcalc.changes                     | 15 +++++++++
 ipcalc.spec                        | 54 +++++++++++++++++-------------
 patch-queue                        | 24 -------------
 6 files changed, 99 insertions(+), 50 deletions(-)
 delete mode 100644 ipcalc-0.41.tar.gz
 create mode 100644 ipcalc-1.0.0.tar.bz2
 create mode 100644 ipcalc-disable-network-tests.patch
 delete mode 100644 patch-queue

diff --git a/ipcalc-0.41.tar.gz b/ipcalc-0.41.tar.gz
deleted file mode 100644
index 9497803..0000000
--- a/ipcalc-0.41.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dda9c571ce3369e5b6b06e92790434b54bec1f2b03f1c9df054c0988aa4e2e8a
-size 21599
diff --git a/ipcalc-1.0.0.tar.bz2 b/ipcalc-1.0.0.tar.bz2
new file mode 100644
index 0000000..317b1e0
--- /dev/null
+++ b/ipcalc-1.0.0.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d7aca371335ab3e35364bcfe34cd0229db005be8bebb9236608ec318cb3f7748
+size 45157
diff --git a/ipcalc-disable-network-tests.patch b/ipcalc-disable-network-tests.patch
new file mode 100644
index 0000000..f64e705
--- /dev/null
+++ b/ipcalc-disable-network-tests.patch
@@ -0,0 +1,50 @@
+Index: ipcalc-1.0.0/tests/meson.build
+===================================================================
+--- ipcalc-1.0.0.orig/tests/meson.build
++++ ipcalc-1.0.0/tests/meson.build
+@@ -64,14 +64,6 @@ test('RandomIPv6Explicit',
+ 		ipcalc.full_path() + ' -6 -r 24' + '|grep Address'
+ 	]
+ )
+-test('HostnameIPv6Localhost',
+-	testrunner,
+-	args : [
+-		'--test-outfile',
+-		ipcalc.full_path() + ' -6 -o localhost',
+-		files('hostname-localhost-ipv6')
+-	]
+-)
+ test('HostnameIPv4Localhost',
+ 	testrunner,
+ 	args : [
+@@ -88,30 +80,6 @@ test('HostnameIPv4LocalhostJson',
+ 		files('hostname-localhost-ipv4-json')
+ 	]
+ )
+-test('IPIPv6Localhost',
+-	testrunner,
+-	args : [
+-		'--test-outfile',
+-		ipcalc.full_path() + ' -h ::1',
+-		files('ip-localhost-ipv6')
+-	]
+-)
+-test('IPIPv4Localhost',
+-	testrunner,
+-	args : [
+-		'--test-outfile',
+-		ipcalc.full_path() + ' -h 127.0.0.1',
+-		files('ip-localhost-ipv4')
+-	]
+-)
+-test('IPIPv4LocalhostJson',
+-	testrunner,
+-	args : [
+-		'--test-outfile',
+-		ipcalc.full_path() + ' -j -h 127.0.0.1',
+-		files('ip-localhost-ipv4-json')
+-	]
+-)
+ # --class-prefix tests
+ test('AssignClassPrefix12',
+ 	testrunner,
diff --git a/ipcalc.changes b/ipcalc.changes
index 154ff2d..7a31bad 100644
--- a/ipcalc.changes
+++ b/ipcalc.changes
@@ -1,3 +1,18 @@
+-------------------------------------------------------------------
+Sat Apr  3 20:54:10 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>
+
+- Update to version 1.0.0:
+  * Manpage was converted to markdown.
+- Switch to using meson for building; BuildRequires: meson >=
+  0.49.
+- Addtional BuildRequires now needed: pkgconfig(libmaxminddb),
+  rubygem(ronn).
+- Add ipcalc-disable-network-tests.patch: Disable tests requiring
+  network.
+- Run tests as part of %check section.
+- New upstream URL and Source URL.
+- Drop patch patch-queue: no longer needed.
+
 -------------------------------------------------------------------
 Tue Aug  4 10:07:35 UTC 2015 - mpluskal@suse.com
 
diff --git a/ipcalc.spec b/ipcalc.spec
index ba32f4a..611b026 100644
--- a/ipcalc.spec
+++ b/ipcalc.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package ipcalc
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,44 +12,52 @@
 # 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:           ipcalc
-Version:        0.41
+Version:        1.0.0
 Release:        0
-Summary:        IPv4 Address Calculator
-License:        GPL-2.0+
+Summary:        IPv4/IPv6 tool assisting in network calculations on the command line
+License:        GPL-2.0-or-later
 Group:          Productivity/Networking/System
-Url:            http://jodies.de/ipcalc
-Source0:        http://jodies.de/ipcalc-archive/ipcalc-%{version}.tar.gz
-Patch1:         http://jodies.de/ipcalc-archive/patch-queue
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildArch:      noarch
+URL:            https://gitlab.com/ipcalc/ipcalc
+Source0:        https://gitlab.com/ipcalc/ipcalc/-/archive/%{version}/%{name}-%{version}.tar.bz2
+# PATCH-FEATURE-OPENSUSE ipcalc-disable-network-tests.patch badshah400@gmail.com -- Disable tests requiring network
+Patch0:         ipcalc-disable-network-tests.patch
+BuildRequires:  meson >= 0.49
+BuildRequires:  pkgconfig
+BuildRequires:  pkgconfig(libmaxminddb)
+BuildRequires:  rubygem(ronn)
+Conflicts:      netcalc
 
 %description
-ipcalc takes an IP address and netmask and calculates the resulting
-broadcast, network, Cisco wildcard mask, and host range. By giving a
-second netmask, you can design subnets and supernets. It is also
-presents the subnetting results as easy-to-understand binary values.
-
-Enter your netmask(s) in CIDR notation (/25) or dotted decimals
-(255.255.255.0). Inverse netmasks are recognized. If you omit the
-netmask ipcalc uses the default netmask for the class of your network.
+ipcalc is a modern tool to assist in network address calculations for IPv4 and
+IPv6. It acts both as a tool to output human readable information about a
+network or address, as well as a tool suitable to be used by scripts or other
+programs.  It supports printing a summary about the provided network address,
+multiple command line options per information to be printed, transparent IPv6
+support, and in addition it will use libGeoIP if available to provide
+geographic information.
 
 %prep
-%setup -q
-%patch1
+%autosetup -p1
 
 %build
+%meson
+%meson_build
 
 %install
-install -D -m 0755 ipcalc "%{buildroot}%{_bindir}/ipcalc"
+%meson_install
+
+%check
+%meson_test
 
 %files
-%defattr(-,root,root)
-%doc license changelog contributors
+%doc README.md NEWS
+%license COPYING
 %{_bindir}/ipcalc
+%{_mandir}/man1/ipcalc.1%{?ext_man}
 
 %changelog
diff --git a/patch-queue b/patch-queue
deleted file mode 100644
index ecef9cc..0000000
--- a/patch-queue
+++ /dev/null
@@ -1,24 +0,0 @@
-Jahreszahl, Mehrzahl und omit ;-)
-
-Index: ipcalc
-===================================================================
---- ipcalc.orig
-+++ ipcalc
-@@ -2,7 +2,7 @@
- 
- 
- #  IPv4 Calculator
--#  Copyright (C) Krischan Jodies 2000 - 2004
-+#  Copyright (C) Krischan Jodies 2000 - 2006
- #  krischan()jodies.de, http://jodies.de/ipcalc
- #   
- #  This program is free software; you can redistribute it and/or modify
-@@ -1082,7 +1082,7 @@ sub help {
- IP Calculator $version
- 
- Enter your netmask(s) in CIDR notation (/25) or dotted decimals (255.255.255.0).
--Inverse netmask are recognized. If you mmit the netmask, ipcalc uses the default
-+Inverse netmasks are recognized. If you omit the netmask, ipcalc uses the default
- netmask for the class of your network.
- 
- Look at the space between the bits of the addresses: The bits before it are