Update to a more recent database (upstream provides a 2013 database) and add a 
target to update ip/country database.
 Comments ? ok ?
  Cheers
   Giovanni
Index: Makefile
===================================================================
RCS file: /var/cvs/ports/net/p5-IP-Country/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile	20 Mar 2016 19:56:51 -0000	1.9
+++ Makefile	7 Sep 2017 08:57:46 -0000
@@ -6,11 +6,22 @@ MODULES=	cpan
 PKG_ARCH=	*
 DISTNAME=	IP-Country-2.28
 CATEGORIES=	net
-REVISION=	0
+REVISION=	1
 
 # Artistic
 PERMIT_PACKAGE_CDROM=	Yes
 
 RUN_DEPENDS =		geo/p5-Geography-Countries
+
+SUBST_VARS =		FILESDIR
+
+post-patch:
+	${SUBST_CMD} ${WRKSRC}/dbmScripts/ipcc_maker.pl
+	cp ${FILESDIR}/*.gif ${WRKSRC}/lib/IP/Country/Fast/
+
+# Target to update country database
+updatedb:
+	cd ${WRKSRC}/dbmScripts && sh whois_filenames \
+		&& perl ipcc_loader.pl && perl ipcc_maker.pl 
 
 .include <bsd.port.mk>
Index: files/cc.gif
===================================================================
RCS file: files/cc.gif
diff -N files/cc.gif
Binary files /dev/null and cc.gif differ
Index: files/ip.gif
===================================================================
RCS file: files/ip.gif
diff -N files/ip.gif
Binary files /dev/null and ip.gif differ
Index: patches/patch-dbmScripts_ipcc_loader_pl
===================================================================
RCS file: patches/patch-dbmScripts_ipcc_loader_pl
diff -N patches/patch-dbmScripts_ipcc_loader_pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-dbmScripts_ipcc_loader_pl	7 Sep 2017 09:12:59 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: dbmScripts/ipcc_loader.pl
+--- dbmScripts/ipcc_loader.pl.orig
++++ dbmScripts/ipcc_loader.pl
+@@ -70,7 +70,7 @@ read_reg('delegated-afrinic-latest');
+ read_reg('delegated-lacnic-latest');
+ read_reg('delegated-apnic-latest');
+ read_ripe();
+-read_reg('delegated-arin-latest');
++read_reg('delegated-arin-extended-latest');
+ 
+ join_neighbours();
+ punch_holes();
Index: patches/patch-dbmScripts_ipcc_maker_pl
===================================================================
RCS file: patches/patch-dbmScripts_ipcc_maker_pl
diff -N patches/patch-dbmScripts_ipcc_maker_pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-dbmScripts_ipcc_maker_pl	7 Sep 2017 09:00:54 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: dbmScripts/ipcc_maker.pl
+--- dbmScripts/ipcc_maker.pl.orig
++++ dbmScripts/ipcc_maker.pl
+@@ -31,7 +31,7 @@ close REG || warn("can't close $reg_file, but continui
+ 
+ 
+ print "Saving ultralite IP registry to disk\n";
+-my $ip = new IO::File "> ../lib/IP/Country/Fast/ip.gif";
++my $ip = new IO::File "> ${FILESDIR}/ip.gif";
+ if (defined $ip) {
+     binmode $ip;
+     print $ip pack("N",time()); # returned by $obj->db_time()
+@@ -44,7 +44,7 @@ if (defined $ip) {
+ 
+ print "Saving ultralite country database to disk\n";
+ 
+-open (CC, "> ../lib/IP/Country/Fast/cc.gif")
++open (CC, "> ${FILESDIR}/cc.gif")
+     or die ("couldn't create country database: $!");
+ binmode CC;
+ foreach my $country (sort $tree->get_countries()){
Index: patches/patch-dbmScripts_whois_filenames
===================================================================
RCS file: patches/patch-dbmScripts_whois_filenames
diff -N patches/patch-dbmScripts_whois_filenames
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-dbmScripts_whois_filenames	6 Sep 2017 16:46:59 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+
+Index: dbmScripts/whois_filenames
+--- dbmScripts/whois_filenames.orig
++++ dbmScripts/whois_filenames
+@@ -2,5 +2,5 @@
+ ftp ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.inetnum.gz && gunzip ripe.db.inetnum.gz
+ ftp ftp://ftp.ripe.net/pub/stats/afrinic/delegated-afrinic-latest
+ ftp ftp://ftp.ripe.net/pub/stats/apnic/delegated-apnic-latest
+-ftp ftp://ftp.ripe.net/pub/stats/arin/delegated-arin-latest
++ftp ftp://ftp.ripe.net/pub/stats/arin/delegated-arin-extended-latest
+ ftp ftp://ftp.ripe.net/pub/stats/lacnic/delegated-lacnic-latest

Reply via email to