From acb37830c861cf9d9c6594ec0043f0cba0f9b8b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 1 Aug 2023 12:18:34 +0200 Subject: [PATCH] 0.9.17 bump --- .gitignore | 1 + ...Fix-string-escaping-in-location-tool.patch | 41 ------------ ...error-when-trying-to-export-ipset-fo.patch | 33 ---------- ...rect-set-name-when-family-is-selecte.patch | 63 ------------------- libloc.spec | 35 +++++++---- sources | 2 +- 6 files changed, 25 insertions(+), 150 deletions(-) delete mode 100644 libloc-0.9.16-Fix-string-escaping-in-location-tool.patch delete mode 100644 libloc-0.9.16-export-Raise-an-error-when-trying-to-export-ipset-fo.patch delete mode 100644 libloc-0.9.16-location-Fix-correct-set-name-when-family-is-selecte.patch diff --git a/.gitignore b/.gitignore index 8c06979..2099897 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /libloc-0.9.15.tar.gz /libloc-0.9.16.tar.gz +/libloc-0.9.17.tar.gz diff --git a/libloc-0.9.16-Fix-string-escaping-in-location-tool.patch b/libloc-0.9.16-Fix-string-escaping-in-location-tool.patch deleted file mode 100644 index 33b43c8..0000000 --- a/libloc-0.9.16-Fix-string-escaping-in-location-tool.patch +++ /dev/null @@ -1,41 +0,0 @@ -From efaa883cbf89e1db6695b6cc0119eeea62256abd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= -Date: Mon, 24 Jul 2023 10:57:49 +0200 -Subject: [PATCH] Fix string escaping in location tool -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Python 3.12 started to warn on an invalid string escape sequence: - -$ location list-networks-by-as --format ipset 1 -/usr/bin/location:583: SyntaxWarning: invalid escape sequence '\d' - m = re.match("^AS(\d+)$", object) -IpsetOutputWriter requires family being set - -This patch fixes the warning as well as the regular expression by -using a raw string. - - - -Signed-off-by: Petr Písař ---- - src/scripts/location.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/scripts/location.in b/src/scripts/location.in -index 60b11d6..b34cc91 100644 ---- a/src/scripts/location.in -+++ b/src/scripts/location.in -@@ -580,7 +580,7 @@ class CLI(object): - families = [ socket.AF_INET6, socket.AF_INET ] - - for object in ns.objects: -- m = re.match("^AS(\d+)$", object) -+ m = re.match(r"^AS(\d+)$", object) - if m: - object = int(m.group(1)) - --- -2.41.0 - diff --git a/libloc-0.9.16-export-Raise-an-error-when-trying-to-export-ipset-fo.patch b/libloc-0.9.16-export-Raise-an-error-when-trying-to-export-ipset-fo.patch deleted file mode 100644 index 1c49658..0000000 --- a/libloc-0.9.16-export-Raise-an-error-when-trying-to-export-ipset-fo.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1f2ece2868f370bda1c4c01be401bcfb137f383d Mon Sep 17 00:00:00 2001 -From: Michael Tremer -Date: Mon, 3 Jul 2023 15:05:13 +0000 -Subject: [PATCH 2/2] export: Raise an error when trying to export ipset for - both families -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Michael Tremer -Signed-off-by: Petr Písař ---- - src/python/location/export.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/python/location/export.py b/src/python/location/export.py -index 25a532e..1d147b1 100644 ---- a/src/python/location/export.py -+++ b/src/python/location/export.py -@@ -147,6 +147,10 @@ class IpsetOutputWriter(OutputWriter): - # Count all networks - self.networks = 0 - -+ # Check that family is being set -+ if not self.family: -+ raise ValueError("%s requires family being set" % self.__class__.__name__) -+ - @property - def hashsize(self): - """ --- -2.41.0 - diff --git a/libloc-0.9.16-location-Fix-correct-set-name-when-family-is-selecte.patch b/libloc-0.9.16-location-Fix-correct-set-name-when-family-is-selecte.patch deleted file mode 100644 index 0605dae..0000000 --- a/libloc-0.9.16-location-Fix-correct-set-name-when-family-is-selecte.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 76852f60da75827f1296358e6be511a04355d073 Mon Sep 17 00:00:00 2001 -From: Michael Tremer -Date: Mon, 3 Jul 2023 14:53:50 +0000 -Subject: [PATCH 1/2] location: Fix correct set name when family is selected -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This does however not fix the problem if no --family= parameter is being -given because we will then export for multiple families in one file. - -This is for example not supported for ipset. - -Fixes: #12897 -Signed-off-by: Michael Tremer -Signed-off-by: Petr Písař ---- - src/scripts/location.in | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/scripts/location.in b/src/scripts/location.in -index be13156..60b11d6 100644 ---- a/src/scripts/location.in -+++ b/src/scripts/location.in -@@ -514,7 +514,7 @@ class CLI(object): - writer = self.__get_output_formatter(ns) - - for asn in ns.asn: -- f = writer("AS%s" % asn, f=sys.stdout) -+ f = writer("AS%s" % asn, family=ns.family, f=sys.stdout) - - # Print all matching networks - for n in db.search_networks(asns=[asn], family=ns.family): -@@ -527,7 +527,7 @@ class CLI(object): - - for country_code in ns.country_code: - # Open standard output -- f = writer(country_code, f=sys.stdout) -+ f = writer(country_code, family=ns.family, f=sys.stdout) - - # Print all matching networks - for n in db.search_networks(country_codes=[country_code], family=ns.family): -@@ -554,7 +554,7 @@ class CLI(object): - raise ValueError(_("You must at least pass one flag")) - - writer = self.__get_output_formatter(ns) -- f = writer("custom", f=sys.stdout) -+ f = writer("custom", family=ns.family, f=sys.stdout) - - for n in db.search_networks(flags=flags, family=ns.family): - f.write(n) -@@ -563,7 +563,7 @@ class CLI(object): - - def handle_list_bogons(self, db, ns): - writer = self.__get_output_formatter(ns) -- f = writer("bogons", f=sys.stdout) -+ f = writer("bogons", family=ns.family, f=sys.stdout) - - for n in db.list_bogons(family=ns.family): - f.write(n) --- -2.41.0 - diff --git a/libloc.spec b/libloc.spec index 29f2371..68882d8 100644 --- a/libloc.spec +++ b/libloc.spec @@ -1,7 +1,8 @@ Name: libloc -Version: 0.9.16 -Release: 2%{?dist} +Version: 0.9.17 +Release: 1%{?dist} Summary: Library to determine a location of an IP address in the Internet +# bash-completion/location: LGPL-2.1-or-later # COPYING: LGPL-2.1 text # data/database.db: CC-BY-SA-4.0 # man/libloc.txt: LGPL-2.1-or-later @@ -76,15 +77,6 @@ Summary: Library to determine a location of an IP address in the Internet License: LGPL-2.1-or-later URL: https://location.ipfire.org/ Source0: https://source.ipfire.org/releases/%{name}/%{name}-%{version}.tar.gz -# 1/2 Fix "location list-networks-by-as --format ipset" output, -# in upstream after 0.9.16, upstream bug #12897 -Patch0: libloc-0.9.16-location-Fix-correct-set-name-when-family-is-selecte.patch -# 2/2 Fix "location list-networks-by-as --format ipset" output, -# in upstream after 0.9.16, upstream bug #12897 -Patch1: libloc-0.9.16-export-Raise-an-error-when-trying-to-export-ipset-fo.patch -# Fix string escaping with Python 3.12, in upstream after 0.9.16, -# upstream bug #13188 -Patch2: libloc-0.9.16-Fix-string-escaping-in-location-tool.patch BuildRequires: asciidoc BuildRequires: autoconf >= 2.60 # autoconf-archive for unbundled m4/ax_prog_perl_modules.m4 @@ -114,6 +106,7 @@ BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: pkgconf-m4 # pkgconf-pkg-config for pkg-config program BuildRequires: pkgconf-pkg-config +BuildRequires: pkgconfig(bash-completion) BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(python) >= 3.4 # pkgconfig(systemd) not needed, we configure a value from systemd-rpm-macros @@ -164,6 +157,7 @@ in the Internet. Summary: Tools for downloading and querying IPFire Location database BuildArch: noarch Requires: python3-%{name} = %{version}-%{release} +Recommends: %{name}-tools-bash-completion = %{version}-%{release} %description tools "location" program retrieves information from the location database. This data @@ -172,6 +166,15 @@ building firewall rules to block access from certain autonomous systems or countries. There is also an integration with systemd which helps updating the location database periodically. +%package tools-bash-completion +Summary: Bash completion support for IPFire location tools +BuildArch: noarch +Requires: bash-completion +Requires: %{name}-tools = %{version}-%{release} + +%description tools-bash-completion +This package implements Bash completion scripts for IPFire location tools. + %prep %autosetup -p1 # Unbundle m4 macros @@ -184,6 +187,7 @@ autoreconf -fi -I%{_datadir}/gnulib/m4 %global default_database_file %{_sharedstatedir}/location/database.db %{configure} \ --disable-analyzer \ + --enable-bash-completion \ --with-database-path=%{default_database_file} \ --enable-debug \ --enable-largefile \ @@ -239,6 +243,7 @@ make check %{?_smp_mflags} %files -f %{name}.lang %license COPYING +%doc debian/changelog %{_libdir}/libloc.so.1* %files devel @@ -268,9 +273,15 @@ make check %{?_smp_mflags} %files tools %{_bindir}/location* %{_mandir}/man1/location.1* -%{_unitdir}/* +%{_unitdir}/location-update.* + +%files tools-bash-completion +%{_datadir}/bash-completion/completions/location %changelog +* Tue Aug 01 2023 Petr Pisar - 0.9.17-1 +- 0.9.17 bump + * Mon Jul 24 2023 Petr Pisar - 0.9.16-2 - Fix "location list-networks-by-as --format ipset" output (upstream bug #12897) diff --git a/sources b/sources index 55cf5b8..70900e6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libloc-0.9.16.tar.gz) = 4a4800d8638244917de8f41d75aff289b60b35e8c5b9546e68f78aab29b2f05d0db383b8403bf93a0e0fdf3916e56eb4f8b10fd9771826d85d49bc7b4917558b +SHA512 (libloc-0.9.17.tar.gz) = 91086f28f49c49db8c511170340678ef34ada81499ad7a2c91da8db17605094beac668eca9582679960553aae57b8653ec353553377b580721f97abb0f5b2e98 -- 2.47.2