pghmcfc pushed to GeoIP (el5). "Properly provide the data fromgeoip-geolite (..more)"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Apr 14 07:39:52 UTC 2015


>From 84346ccb3d89c2237232db0eaca4b8545ba312e7 Mon Sep 17 00:00:00 2001
From: Paul Howarth <paul at city-fan.org>
Date: Tue, 18 Jun 2013 16:10:51 +0100
Subject: Properly provide the data fromgeoip-geolite

- Properly provide all of the GeoLite databases and their IPv6 equivalents, as
  per the geoip-geolite package that we're obsoleting/providing
- Provide compatibility symlinks for database files that historically had
  different names in GeoIP and geoip-geolite
- Don't distribute unbundled LICENSE files, as per packaging guidelines
- Update license tag to reflect distribution of CC-BY-SA database content
- No longer try to update the databases in %post
- Maintain timestamps where possible
- Set up GeoIP.dat symlink in package and don't touch it again
- Add update6 package to update the IPv6 databases; have to use wget for this
  rather than geoipupdate as the databases are still in beta

diff --git a/.gitignore b/.gitignore
index db8103b..5f5e7a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,10 @@
-GeoIP-1.4.6.tar.gz
+/GeoIP-1.4.6.tar.gz
 /GeoIP-1.4.8.tar.gz
 /GeoIP-1.5.0.tar.gz
 /GeoIP-1.5.1.tar.gz
+/GeoIP.dat.gz
+/GeoIPASNum.dat.gz
+/GeoIPASNumv6.dat.gz
+/GeoIPv6.dat.gz
+/GeoLiteCity.dat.gz
+/GeoLiteCityv6.dat.gz
diff --git a/GeoIP.spec b/GeoIP.spec
index c55976f..f4d85ee 100644
--- a/GeoIP.spec
+++ b/GeoIP.spec
@@ -3,16 +3,23 @@
 
 Name:		GeoIP
 Version:	1.5.1
-Release:	1%{?dist}
+Release:	2%{?dist}
 Summary:	Library for country/city/organization to IP address or hostname mapping
 Group:		Development/Libraries
-License:	LGPLv2+ and GPLv2+
+License:	LGPLv2+ and GPLv2+ and CC-BY-SA
 URL:		http://www.maxmind.com/app/c
 Source0:	http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz
-Source1:	LICENSE.txt
 Source2:	fetch-geoipdata-city.pl
 Source3:	fetch-geoipdata.pl
 Source5:	geoipupdate.cron
+Source6:	geoipupdate6.cron
+# Data sources indexed at http://dev.maxmind.com/geoip/legacy/geolite
+Source10:	http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
+Source11:	http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
+Source12:	http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
+Source13:	http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz
+Source14:	http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
+Source15:	http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz
 Patch1:		GeoIP-1.5.0-exitcode.patch
 Patch10:	GeoIP-1.5.1-UTF8.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
@@ -24,14 +31,16 @@ Provides:	geoip-geolite = 2013.04-2
 
 %description
 GeoIP is a C library that enables the user to find the country that any IP
-address or hostname originates from. It uses a file based database that is
-updated at install time if possible, and can optionally be updated on a weekly
-basis by installing the GeoIP-update package. This database simply contains IP
-blocks as keys, and countries as values. This database should be more complete
-and accurate than using reverse DNS lookups.
+address or hostname originates from.
+
+It uses file based databases that can optionally be updated on a weekly basis
+by installing the GeoIP-update (IPv4) and/or GeoIP-update6 (IPv6) packages.
+
+This package includes GeoLite data created by MaxMind, available from
+http://www.maxmind.com/
 
 %package update
-Summary:	Crontab entry to facilitate automatic updates of databases
+Summary:	Crontab entry to facilitate automatic updates of IPv4 GeoIP databases
 Group:		Applications/Databases
 Requires:	crontabs
 Requires:	%{name} = %{version}-%{release}
@@ -40,7 +49,20 @@ BuildArch:	noarch
 %endif
 
 %description update
-Crontab entry to provide weekly updates of the GeoIP free databases.
+Crontab entry to provide weekly updates of the GeoIP free IPv4 databases.
+
+%package update6
+Summary:	Crontab entry to facilitate automatic updates of IPv6 GeoIP databases
+Group:		Applications/Databases
+Requires:	crontabs
+Requires:	wget
+Requires:	%{name} = %{version}-%{release}
+%if %{noarch_subpkgs}
+BuildArch:	noarch
+%endif
+
+%description update6
+Crontab entry to provide weekly updates of the GeoIP free IPv6 databases.
 
 %package devel
 Summary:	Development headers and libraries for GeoIP
