Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/geoip/files/, dev-libs/geoip/
Date: Wed, 08 Dec 2021 02:04:01
Message-Id: 1638929025.e257f3c300909b01309710582e8f09b3d638f864.sam@gentoo
1 commit: e257f3c300909b01309710582e8f09b3d638f864
2 Author: Matt Smith <matt <AT> offtopica <DOT> uk>
3 AuthorDate: Tue May 18 13:55:39 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 8 02:03:45 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e257f3c3
7
8 dev-libs/geoip: Update geoipupdate.sh to use mirrors
9
10 The free databases provided by MaxMind are no longer available and so
11 the script doesn't work. Switch to a different mirror.
12
13 Suggested-by: Alexander Berkes <office <AT> metasoft.at>
14 Closes: https://bugs.gentoo.org/674852
15 Package-Manager: Portage-3.0.18, Repoman-3.0.3
16 Signed-off-by: Matt Smith <matt <AT> offtopica.uk>
17 Closes: https://github.com/gentoo/gentoo/pull/20869
18 Signed-off-by: Sam James <sam <AT> gentoo.org>
19
20 dev-libs/geoip/files/geoipupdate-r7.sh | 46 +++++++++++++++++++++++++++++++
21 dev-libs/geoip/geoip-1.6.12-r1.ebuild | 50 ++++++++++++++++++++++++++++++++++
22 2 files changed, 96 insertions(+)
23
24 diff --git a/dev-libs/geoip/files/geoipupdate-r7.sh b/dev-libs/geoip/files/geoipupdate-r7.sh
25 new file mode 100644
26 index 000000000000..67d26bdc2ed8
27 --- /dev/null
28 +++ b/dev-libs/geoip/files/geoipupdate-r7.sh
29 @@ -0,0 +1,46 @@
30 +#!/bin/sh
31 +
32 +GEOIP_MIRROR="https://mailfud.org/geoip-legacy/"
33 +GEOIPDIR=@PREFIX@/usr/share/GeoIP
34 +TMPDIR=
35 +
36 +DATABASES="
37 + GeoIPv6
38 + GeoIPCity
39 + GeoIPCityv6
40 + GeoIP
41 + GeoIPASNum
42 + GeoIPASNumv6
43 +"
44 +
45 +if [ "${1}" = -f ] || [ "${1}" = --force ]; then
46 + force=true
47 +fi
48 +
49 +if [ -d "${GEOIPDIR}" ]; then
50 + cd $GEOIPDIR
51 + if [ -n "${DATABASES}" ]; then
52 + TMPDIR=$(mktemp -d geoipupdate.XXXXXXXXXX)
53 +
54 + echo "Updating GeoIP databases..."
55 +
56 + for db in $DATABASES; do
57 + fname=$(basename $db)
58 +
59 + if [ -f "${GEOIPDIR}/${fname}.dat" ] || [ ${force} ]; then
60 + wget --no-verbose -t 3 -T 60 \
61 + "${GEOIP_MIRROR}/${db}.dat.gz" \
62 + -O "${TMPDIR}/${fname}.dat.gz"
63 + if [ $? -eq 0 ]; then
64 + gunzip -fdc "${TMPDIR}/${fname}.dat.gz" > "${TMPDIR}/${fname}.dat"
65 + mv "${TMPDIR}/${fname}.dat" "${GEOIPDIR}/${fname}.dat"
66 + chmod 0644 "${GEOIPDIR}/${fname}.dat"
67 + case ${fname} in
68 + GeoLite*) ln -sf ${fname}.dat `echo ${fname} | sed 's/GeoLite/GeoIP/'`.dat ;;
69 + esac
70 + fi
71 + fi
72 + done
73 + [ -d "${TMPDIR}" ] && rm -rf $TMPDIR
74 + fi
75 +fi
76
77 diff --git a/dev-libs/geoip/geoip-1.6.12-r1.ebuild b/dev-libs/geoip/geoip-1.6.12-r1.ebuild
78 new file mode 100644
79 index 000000000000..fd7343e19b73
80 --- /dev/null
81 +++ b/dev-libs/geoip/geoip-1.6.12-r1.ebuild
82 @@ -0,0 +1,50 @@
83 +# Copyright 1999-2021 Gentoo Authors
84 +# Distributed under the terms of the GNU General Public License v2
85 +
86 +EAPI=7
87 +
88 +inherit autotools
89 +
90 +DESCRIPTION="GeoIP Legacy C API"
91 +HOMEPAGE="https://github.com/maxmind/geoip-api-c"
92 +SRC_URI="https://github.com/maxmind/${PN}-api-c/archive/v${PV}.tar.gz -> ${P}.tar.gz"
93 +S="${WORKDIR}/${PN}-api-c-${PV}"
94 +
95 +# GPL-2 for md5.c - part of libGeoIPUpdate, MaxMind for GeoLite Country db
96 +LICENSE="LGPL-2.1 GPL-2 MaxMind2"
97 +SLOT="0"
98 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
99 +IUSE="static-libs"
100 +RESTRICT="test"
101 +
102 +DEPEND="net-misc/wget"
103 +RDEPEND="${DEPEND}"
104 +
105 +src_prepare() {
106 + default
107 + eautoreconf
108 +}
109 +
110 +src_configure() {
111 + econf $(use_enable static-libs static)
112 + sed -e "s|@PREFIX@|${EPREFIX}|g" "${FILESDIR}"/geoipupdate-r7.sh > geoipupdate.sh || die
113 +}
114 +
115 +src_install() {
116 + default
117 +
118 + dodoc AUTHORS ChangeLog NEWS.md README*
119 +
120 + find "${ED}" -name '*.la' -delete || die
121 +
122 + keepdir /usr/share/GeoIP
123 +
124 + dosbin geoipupdate.sh
125 +}
126 +
127 +pkg_postinst() {
128 + ewarn "WARNING: Databases are no longer installed by this ebuild."
129 + elog "Don't forget to run 'geoipupdate.sh -f' (or geoipupdate from"
130 + elog "net-misc/geoipupdate) to populate ${EROOT}/usr/share/GeoIP/"
131 + elog "with geo-located IP address databases."
132 +}