pghmcfc pushed to GeoIP (el5). "Fix noisy geoipupdate runs, restore EL-5 compatibility (..more)"

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


>From d24a137e473a872de2daf7dde8da19cd0321bb53 Mon Sep 17 00:00:00 2001
From: Paul Howarth <paul at city-fan.org>
Date: Mon, 10 Jun 2013 11:23:26 +0100
Subject: Fix noisy geoipupdate runs, restore EL-5 compatibility

- Make GeoIP.dat -> GeoIP-initial.dat symlink in %install, not %post,
  and don't %ghost it
- Run geoipupdate silently in %post and cron job
- Create empty database files for %ghost to work with old rpm versions
- Don't try to use noarch subpackages on old rpm versions
- Update %description to mention database updates

diff --git a/GeoIP.spec b/GeoIP.spec
index 7f3ff1c..cad553f 100644
--- a/GeoIP.spec
+++ b/GeoIP.spec
@@ -1,6 +1,9 @@
+# Noarch subpackages available from Fedora 10, RHEL 6
+%global noarch_subpkgs 0%{?fedora} > 9 || 0%{?rhel} > 5
+
 Name:		GeoIP
 Version:	1.5.0
-Release:	4%{?dist}
+Release:	5%{?dist}
 Summary:	Library for country/city/organization to IP address or hostname mapping
 Group:		Development/Libraries
 License:	LGPLv2+ and GPLv2+
@@ -20,15 +23,18 @@ Provides:	geoip = %{version}-%{release}
 %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
-accurate as of February 2009. 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.
+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.
 
 %package update
 Summary:	Crontab entry to facilitate automatic updates of databases
 Group:		Applications/Databases
 Requires:	crontabs
+%if %{noarch_subpkgs}
 BuildArch:	noarch
+%endif
 
 %description update
 Crontab entry to provide weekly updates of the GeoIP free databases.
@@ -53,6 +59,7 @@ install -D -m644 %{SOURCE1} LICENSE.txt
 install -D -m644 %{SOURCE2} fetch-geoipdata-city.pl
 install -D -m644 %{SOURCE3} fetch-geoipdata.pl
 install -D -m644 %{SOURCE4} README.fedora
+install -D -m644 %{SOURCE5} geoipupdate.cron
 
 %build
 # Fix timestamp order to avoid trying to re-run autotools and configure,
@@ -76,7 +83,7 @@ rm -rf %{buildroot}
 make DESTDIR=%{buildroot} DEFAULT_DB_FILE="%{_datadir}/GeoIP/GeoIP-initial.dat" install
 
 # fetch database updates weekly
-install -D -m755 %{SOURCE5} %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate
+install -D -m755 geoipupdate.cron %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate
 
 # nix the stuff we don't need like .la files.
 rm -f %{buildroot}%{_libdir}/*.la
@@ -88,13 +95,20 @@ sed -i \
 	-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
+
+# 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
+
 %clean
 rm -rf %{buildroot}
 
 %post
 /sbin/ldconfig
-ln -sf GeoIP-initial.dat %{_datadir}/GeoIP/GeoIP.dat
-geoipupdate && \
+geoipupdate > /dev/null && \
 	ln -sf GeoLiteCountry.dat %{_datadir}/GeoIP/GeoIP.dat
 
 %postun -p /sbin/ldconfig
@@ -102,16 +116,16 @@ geoipupdate && \
 %files
 # LGPLv2+
 %doc AUTHORS COPYING ChangeLog README README.fedora TODO LICENSE* fetch-*
-%config(noreplace) %{_sysconfdir}/GeoIP.conf.default
 %config(noreplace) %{_sysconfdir}/GeoIP.conf
-%{_bindir}/geoiplookup6
+%config(noreplace) %{_sysconfdir}/GeoIP.conf.default
 %{_bindir}/geoiplookup
-%{_datadir}/GeoIP/
+%{_bindir}/geoiplookup6
+%dir %{_datadir}/GeoIP/
 %{_datadir}/GeoIP/GeoIP-initial.dat
-%ghost %attr(0644,root,root) %{_datadir}/GeoIP/GeoIP.dat
-%ghost %attr(0644,root,root) %{_datadir}/GeoIP/GeoLiteCountry.dat
-%ghost %attr(0644,root,root) %{_datadir}/GeoIP/GeoLiteCity.dat
-%ghost %attr(0644,root,root) %{_datadir}/GeoIP/GeoLiteASNum.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*
@@ -136,8 +150,19 @@ geoipupdate && \
 %{_libdir}/libGeoIPUpdate.so
 
 %changelog
+* Sat Jun  8 2013 Paul Howarth <paul at city-fan.org> - 1.5.0-5
+- Make GeoIP.dat -> GeoIP-initial.dat symlink in %%install, not %%post,
+  and don't %%ghost it
+- Run geoipupdate silently in %%post and cron job
+- Create empty database files for %%ghost to work with old rpm versions
+- Don't try to use noarch subpackages on old rpm versions
+- Update %%description to mention database updates
+
 * Sat Jun 08 2013 Philip Prindeville <philipp at fedoraproject.org> - 1.5.0-4
-- Revert ability to replace 3rd-party package.
+- Revert ability to replace 3rd-party package
+
+* Fri Jun 07 2013 Philip Prindeville <philipp at fedoraproject.org> - 1.5.0-3
+- Add attributes for %%ghost files
 
 * Fri Jun 07 2013 Philip Prindeville <philipp at fedoraproject.org> - 1.5.0-2
 - Make update subpackage be noarch.
diff --git a/geoipupdate.cron b/geoipupdate.cron
index e536bf3..892b974 100644
--- a/geoipupdate.cron
+++ b/geoipupdate.cron
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-geoipupdate && \
+geoipupdate > /dev/null && \
 	ln -sf GeoLiteCountry.dat /usr/share/GeoIP/GeoIP.dat
-- 
cgit v0.10.2


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


More information about the scm-commits mailing list