@@ -55,17 +77,26 @@ Development headers and static libraries for building GeoIP-based applications.
 %prep
 %setup -q
 
+# Scripts and license files
+install -p -m 644 %{SOURCE2} fetch-geoipdata-city.pl
+install -p -m 644 %{SOURCE3} fetch-geoipdata.pl
+install -p -m 755 %{SOURCE5} geoipupdate.cron
+install -p -m 755 %{SOURCE6} geoipupdate6.cron
+
+# Data
+install -p -m 644 %{SOURCE10} data/GeoLiteCountry.dat.gz;	gunzip data/GeoLiteCountry.dat
+install -p -m 644 %{SOURCE11} data/GeoIPv6.dat.gz;		gunzip data/GeoIPv6.dat
+install -p -m 644 %{SOURCE12} data/GeoLiteCity.dat.gz;		gunzip data/GeoLiteCity.dat
+install -p -m 644 %{SOURCE13} data/GeoLiteCityv6.dat.gz;	gunzip data/GeoLiteCityv6.dat
+install -p -m 644 %{SOURCE14} data/GeoLiteASNum.dat.gz;		gunzip data/GeoLiteASNum.dat
+install -p -m 644 %{SOURCE15} data/GeoIPASNumv6.dat.gz;		gunzip data/GeoIPASNumv6.dat
+
 # Fix exit codes for various cases (MaxMind support #129155)
 %patch1 -p1 -b .exitcode
 
 # Recode docs as UTF-8
 %patch10 -p1 -b .utf8
 
-install -D -m644 %{SOURCE1} LICENSE.txt
-install -D -m644 %{SOURCE2} fetch-geoipdata-city.pl
-install -D -m644 %{SOURCE3} fetch-geoipdata.pl
-install -D -m644 %{SOURCE5} geoipupdate.cron
-
 %build
 # Fix timestamp order to avoid trying to re-run autotools and configure,
 # thus clobbering our hacked libtool later on
@@ -85,52 +116,56 @@ make %{?_smp_mflags}
 
 %install
 rm -rf %{buildroot}
