Add data subpackage
This commit is contained in:
parent
8b9cff1166
commit
dff481a541
@ -1,7 +1 @@
|
||||
ac1a6809afbb7624aff2f6e12ceb300b12de1715 SOURCES/GeoIP-1.6.12.tar.gz
|
||||
4ec0df2fd67f7d17d581ad5c1b96aa87d6c838e8 SOURCES/GeoIPASNum.dat.gz
|
||||
4085ecf9a64a10214f33a350c2a299b4c292117b SOURCES/GeoIPASNumv6.dat.gz
|
||||
3b7cc30ddfc2f559c14b798f1d7e52241a7d9cdc SOURCES/GeoIPv6.dat.gz
|
||||
a15de3d2059fef4b0e77f3a3bb1b95ac6090eba1 SOURCES/GeoLiteCityv6.dat.gz
|
||||
1342a88b7ec340f7047f34de5ed722ac37c38fe0 SOURCES/GeoIP.dat.gz
|
||||
bb7eca125c87d4df7d41035d3eaafd8be9da9e18 SOURCES/GeoLiteCity.dat.gz
|
||||
|
108
SPECS/GeoIP.spec
108
SPECS/GeoIP.spec
@ -1,5 +1,4 @@
|
||||
# Tests require network access so fail in koji; build using --with tests to run them yourself
|
||||
%global noarch_subpkgs 0%{?fedora} > 9 || 0%{?rhel} > 5
|
||||
%bcond_with tests
|
||||
|
||||
Name: GeoIP
|
||||
@ -9,12 +8,6 @@ Summary: Library for country/city/organization to IP address or hostname mapping
|
||||
License: LGPLv2+
|
||||
URL: http://www.maxmind.com/app/c
|
||||
Source0: https://github.com/maxmind/geoip-api-c/releases/download/v%{version}/GeoIP-%{version}.tar.gz
|
||||
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
|
||||
BuildRequires: coreutils
|
||||
BuildRequires: gcc
|
||||
BuildRequires: make
|
||||
@ -49,34 +42,24 @@ Obsoletes: geoip-devel < %{version}-%{release}
|
||||
Development headers and static libraries for building GeoIP-based applications.
|
||||
|
||||
%package data
|
||||
Summary: Static snapshot of GeoIP databases
|
||||
Group: Applications/Databases
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
%if %{noarch_subpkgs}
|
||||
Summary: GeoLite country data for GeoIP
|
||||
Group: Productivity/Networking/Other
|
||||
BuildArch: noarch
|
||||
%endif
|
||||
|
||||
%description data
|
||||
Snapshot of IPv4 and IPv6 databases for GeoIP. These databases are not
|
||||
regularly updated, use a cron job from GeoIP-update package to get fresh ones.
|
||||
|
||||
This package includes GeoLite data created by MaxMind, available from
|
||||
http://www.maxmind.com/
|
||||
This package does not actually contain any data. It only exists to
|
||||
give ownership the database files you can fetch using
|
||||
"geoip-fetch".
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
install -p -m 644 %{SOURCE10} data/GeoIP-initial.dat.gz; gunzip data/GeoIP-initial.dat
|
||||
install -p -m 644 %{SOURCE11} data/GeoIPv6-initial.dat.gz; gunzip data/GeoIPv6-initial.dat
|
||||
# City and ASN databases will be in GeoIP-data subpackage as -initial files
|
||||
# and linked to non--initial on installation of the subpackage.
|
||||
install -p -m 644 %{SOURCE12} data/GeoIPCity-initial.dat.gz; gunzip data/GeoIPCity-initial.dat
|
||||
install -p -m 644 %{SOURCE13} data/GeoIPCityv6-initial.dat.gz; gunzip data/GeoIPCityv6-initial.dat
|
||||
install -p -m 644 %{SOURCE14} data/GeoIPASNum-initial.dat.gz; gunzip data/GeoIPASNum-initial.dat
|
||||
install -p -m 644 %{SOURCE15} data/GeoIPASNumv6-initial.dat.gz; gunzip data/GeoIPASNumv6-initial.dat
|
||||
|
||||
%build
|
||||
%configure --disable-static --disable-dependency-tracking
|
||||
|
||||
sed -i -e '/-DGEOIPDATADIR/s,\$(pkgdatadir),%{_localstatedir}/lib/GeoIP,' libGeoIP/Makefile{.am,.in,}
|
||||
sed -i -e 's,\$(pkgdatadir),%{_localstatedir}/lib/GeoIP,' man/Makefile{.am,.in,}
|
||||
|
||||
# Kill bogus rpaths
|
||||
sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
|
||||
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
|
||||
@ -86,37 +69,10 @@ make %{?_smp_mflags}
|
||||
%install
|
||||
make DESTDIR=%{buildroot} INSTALL="install -p" install
|
||||
|
||||
install -d %{buildroot}%{_localstatedir}/lib/GeoIP %{buildroot}%{_prefix}/lib/geoip/
|
||||
|
||||
# nix the stuff we don't need like .la files.
|
||||
rm -f %{buildroot}%{_libdir}/*.la
|
||||
# install downloaded GeoLite databases
|
||||
for db in \
|
||||
GeoIP-initial.dat \
|
||||
GeoIPv6-initial.dat \
|
||||
GeoIPCity-initial.dat \
|
||||
GeoIPCityv6-initial.dat \
|
||||
GeoIPASNum-initial.dat \
|
||||
GeoIPASNumv6-initial.dat
|
||||
do
|
||||
install -p -m 644 data/$db %{buildroot}%{_datadir}/GeoIP/
|
||||
done
|
||||
|
||||
# create empty files for initial %%ghost databases
|
||||
touch %{buildroot}%{_datadir}/GeoIP/GeoIP{ASNum,City,Country}{,v6}.dat
|
||||
chmod 644 %{buildroot}%{_datadir}/GeoIP/GeoIP{ASNum,City,Country}{,v6}.dat
|
||||
|
||||
# make the default GeoIP.dat a symlink to our -initial data file.
|
||||
ln -sf GeoIP-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIP.dat
|
||||
ln -sf GeoIPv6-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIPv6.dat
|
||||
|
||||
#links used when invoking geoiplookup -v
|
||||
ln -sf GeoIPCity-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIPCity.dat
|
||||
ln -sf GeoIPCityv6-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIPCityv6.dat
|
||||
|
||||
# Add compat symlinks for GeoIPASNum.dat and GeoLiteASNumv6.dat
|
||||
# ([upstream] database names used in the old geoip-geolite package)
|
||||
ln -sf GeoIPASNum.dat %{buildroot}%{_datadir}/GeoIP/GeoIPASNum.dat
|
||||
ln -sf GeoIPASNumv6.dat %{buildroot}%{_datadir}/GeoIP/GeoIPASNumv6.dat
|
||||
|
||||
|
||||
%check
|
||||
# Tests require network access so fail in koji; build using --with tests to run them yourself
|
||||
@ -124,28 +80,6 @@ ln -sf GeoIPASNumv6.dat %{buildroot}%{_datadir}/GeoIP/GeoIPASNumv6.dat
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%post data
|
||||
# Link *-initial.dat files as official GeoIP database files. Make sure not to
|
||||
# overwrite any user databases!
|
||||
for db in GeoIPCity.dat GeoIPCityv6.dat GeoIPASNum.dat GeoIPASNumv6.dat ; do
|
||||
db_initial=${db%.dat}-initial.dat
|
||||
if [ ! -e "/usr/share/GeoIP/$db" ]; then
|
||||
ln -s "/usr/share/GeoIP/$db_initial" "/usr/share/GeoIP/$db" &>/dev/null || :
|
||||
fi
|
||||
done
|
||||
|
||||
%postun data
|
||||
if [ "$1" == "0" ]; then
|
||||
for db in GeoIPCity.dat GeoIPCityv6.dat GeoIPASNum.dat GeoIPASNumv6.dat ; do
|
||||
db_initial=${db%.dat}-initial.dat
|
||||
# Remove links to -initial files, ignoring links anywhere else
|
||||
if [ -h "/usr/share/GeoIP/$db" -a $(readlink /usr/share/GeoIP/$db) = "/usr/share/GeoIP/$db_initial" ]; then
|
||||
rm "/usr/share/GeoIP/$db" &>/dev/null || :
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
%files
|
||||
%if 0%{?_licensedir:1}
|
||||
%license COPYING
|
||||
@ -159,19 +93,6 @@ fi
|
||||
%{_libdir}/libGeoIP.so.1.*
|
||||
%{_mandir}/man1/geoiplookup.1*
|
||||
%{_mandir}/man1/geoiplookup6.1*
|
||||
%dir %{_datadir}/GeoIP/
|
||||
%{_datadir}/GeoIP/GeoIP-initial.dat
|
||||
%{_datadir}/GeoIP/GeoIPv6-initial.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 link mtime) %{_datadir}/GeoIP/GeoIP.dat
|
||||
%verify(not md5 size link mtime) %{_datadir}/GeoIP/GeoIPv6.dat
|
||||
%ghost %{_datadir}/GeoIP/GeoIPASNum.dat
|
||||
%ghost %{_datadir}/GeoIP/GeoIPCity.dat
|
||||
%ghost %{_datadir}/GeoIP/GeoIPCountry.dat
|
||||
%ghost %{_datadir}/GeoIP/GeoIPASNumv6.dat
|
||||
%ghost %{_datadir}/GeoIP/GeoIPCityv6.dat
|
||||
%ghost %{_datadir}/GeoIP/GeoIPCountryv6.dat
|
||||
|
||||
%files devel
|
||||
%{_includedir}/GeoIP.h
|
||||
@ -180,10 +101,11 @@ fi
|
||||
%{_libdir}/pkgconfig/geoip.pc
|
||||
|
||||
%files data
|
||||
%{_datadir}/GeoIP/GeoIPCity-initial.dat
|
||||
%{_datadir}/GeoIP/GeoIPCityv6-initial.dat
|
||||
%{_datadir}/GeoIP/GeoIPASNum-initial.dat
|
||||
%{_datadir}/GeoIP/GeoIPASNumv6-initial.dat
|
||||
%dir %{_localstatedir}/lib/%{name}
|
||||
%ghost %{_localstatedir}/lib/%{name}/GeoIP.dat
|
||||
%ghost %{_localstatedir}/lib/%{name}/GeoIPASNum.dat
|
||||
%ghost %{_localstatedir}/lib/%{name}/GeoIPCity.dat
|
||||
%ghost %{_localstatedir}/lib/%{name}/GeoIPv6.dat
|
||||
|
||||
%changelog
|
||||
* Thu Nov 28 2019 Thomas Andrejak <thomas.andrejak@gmail.com> - 1.6.12-7
|
||||
|
Loading…
Reference in New Issue
Block a user