-make DESTDIR=%{buildroot} DEFAULT_DB_FILE="%{_datadir}/GeoIP/GeoIP-initial.dat" install
-
-# fetch database updates weekly
-install -D -m755 geoipupdate.cron %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate
+make DESTDIR=%{buildroot} INSTALL="install -p" install
 
 # nix the stuff we don't need like .la files.
 rm -f %{buildroot}%{_libdir}/*.la
 
-# fix up the config file to use the free products by default
+# fix up the config file to have geoipupdate fetch the free products by default
 sed -i \
 	-e 's/YOUR_LICENSE_KEY_HERE$/000000000000/' \
 	-e 's/YOUR_USER_ID_HERE$/999999/' \
 	-e 's/106$/506 533 517/' \
 	%{buildroot}%{_sysconfdir}/GeoIP.conf
 
-# make the default GeoIP.dat a symlink to GeoIP-initial.dat,
-# at least until %%post has run
-ln -sf GeoIP-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIP.dat
+# install GeoLite databases
+for db in \
+	GeoLiteCountry.dat \
+	GeoIPv6.dat \
+	GeoLiteCity.dat \
+	GeoLiteCityv6.dat \
+	GeoLiteASNum.dat \
+	GeoIPASNumv6.dat
+do
+	install -p -m 644 data/$db %{buildroot}%{_datadir}/GeoIP/
+done
+
+# make the default GeoIP.dat a symlink to GeoLiteCountry.dat,
+# since it's actually an old snapshot of that database
+ln -sf GeoLiteCountry.dat %{buildroot}%{_datadir}/GeoIP/GeoIP.dat
+
+# add compat symlinks for GeoIPASNum.dat and GeoLiteASNumv6.dat
+ln -sf GeoLiteASNum.dat %{buildroot}%{_datadir}/GeoIP/GeoIPASNum.dat
+ln -sf GeoIPASNumv6.dat %{buildroot}%{_datadir}/GeoIP/GeoLiteASNumv6.dat
 
-# create empty files for initial %%ghost databases
-touch %{buildroot}%{_datadir}/GeoIP/GeoLite{ASNum,City,Country}.dat
-chmod 644 %{buildroot}%{_datadir}/GeoIP/GeoLite{ASNum,City,Country}.dat
+# fetch database updates weekly
+install -D -m 755 geoipupdate.cron %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate
+install -D -m 755 geoipupdate6.cron %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate6
 
 %clean
 rm -rf %{buildroot}
 
-%post
-/sbin/ldconfig
-geoipupdate > /dev/null && \
-	ln -sf GeoLiteCountry.dat %{_datadir}/GeoIP/GeoIP.dat
+%post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
 %files
 # LGPLv2+
-%doc AUTHORS COPYING ChangeLog README TODO LICENSE* fetch-*
+%doc AUTHORS COPYING ChangeLog README TODO fetch-*
 %config(noreplace) %{_sysconfdir}/GeoIP.conf
 %config(noreplace) %{_sysconfdir}/GeoIP.conf.default
 %{_bindir}/geoiplookup
 %{_bindir}/geoiplookup6
-%dir %{_datadir}/GeoIP/
-%{_datadir}/GeoIP/GeoIP-initial.dat
-%verify(not md5 size link mtime) %{_datadir}/GeoIP/GeoIP.dat
-%ghost %{_datadir}/GeoIP/GeoLiteASNum.dat
-%ghost %{_datadir}/GeoIP/GeoLiteCity.dat
-%ghost %{_datadir}/GeoIP/GeoLiteCountry.dat
 %{_libdir}/libGeoIP.so.1
 %{_libdir}/libGeoIP.so.1.*
 %{_mandir}/man1/geoiplookup.1*
@@ -140,10 +175,28 @@ geoipupdate > /dev/null && \
 %{_libdir}/libGeoIPUpdate.so.0
 %{_libdir}/libGeoIPUpdate.so.0.*
 %{_mandir}/man1/geoipupdate.1*
+# CC-BY-SA
+%dir %{_datadir}/GeoIP/
+# This is %%config(noreplace) so that it can be replaced by a commercial database if desired by the end user
+%config(noreplace) %{_datadir}/GeoIP/GeoIP.dat
+# The other databases are %%verify(not md5 size mtime) so that they can be updated via the cron scripts
+# and rpm will not moan about the files having changed
+%verify(not md5 size mtime) %{_datadir}/GeoIP/GeoLiteCountry.dat
+%verify(not md5 size mtime) %{_datadir}/GeoIP/GeoIPv6.dat
+%verify(not md5 size mtime) %{_datadir}/GeoIP/GeoLiteCity.dat
+%verify(not md5 size mtime) %{_datadir}/GeoIP/GeoLiteCityv6.dat
+%verify(not md5 size mtime) %{_datadir}/GeoIP/GeoLiteASNum.dat
+%verify(not md5 size mtime) %{_datadir}/GeoIP/GeoIPASNumv6.dat
+# The compat symlinks are just regular files as they should never need to be changed
+%{_datadir}/GeoIP/GeoIPASNum.dat
+%{_datadir}/GeoIP/GeoLiteASNumv6.dat
 
 %files update
 %{_sysconfdir}/cron.weekly/geoipupdate
 
+%files update6
+%{_sysconfdir}/cron.weekly/geoipupdate6
+
 %files devel
 # LGPLv2+
 %{_includedir}/GeoIP.h
@@ -155,7 +208,20 @@ geoipupdate > /dev/null && \
 %{_libdir}/libGeoIPUpdate.so
 
 %changelog
-* Thu Jun 12 2013 Philip Prindeville <philipp at fedoraproject.org> - 1.5.1-1
+* Tue Jun 18 2013 Paul Howarth <paul at city-fan.org> - 1.5.1-2
+- Properly provide all of the GeoLite databases and their IPv6 equivalents, as
+  per the geoip-geolite package that we're obsoleting/providing
+- Provide compatibility symlinks for database files that historically had
+  different names in GeoIP and geoip-geolite
+- Don't distribute unbundled LICENSE files, as per packaging guidelines
+- Update license tag to reflect distribution of CC-BY-SA database content
+- No longer try to update the databases in %%post
+- Maintain timestamps where possible
+- Set up GeoIP.dat symlink in package and don't touch it again
+- Add update6 package to update the IPv6 databases; have to use wget for this
+  rather than geoipupdate as the databases are still in beta
+
+* Wed Jun 12 2013 Philip Prindeville <philipp at fedoraproject.org> - 1.5.1-1
 - Bump to version 1.5.1
 - Fix exit codes for various situations (MaxMind support #129155)
 - Use versioned obsoletes/provides for geoip-geolite
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 01c2910..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-There are two licenses, one for the C library software, and one for
-the database.
-
-SOFTWARE LICENSE (C library)
-
-The GeoIP C Library is licensed under the LGPL.  For details see
-the COPYING file.
-
-OPEN DATA LICENSE (GeoLite Country and GeoLite City databases)
-
-Copyright (c) 2008 MaxMind, Inc.  All Rights Reserved.
-
-All advertising materials and documentation mentioning features or use of
-this database must display the following acknowledgment:
-"This product includes GeoLite data created by MaxMind, available from
-http://maxmind.com/"
-
-Redistribution and use with or without modification, are permitted provided
-that the following conditions are met:
-1. Redistributions must retain the above copyright notice, this list of
-conditions and the following disclaimer in the documentation and/or other
-materials provided with the distribution. 
-2. All advertising materials and documentation mentioning features or use of
-this database must display the following acknowledgement:
-"This product includes GeoLite data created by MaxMind, available from
-http://maxmind.com/"
-3. "MaxMind" may not be used to endorse or promote products derived from this
-database without specific prior written permission.
-
-THIS DATABASE IS PROVIDED BY MAXMIND, INC ``AS IS'' AND ANY 
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL MAXMIND BE LIABLE FOR ANY 
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/geoipupdate.cron b/geoipupdate.cron
index bacf508..0f92e43 100644
--- a/geoipupdate.cron
+++ b/geoipupdate.cron
@@ -1,7 +1,4 @@
 #!/bin/sh
 
-if geoipupdate > /dev/null; then
-	if [ $(readlink -n /usr/share/GeoIP/GeoIP.dat) == "GeoIP-initial.dat" -a -f "/usr/share/GeoIP/GeoLiteCountry.dat" ]; then
-	  	ln -sf GeoLiteCountry.dat /usr/share/GeoIP/GeoIP.dat
-	fi
-fi
+# This updates the IPv4 databases based on product numbers in /etc/GeoIP.conf
+geoipupdate > /dev/null
diff --git a/geoipupdate6.cron b/geoipupdate6.cron
new file mode 100644
index 0000000..4273968
--- /dev/null
+++ b/geoipupdate6.cron
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Update IPv6 free databases
+
+# It would be much better if we could use geoipupdate for this as it only
+# downloads the data if it has changed and checks it after download
+
+DB_LOC=http://geolite.maxmind.com/download/geoip/database
+ASDB_LOC=http://download.maxmind.com/download/geoip/database/asnum
+
+cd /usr/share/GeoIP
+
+# IPv6 Country database
+wget --quiet $DB_LOC/GeoIPv6.dat.gz && mv -f GeoIPv6.dat GeoIPv6.dat.old && gunzip GeoIPv6.dat
+
+# IPv6 City database
+wget --quiet $DB_LOC/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz && mv -f GeoLiteCityv6.dat GeoLiteCityv6.dat.old && gunzip GeoLiteCityv6.dat
+
+# IPv6 AS Number database
+wget --quiet $ASDB_LOC/GeoIPASNumv6.dat.gz && mv -f GeoIPASNumv6.dat GeoIPASNumv6.dat.old && gunzip GeoIPASNumv6.dat
diff --git a/sources b/sources
index df83d77..09d0af2 100644
--- a/sources
+++ b/sources
@@ -1 +1,7 @@
 36b82f3558e6e2ebdd11a56c5db21dbc  GeoIP-1.5.1.tar.gz
+36bc18ee8b6a42c1ce189a403dcac5cc  GeoIP.dat.gz
+2fa7bf79ea07cd53275d3003c32ce072  GeoIPASNum.dat.gz
+55af75660db5db2f94effcbdc1b7fed9  GeoIPASNumv6.dat.gz
+2768c932480d6c068a951f7f76fd014f  GeoIPv6.dat.gz
+d90484c4eddf964be29ce4222513b48d  GeoLiteCity.dat.gz
+94e89cb4ef255375c5ad89bc33e008a7  GeoLiteCityv6.dat.gz
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/GeoIP.git/commit/?h=el5&id=84346ccb3d89c2237232db0eaca4b8545ba312e7


More information about the scm-commits mailing list