Gentoo Archives: gentoo-commits

From: "Aaron Swenson (titanofold)" <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-db/postgis: postgis-1.5.8.ebuild ChangeLog postgis-1.3.6-r2.ebuild postgis-2.0.2.ebuild postgis-1.4.2-r2.ebuild
Date: Wed, 30 Jan 2013 14:47:02
Message-Id: 20130130144658.CC7BC2171E@flycatcher.gentoo.org
1 titanofold 13/01/30 14:46:58
2
3 Modified: ChangeLog
4 Added: postgis-1.5.8.ebuild postgis-1.3.6-r2.ebuild
5 postgis-2.0.2.ebuild postgis-1.4.2-r2.ebuild
6 Log:
7 Version bumps. Fixes bugs 339116, 423349, and 454276.
8
9 (Portage version: 2.1.11.31/cvs/Linux x86_64, signed Manifest commit with key D1BBFDA0)
10
11 Revision Changes Path
12 1.72 dev-db/postgis/ChangeLog
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/ChangeLog?rev=1.72&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/ChangeLog?rev=1.72&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/ChangeLog?r1=1.71&r2=1.72
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v
21 retrieving revision 1.71
22 retrieving revision 1.72
23 diff -u -r1.71 -r1.72
24 --- ChangeLog 1 Nov 2012 06:39:12 -0000 1.71
25 +++ ChangeLog 30 Jan 2013 14:46:58 -0000 1.72
26 @@ -1,6 +1,17 @@
27 # ChangeLog for dev-db/postgis
28 -# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.71 2012/11/01 06:39:12 patrick Exp $
30 +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
31 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.72 2013/01/30 14:46:58 titanofold Exp $
32 +
33 +*postgis-2.0.2 (30 Jan 2013)
34 +*postgis-1.5.8 (30 Jan 2013)
35 +*postgis-1.4.2-r2 (30 Jan 2013)
36 +*postgis-1.3.6-r2 (30 Jan 2013)
37 +
38 + 30 Jan 2013; Aaron W. Swenson <titanofold@g.o>
39 + +postgis-1.3.6-r2.ebuild, +postgis-1.4.2-r2.ebuild, +postgis-1.5.8.ebuild,
40 + +files/postgis-1.5-ldflags.patch, +postgis-2.0.2.ebuild,
41 + +files/postgis-2.0-ldflags.patch:
42 + Version bumps. Fixes bugs 339116, 423349, and 454276.
43
44 *postgis-1.5.5 (01 Nov 2012)
45
46
47
48
49 1.1 dev-db/postgis/postgis-1.5.8.ebuild
50
51 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-1.5.8.ebuild?rev=1.1&view=markup
52 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-1.5.8.ebuild?rev=1.1&content-type=text/plain
53
54 Index: postgis-1.5.8.ebuild
55 ===================================================================
56 # Copyright 1999-2013 Gentoo Foundation
57 # Distributed under the terms of the GNU General Public License v2
58 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.5.8.ebuild,v 1.1 2013/01/30 14:46:58 titanofold Exp $
59
60 EAPI="4"
61
62 inherit eutils versionator
63
64 DESCRIPTION="Geographic Objects for PostgreSQL"
65 HOMEPAGE="http://postgis.net"
66 SRC_URI="http://download.osgeo.org/postgis/source/${P}.tar.gz"
67 LICENSE="GPL-2"
68 SLOT="0"
69 KEYWORDS="~amd64 ~ppc ~x86"
70 IUSE="doc gtk"
71
72 RDEPEND="
73 || (
74 dev-db/postgresql-server:9.1
75 dev-db/postgresql-server:9.0
76 dev-db/postgresql-server:8.4
77 dev-db/postgresql-server:8.3
78 )
79 dev-libs/libxml2:2
80 >=sci-libs/geos-3.2
81 >=sci-libs/proj-4.6.0
82 gtk? ( x11-libs/gtk+:2 )
83 "
84
85 DEPEND="${RDEPEND}
86 doc? (
87 app-text/docbook-xsl-stylesheets
88 app-text/docbook-xml-dtd:4.3
89 dev-libs/libxslt
90 || (
91 media-gfx/imagemagick
92 media-gfx/graphicsmagick[imagemagick]
93 )
94 )
95 "
96
97 RESTRICT="test"
98
99 PGIS="$(get_version_component_range 1-2)"
100
101 # not parallel safe
102 MAKEOPTS+=" -j1"
103
104 pkg_setup() {
105 export PGSLOT="$(postgresql-config show)"
106
107 if [[ ${PGSLOT//.} < 83 || ${PGSLOT//.} > 91 ]] ; then
108 eerror "You must build ${CATEGORY}/${P} against PostgreSQL 8.3 - 9.1."
109 eerror "Set an appropriate slot with postgresql-config."
110 die 'Select a PostgreSQL slot between 8.3 and 9.1'
111 fi
112 }
113
114 src_prepare() {
115 epatch "${FILESDIR}/${PN}-${PGIS}-ldflags.patch"
116 }
117
118 src_configure() {
119 local myargs=""
120 use gtk && myargs+=" --with-gui"
121 econf ${myargs}
122 }
123
124 src_compile() {
125 # Occasionally, builds fail because of out of order compilation.
126 # Otherwise, it'd be fine.
127 emake
128 emake -C topology
129 use doc && emake -C doc
130 }
131
132 src_install() {
133 emake DESTDIR="${D}" install
134 emake -C topology DESTDIR="${D}" install
135
136 cd "${S}"
137 dodoc CREDITS TODO loader/README.* doc/*txt
138
139 docinto topology
140 dodoc topology/{TODO,README}
141 dobin ./utils/postgis_restore.pl
142
143 if use doc; then
144 cd doc/html
145 dohtml -r *
146 fi
147
148 insinto /etc
149 doins "${FILESDIR}/postgis_dbs"
150
151 cd "${S}/doc"
152 doman man/*
153 insinto /usr/share/postgresql-${PGSLOT}/contrib/postgis-${PGIS}/
154 doins postgis_comments.sql
155 }
156
157 pkg_postinst() {
158 postgresql-config update
159
160 elog "To finish installing or updating PostGIS edit:"
161 elog " ${EROOT%/}/etc/postgis_dbs"
162 elog
163 elog "Then, run:"
164 elog " emerge --config =${CATEGORY}/${PF}"
165 }
166
167 pkg_config(){
168 source "${EROOT%/}/etc/conf.d/postgresql-${PGSLOT}"
169 source "${EROOT%/}/etc/postgis_dbs"
170 local postgis_path="${EROOT%/}/usr/share/postgresql-${PGSLOT}/contrib/postgis-${PGIS}"
171
172 if [[ -n ${configured} ]] ; then
173 einfon "Password for PostgreSQL user '${pguser}': "
174 read -s PGPASSWORD
175 export PGPASSWORD
176 echo
177 else
178 eerror "You must edit:"
179 eerror " ${EROOT%/}/etc/postgis_dbs"
180 eerror "Before running 'emerge --config =${CATEGORY}/${PF}'"
181 eerror
182 die "Edit postgis_dbs"
183 fi
184
185 # The server we work with must be the same slot we built against.
186 local server_version
187 server_version=$(psql -U ${pguser} -d postgres -p ${PGPORT} \
188 -Aqwtc 'SELECT version()' 2> /dev/null)
189 if [[ $? = 0 ]] ; then
190 server_version=$(echo ${server_version} | cut -d " " -f 2 | \
191 cut -d "." -f -2 | tr -d .)
192 if [[ $server_version != ${PGSLOT//.} ]] ; then
193 unset PGPASSWORD
194 eerror "Server version must be ${PGSLOT}.x"
195 die "Server version isn't ${PGSLOT}.x"
196 fi
197 else
198 unset PGPASSWORD
199 eerror "Is the server running?"
200 die "Couldn't connect to server."
201 fi
202
203 local retval
204 safe_exit() {
205 unset PGPASSWORD
206 sed -e 's/\(configured\)/#\1/' -i "${EROOT%/}/etc/postgis_dbs"
207 eend $retval
208 eerror "All actions could not be performed."
209 eerror "Read above to see what failed."
210 eerror "Once you fix the issue, you'll need to edit:"
211 eerror " ${EROOT%/}/etc/postgis_dbs"
212 eerror "As some things may have succeeded."
213 eerror
214 die "All actions could not be performed"
215 }
216
217 local db
218 for db in ${databases[@]} ; do
219 ebegin "Performing CREATE LANGUAGE on ${db}"
220 createlang -U ${pguser} -p ${PGPORT} plpgsql ${db}
221 retval=$?
222 # In this case, only error code 1 is fatal
223 [[ $retval == 1 ]] && safe_exit || eend 0
224
225 ebegin "Enabling PostGIS on ${db}"
226 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
227 -f "${postgis_path}/postgis.sql"
228 retval=$?
229 [[ $retval == 0 ]] && eend 0 || safe_exit
230 done
231
232 for db in ${templates[@]} ; do
233 ebegin "Creating template database '${db}'"
234 createdb -p ${PGPORT} -U ${pguser} -O ${pguser} -T ${from_template} \
235 ${db} "PostGIS Template"
236 retval=$?
237 [[ $retval != 0 ]] && safe_exit
238
239 psql -q -U ${pguser} -p ${PGPORT} -c \
240 "UPDATE pg_database \
241 SET datistemplate = TRUE, datallowconn = TRUE \
242 WHERE datname = '${db}'"
243 retval=$?
244 [[ $retval != 0 ]] && safe_exit
245
246 createlang -U ${pguser} -p ${PGPORT} plpgsql ${db}
247 retval=$?
248 # In this case, only error code 1 is fatal
249 [[ $retval == 1 ]] && safe_exit
250
251 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
252 -f "${postgis_path}/postgis.sql"
253 retval=$?
254 [[ $retval == 0 ]] && eend 0 || safe_exit
255 done
256
257 for db in ${epsg_databases[@]} ; do
258 ebegin "Adding EPSG to ${db}"
259 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
260 -f "${postgis_path}/spatial_ref_sys.sql"
261 retval=$?
262 [[ $retval == 0 ]] && eend 0 || safe_exit
263 done
264
265 for db in ${comment_databases[@]} ; do
266 ebegin "Adding comments on ${db}"
267 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
268 -f "${postgis_path}/postgis_comments.sql"
269 retval=$?
270 [[ $retval == 0 ]] && eend 0 || safe_exit
271 done
272
273 for db in ${upgrade_from_1_3[@]} ; do
274 ebegin "Upgrading from PostGIS 1.3 to ${PGIS} on ${db}"
275 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
276 -f "${postgis_path}/postgis_upgrade_13_to_${PGIS//.}.sql"
277 retval=$?
278 [[ $retval == 0 ]] && eend 0 || safe_exit
279 done
280
281 for db in ${upgrade_from_1_4[@]} ; do
282 ebegin "Upgrading from PostGIS 1.4 to ${PGIS} on ${db}"
283 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
284 -f "${postgis_path}/postgis_upgrade_14_to_${PGIS//.}.sql"
285 retval=$?
286 [[ $retval == 0 ]] && eend 0 || safe_exit
287 done
288
289 for db in ${upgrade_from_1_5[@]} ; do
290 ebegin "Minor upgrade for PostGIS ${PGIS} on ${db}"
291 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
292 -f "${postgis_path}/postgis_upgrade_${PGIS//.}_minor.sql"
293 retval=$?
294 [[ $retval == 0 ]] && eend 0 || safe_exit
295 done
296
297 # Clean up and make it so the user has to edit postgis_dbs again that
298 # way this script won't step on any toes due to user error.
299 unset PGPASSWORD
300 sed -e 's/\(configured\)/#\1/' -i "${EROOT%/}/etc/postgis_dbs"
301 einfo "PostgreSQL ${PGSLOT} is now PostGIS enabled."
302 einfo
303 einfo "To enable other databases, change the default slot:"
304 einfo " postgresql-config set <slot>"
305 einfo "Then, emerge this package again:"
306 einfo " emerge -av =${CATEGORY}/${PF}"
307 }
308
309
310
311 1.1 dev-db/postgis/postgis-1.3.6-r2.ebuild
312
313 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-1.3.6-r2.ebuild?rev=1.1&view=markup
314 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-1.3.6-r2.ebuild?rev=1.1&content-type=text/plain
315
316 Index: postgis-1.3.6-r2.ebuild
317 ===================================================================
318 # Copyright 1999-2013 Gentoo Foundation
319 # Distributed under the terms of the GNU General Public License v2
320 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.3.6-r2.ebuild,v 1.1 2013/01/30 14:46:58 titanofold Exp $
321
322 EAPI="1"
323
324 inherit eutils multilib versionator
325
326 DESCRIPTION="Geographic Objects for PostgreSQL"
327 HOMEPAGE="http://postgis.net"
328 SRC_URI="http://download.osgeo.org/postgis/source/${P}.tar.gz"
329 LICENSE="GPL-2"
330 SLOT="0"
331 KEYWORDS="~amd64 ~ppc ~x86"
332 IUSE="geos proj doc"
333
334 RDEPEND=" || (
335 dev-db/postgresql-server:8.4
336 dev-db/postgresql-server:8.3
337 dev-db/postgresql-server:8.2
338 dev-db/postgresql-server:8.1
339 dev-db/postgresql-server:8.0
340 )
341 geos? ( sci-libs/geos )
342 proj? ( sci-libs/proj )"
343
344 DEPEND="${RDEPEND}
345 doc? ( app-text/docbook-xsl-stylesheets )"
346
347 RESTRICT="test"
348
349 pkg_setup(){
350 export PGSLOT="$(postgresql-config show)"
351
352 if [[ ${PGSLOT//.} < 71 || ${PGSLOT//.} > 84 ]] ; then
353 eerror "You must build ${CATEGORY}/${P} against PostgreSQL 7.1 - 8.4."
354 eerror "Set an appropriate slot with postgresql-config."
355 die 'Select a PostgreSQL slot between 8.4 and 9.2'
356 fi
357
358 if [ ! -z "${PGUSER}" ]; then
359 eval unset PGUSER
360 fi
361 if [ ! -z "${PGDATABASE}" ]; then
362 eval unset PGDATABASE
363 fi
364 local tmp
365 tmp="$(portageq match / ${CATEGORY}/${PN} | cut -d'.' -f2)"
366 if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
367 elog "You must soft upgrade your existing postgis enabled databases"
368 elog "by adding their names in the ${ROOT}conf.d/postgis_dbs file"
369 elog "then using 'emerge --config postgis'."
370 require_soft_upgrade="1"
371 ebeep 2
372 fi
373 }
374
375 src_compile(){
376 local myconf
377 if use geos; then
378 myconf="--with-geos"
379 fi
380
381 if use doc; then
382 myconf="${myconf} --with-xsl=$(ls "${ROOT}"usr/share/sgml/docbook/* | \
383 grep xsl\- | cut -d':' -f1)"
384 fi
385
386 econf --enable-autoconf \
387 --datadir=/usr/share/postgresql/contrib/ \
388 --libdir=/usr/$(get_libdir)/postgresql/ \
389 --with-docdir=/usr/share/doc/${PF}/html/ \
390 ${myconf} \
391 $(use_with proj) ||\
392 die "Error: econf failed"
393
394 emake || die "Error: emake failed"
395
396 cd topology/
397 emake || die "Unable to build topology sql file"
398
399 if use doc ; then
400 cd "${S}"
401 emake docs || die "Unable to build documentation"
402 fi
403 }
404
405 src_install(){
406 dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
407 emake DESTDIR="${D}" install || die "emake install failed"
408 cd "${S}/topology/"
409 emake DESTDIR="${D}" install || die "emake install topology failed"
410
411 cd "${S}"
412 dodoc CREDITS TODO loader/README.* doc/*txt
413
414 docinto topology
415 dodoc topology/{TODO,README}
416 dobin ./utils/postgis_restore.pl
417
418 cd "${S}"
419 if use doc; then
420 emake DESTDIR="${D}" docs-install || die "emake install docs failed"
421 fi
422
423 echo "template_gis" > postgis_dbs
424 doconfd postgis_dbs
425
426 if [ ! -z "${require_soft_upgrade}" ]; then
427 grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql | \
428 grep -v "'sql'" > \
429 "${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
430 fi
431 }
432
433 pkg_postinst() {
434 elog "To create new (upgrade) spatial databases add their names in the"
435 elog "${ROOT}conf.d/postgis_dbs file, then use 'emerge --config postgis'."
436 }
437
438 pkg_config(){
439 einfo "Create or upgrade a spatial templates and databases."
440 einfo "Please add your databases names into ${ROOT}conf.d/postgis_dbs"
441 einfo "(templates name have to be prefixed with 'template')."
442 for i in $(cat "${ROOT}etc/conf.d/postgis_dbs"); do
443 source "${ROOT}"etc/conf.d/postgresql
444 PGDATABASE=${i}
445 eval set PGDATABASE=${i}
446 myuser="${PGUSER:-postgres}"
447 mydb="${PGDATABASE:-template_gis}"
448 eval set PGUSER=${myuser}
449
450 is_template=false
451 if [ "${mydb:0:8}" == "template" ];then
452 is_template=true
453 mytype="template database"
454 else
455 mytype="database"
456 fi
457
458 einfo
459 einfo "Using the user ${myuser} and the ${mydb} ${mytype}."
460
461 logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
462 safe_exit(){
463 eerror "Removing created ${mydb} ${mytype}"
464 dropdb -q -U "${myuser}" "${mydb}" ||\
465 (eerror "${1}"
466 die "Removing old db failed, you must do it manually")
467 eerror "Please read ${logfile} for more information."
468 die "${1}"
469 }
470
471 # if there is not a table or a template existing with the same name, create.
472 if [ -z "$(psql -U ${myuser} -l | grep "${mydb}")" ]; then
473 createdb -q -O ${myuser} -U ${myuser} ${mydb} ||\
474 die "Unable to create the ${mydb} ${mytype} as ${myuser}"
475 createlang -U ${myuser} plpgsql ${mydb}
476 if [ "$?" == 2 ]; then
477 safe_exit "Unable to createlang plpgsql ${mydb}."
478 fi
479 (psql -q -U ${myuser} ${mydb} -f \
480 "${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
481 psql -q -U ${myuser} ${mydb} -f \
482 "${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
483 "${logfile}"
484 if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
485 safe_exit "Unable to load sql files."
486 fi
487 if ${is_template}; then
488 psql -q -U ${myuser} ${mydb} -c \
489 "UPDATE pg_database SET datistemplate = TRUE
490 WHERE datname = '${mydb}';
491 GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;" \
492 || die "Unable to create ${mydb}"
493 psql -q -U ${myuser} ${mydb} -c \
494 "VACUUM FREEZE;" || die "Unable to set VACUUM FREEZE option"
495 fi
496 else
497 if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
498 then
499 einfo "Updating the dynamic library references"
500 psql -q -f \
501 "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
502 2> "${logfile}"
503 if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
504 safe_exit "Unable to update references."
505 fi
506 fi
507 if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
508 then
509 einfo "Running soft upgrade"
510 psql -q -U ${myuser} ${mydb} -f \
511 "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
512 "${logfile}"
513 if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
514 safe_exit "Unable to run soft upgrade."
515 fi
516 fi
517 fi
518 if ${is_template}; then
519 einfo "You can now create a spatial database using :"
520 einfo "'createdb -T ${mydb} test'"
521 fi
522 done
523 }
524
525
526
527 1.1 dev-db/postgis/postgis-2.0.2.ebuild
528
529 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-2.0.2.ebuild?rev=1.1&view=markup
530 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-2.0.2.ebuild?rev=1.1&content-type=text/plain
531
532 Index: postgis-2.0.2.ebuild
533 ===================================================================
534 # Copyright 1999-2013 Gentoo Foundation
535 # Distributed under the terms of the GNU General Public License v2
536 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-2.0.2.ebuild,v 1.1 2013/01/30 14:46:58 titanofold Exp $
537
538 EAPI="4"
539
540 inherit eutils versionator
541
542 DESCRIPTION="Geographic Objects for PostgreSQL"
543 HOMEPAGE="http://postgis.net"
544 SRC_URI="http://download.osgeo.org/postgis/source/${P}.tar.gz"
545 LICENSE="GPL-2"
546 SLOT="0"
547 KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
548 IUSE="doc gtk"
549
550 RDEPEND="
551 || (
552 dev-db/postgresql-server:9.2
553 dev-db/postgresql-server:9.1
554 dev-db/postgresql-server:9.0
555 dev-db/postgresql-server:8.4
556 )
557 dev-libs/libxml2:2
558 >=sci-libs/geos-3.3.3
559 >=sci-libs/proj-4.6.0
560 >=sci-libs/gdal-1.9
561 gtk? ( x11-libs/gtk+:2 )
562 "
563
564 DEPEND="${RDEPEND}
565 doc? (
566 app-text/docbook-xsl-stylesheets
567 app-text/docbook-xml-dtd:4.3
568 dev-libs/libxslt
569 || (
570 media-gfx/imagemagick[png]
571 media-gfx/graphicsmagick[imagemagick,png]
572 )
573 )
574 "
575
576 PGIS="$(get_version_component_range 1-2)"
577
578 RESTRICT="test"
579
580 # These modules are built using the same *FLAGS that were used to build
581 # dev-db/postgresql. The right thing to do is to ignore the current
582 # *FLAGS settings.
583 QA_FLAGS_IGNORED="usr/lib(64)?/(rt)?postgis-${PGIS}\.so"
584
585 pkg_setup() {
586 export PGSLOT="$(postgresql-config show)"
587
588 if [[ ${PGSLOT//.} < 84 || ${PGSLOT//.} > 92 ]] ; then
589 eerror "You must build ${CATEGORY}/${P} against PostgreSQL 8.4 - 9.2."
590 eerror "Set an appropriate slot with postgresql-config."
591 die 'Select a PostgreSQL slot between 8.4 and 9.2'
592 fi
593 }
594
595 src_prepare() {
596 epatch "${FILESDIR}/${PN}-${PGIS}-ldflags.patch"
597 }
598
599 src_configure() {
600 local myargs=""
601 use gtk && myargs+=" --with-gui"
602 econf ${myargs}
603 }
604
605 src_compile() {
606 # Occasionally, builds fail because of out of order compilation.
607 # Otherwise, it'd be fine.
608 emake
609 emake -C topology
610 use doc && emake -C doc html -j1
611 }
612
613 src_install() {
614 emake DESTDIR="${D}" install
615 emake DESTDIR="${D}" comments-install
616 emake -C topology DESTDIR="${D}" install
617 dobin ./utils/postgis_restore.pl
618
619 dodoc CREDITS TODO loader/README.* doc/*txt
620
621 use doc && dohtml -r doc/html/*
622
623 docinto topology
624 dodoc topology/{TODO,README}
625
626 insinto /etc
627 doins "${FILESDIR}/postgis_dbs"
628 }
629
630 pkg_postinst() {
631 postgresql-config update
632
633 elog "To finish installing or updating PostGIS edit:"
634 elog " ${EROOT%/}/etc/postgis_dbs"
635 elog
636 elog "Then, run:"
637 elog " emerge --config =${CATEGORY}/${PF}"
638 }
639
640 pkg_config(){
641 source "${EROOT%/}/etc/conf.d/postgresql-${PGSLOT}"
642 source "${EROOT%/}/etc/postgis_dbs"
643 local postgis_path="${EROOT%/}/usr/share/postgresql-${PGSLOT}/contrib/postgis-${PGIS}"
644
645 if [[ -n ${configured} ]] ; then
646 einfon "Password for PostgreSQL user '${pguser}': "
647 read -s PGPASSWORD
648 export PGPASSWORD
649 echo
650 else
651 eerror "You must edit:"
652 eerror " ${EROOT%/}/etc/postgis_dbs"
653 eerror "Before running 'emerge --config =${CATEGORY}/${PF}'"
654 eerror
655 die "Edit postgis_dbs"
656 fi
657
658 # The server we work with must be the same slot we built against.
659 local server_version
660 server_version=$(psql -U ${pguser} -d postgres -p ${PGPORT} \
661 -Aqwtc 'SELECT version()' 2> /dev/null)
662 if [[ $? = 0 ]] ; then
663 server_version=$(echo ${server_version} | cut -d " " -f 2 | \
664 cut -d "." -f -2 | tr -d .)
665 if [[ $server_version != ${PGSLOT//.} ]] ; then
666 unset PGPASSWORD
667 eerror "Server version must be ${PGSLOT}.x"
668 die "Server version isn't ${PGSLOT}.x"
669 fi
670 else
671 unset PGPASSWORD
672 eerror "Is the server running?"
673 die "Couldn't connect to server."
674 fi
675
676 local retval
677 safe_exit() {
678 unset PGPASSWORD
679 sed -e 's/\(configured\)/#\1/' -i "${EROOT%/}/etc/postgis_dbs"
680 eend $retval
681 eerror "All actions could not be performed."
682 eerror "Read above to see what failed."
683 eerror "Once you fix the issue, you'll need to edit:"
684 eerror " ${EROOT%/}/etc/postgis_dbs"
685 eerror "As some things may have succeeded."
686 eerror
687 die "All actions could not be performed"
688 }
689
690 local db
691 for db in ${databases[@]} ; do
692 ebegin "Performing CREATE LANGUAGE on ${db}"
693 createlang -U ${pguser} -p ${PGPORT} plpgsql ${db}
694 retval=$?
695 # In this case, only error code 1 is fatal
696 [[ $retval == 1 ]] && safe_exit || eend 0
697
698 ebegin "Enabling PostGIS on ${db}"
699 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
700 -f "${postgis_path}/postgis.sql"
701 retval=$?
702 [[ $retval == 0 ]] && eend 0 || safe_exit
703 done
704
705 for db in ${templates[@]} ; do
706 ebegin "Creating template database '${db}'"
707 createdb -p ${PGPORT} -U ${pguser} -O ${pguser} -T ${from_template} \
708 ${db} "PostGIS Template"
709 retval=$?
710 [[ $retval != 0 ]] && safe_exit
711
712 psql -q -U ${pguser} -p ${PGPORT} -c \
713 "UPDATE pg_database \
714 SET datistemplate = TRUE, datallowconn = TRUE \
715 WHERE datname = '${db}'"
716 retval=$?
717 [[ $retval != 0 ]] && safe_exit
718
719 createlang -U ${pguser} -p ${PGPORT} plpgsql ${db}
720 retval=$?
721 # In this case, only error code 1 is fatal
722 [[ $retval == 1 ]] && safe_exit
723
724 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
725 -f "${postgis_path}/postgis.sql"
726 retval=$?
727 [[ $retval == 0 ]] && eend 0 || safe_exit
728 done
729
730 for db in ${epsg_databases[@]} ; do
731 ebegin "Adding EPSG to ${db}"
732 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
733 -f "${postgis_path}/spatial_ref_sys.sql"
734 retval=$?
735 [[ $retval == 0 ]] && eend 0 || safe_exit
736 done
737
738 for db in ${comment_databases[@]} ; do
739 ebegin "Adding comments on ${db}"
740 local comment_file
741 for comment_file in "${postgis_path}"/*_comments.sql ; do
742 psql -q -U ${pguser} -p ${PGPORT} -d ${db} -f "${comment_file}"
743 retval=$?
744 [[ $retval == 0 ]] && continue || safe_exit
745 done
746 eend 0
747 done
748
749 for db in ${upgrade_from_1_3[@]} ; do
750 ebegin "Upgrading from PostGIS 1.3 to ${PGIS} on ${db}"
751 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
752 -f "${postgis_path}/postgis_upgrade_13_to_${PGIS//.}.sql"
753 retval=$?
754 [[ $retval == 0 ]] && eend 0 || safe_exit
755 done
756
757 for db in ${upgrade_from_1_4[@]} ; do
758 ebegin "Upgrading from PostGIS 1.4 to ${PGIS} on ${db}"
759 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
760 -f "${postgis_path}/postgis_upgrade_14_to_${PGIS//.}.sql"
761 retval=$?
762 [[ $retval == 0 ]] && eend 0 || safe_exit
763 done
764
765 for db in ${upgrade_from_1_5[@]} ; do
766 ebegin "Minor upgrade for PostGIS ${PGIS} on ${db}"
767 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
768 -f "${postgis_path}/postgis_upgrade_${PGIS//.}_minor.sql"
769 retval=$?
770 [[ $retval == 0 ]] && eend 0 || safe_exit
771 done
772
773 # Clean up and make it so the user has to edit postgis_dbs again that
774 # way this script won't step on any toes due to user error.
775 unset PGPASSWORD
776 sed -e 's/\(configured\)/#\1/' -i "${EROOT%/}/etc/postgis_dbs"
777 einfo "PostgreSQL ${PGSLOT} is now PostGIS enabled."
778 einfo
779 einfo "To enable other databases, change the default slot:"
780 einfo " postgresql-config set <slot>"
781 einfo "Then, emerge this package again:"
782 einfo " emerge -av =${CATEGORY}/${PF}"
783 }
784
785
786
787 1.1 dev-db/postgis/postgis-1.4.2-r2.ebuild
788
789 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-1.4.2-r2.ebuild?rev=1.1&view=markup
790 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgis/postgis-1.4.2-r2.ebuild?rev=1.1&content-type=text/plain
791
792 Index: postgis-1.4.2-r2.ebuild
793 ===================================================================
794 # Copyright 1999-2013 Gentoo Foundation
795 # Distributed under the terms of the GNU General Public License v2
796 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.4.2-r2.ebuild,v 1.1 2013/01/30 14:46:58 titanofold Exp $
797
798 EAPI="4"
799
800 inherit eutils versionator
801
802 DESCRIPTION="Geographic Objects for PostgreSQL"
803 HOMEPAGE="http://postgis.net"
804 SRC_URI="http://download.osgeo.org/postgis/source/${P}.tar.gz"
805 LICENSE="GPL-2"
806 SLOT="0"
807 KEYWORDS="~amd64 ~ppc ~x86"
808 IUSE="doc gtk"
809
810 RDEPEND="
811 || (
812 dev-db/postgresql-server:8.4
813 dev-db/postgresql-server:8.3
814 dev-db/postgresql-server:8.2
815 )
816 >=sci-libs/geos-3.1
817 >=sci-libs/proj-4.5.0
818 gtk? ( x11-libs/gtk+:2 )
819 "
820
821 DEPEND="${RDEPEND}
822 doc? (
823 app-text/docbook-xsl-stylesheets
824 app-text/docbook-xml-dtd:4.3
825 dev-libs/libxslt
826 || (
827 media-gfx/imagemagick[png]
828 media-gfx/graphicsmagick[imagemagick,png]
829 )
830 )
831 "
832
833 RESTRICT="test"
834
835 PGIS="$(get_version_component_range 1-2)"
836
837 # not parallel safe
838 MAKEOPTS+=" -j1"
839
840 pkg_setup() {
841 export PGSLOT="$(postgresql-config show)"
842
843 if [[ ${PGSLOT//.} < 82 || ${PGSLOT//.} > 84 ]] ; then
844 eerror "You must build ${CATEGORY}/${P} against PostgreSQL 8.2 - 8.4."
845 eerror "Set an appropriate slot with postgresql-config."
846 die 'Select a PostgreSQL slot between 8.2 and 8.4'
847 fi
848 }
849
850 src_configure() {
851 # Configure interprets --without-gui as being the same as --with-gui
852 local myargs=""
853 use gtk && myargs+=" --with-gui"
854 econf \
855 ${myargs}
856 }
857
858 src_compile() {
859 # Occasionally, builds fail because of out of order compilation.
860 # Otherwise, it'd be fine.
861 emake
862 cd topology/
863 emake
864
865 if use doc ; then
866 cd "${S}/doc/"
867 emake
868 fi
869 }
870
871 src_install() {
872 emake DESTDIR="${D}" install
873 cd topology/
874 emake DESTDIR="${D}" install
875
876 cd "${S}"
877 dodoc CREDITS TODO loader/README.* doc/*txt
878
879 docinto topology
880 dodoc topology/{TODO,README}
881 dobin ./utils/postgis_restore.pl
882
883 if use doc; then
884 cd doc/html
885 dohtml -r *
886 fi
887
888 insinto /usr/share/postgresql-${PGSLOT}/contrib/postgis-${PGIS}/
889 doins postgis_comments.sql
890
891 insinto /etc
892 doins "${FILESDIR}/postgis_dbs-${PGIS}"
893
894 cd "${S}/doc"
895 doman man/*
896 }
897
898 pkg_postinst() {
899 postgresql-config update
900
901 elog "To finish installing or updating PostGIS edit:"
902 elog " ${EROOT%/}/etc/postgis_dbs"
903 elog
904 elog "Then, run:"
905 elog " emerge --config =${CATEGORY}/${PF}"
906 }
907
908 pkg_config(){
909 source "${EROOT%/}/etc/conf.d/postgresql-${PGSLOT}"
910 source "${EROOT%/}/etc/postgis_dbs-${PGIS}"
911 local postgis_path="${EROOT%/}/usr/share/postgresql-${PGSLOT}/contrib/postgis-${PGIS}"
912
913 if [[ -n ${configured} ]] ; then
914 einfon "Password for PostgreSQL user '${pguser}': "
915 read -s PGPASSWORD
916 export PGPASSWORD
917 echo
918 else
919 eerror "You must edit:"
920 eerror " ${EROOT%/}/etc/postgis_dbs"
921 eerror "Before running 'emerge --config =${CATEGORY}/${PF}'"
922 eerror
923 die "Edit postgis_dbs"
924 fi
925
926 # The server we work with must be the same slot we built against.
927 local server_version
928 server_version=$(psql -U ${pguser} -d postgres -p ${PGPORT} \
929 -Aqwtc 'SELECT version()' 2> /dev/null)
930 if [[ $? = 0 ]] ; then
931 server_version=$(echo ${server_version} | cut -d " " -f 2 | \
932 cut -d "." -f -2 | tr -d .)
933 if [[ $server_version != ${PGSLOT//.} ]] ; then
934 unset PGPASSWORD
935 eerror "Server version must be ${PGSLOT}.x"
936 die "Server version isn't ${PGSLOT}.x"
937 fi
938 else
939 unset PGPASSWORD
940 eerror "Is the server running?"
941 die "Couldn't connect to server."
942 fi
943
944 local retval
945 safe_exit() {
946 unset PGPASSWORD
947 sed -e 's/\(configured\)/#\1/' -i "${EROOT%/}/etc/postgis_dbs"
948 eend $retval
949 eerror "All actions could not be performed."
950 eerror "Read above to see what failed."
951 eerror "Once you fix the issue, you'll need to edit:"
952 eerror " ${EROOT%/}/etc/postgis_dbs"
953 eerror "As some things may have succeeded."
954 eerror
955 die "All actions could not be performed"
956 }
957
958 local db
959 for db in ${databases[@]} ; do
960 ebegin "Performing CREATE LANGUAGE on ${db}"
961 createlang -U ${pguser} -p ${PGPORT} plpgsql ${db}
962 retval=$?
963 # In this case, only error code 1 is fatal
964 [[ $retval == 1 ]] && safe_exit || eend 0
965
966 ebegin "Enabling PostGIS on ${db}"
967 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
968 -f "${postgis_path}/postgis.sql"
969 retval=$?
970 [[ $retval == 0 ]] && eend 0 || safe_exit
971 done
972
973 for db in ${templates[@]} ; do
974 ebegin "Creating template database '${db}'"
975 createdb -p ${PGPORT} -U ${pguser} -O ${pguser} -T ${from_template} \
976 ${db} "PostGIS Template"
977 retval=$?
978 [[ $retval != 0 ]] && safe_exit
979
980 psql -q -U ${pguser} -p ${PGPORT} -c \
981 "UPDATE pg_database \
982 SET datistemplate = TRUE, datallowconn = TRUE \
983 WHERE datname = '${db}'"
984 retval=$?
985 [[ $retval != 0 ]] && safe_exit
986
987 createlang -U ${pguser} -p ${PGPORT} plpgsql ${db}
988 retval=$?
989 # In this case, only error code 1 is fatal
990 [[ $retval == 1 ]] && safe_exit
991
992 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
993 -f "${postgis_path}/postgis.sql"
994 retval=$?
995 [[ $retval == 0 ]] && eend 0 || safe_exit
996 done
997
998 for db in ${epsg_databases[@]} ; do
999 ebegin "Adding EPSG to ${db}"
1000 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
1001 -f "${postgis_path}/spatial_ref_sys.sql"
1002 retval=$?
1003 [[ $retval == 0 ]] && eend 0 || safe_exit
1004 done
1005
1006 for db in ${comment_databases[@]} ; do
1007 ebegin "Adding comments on ${db}"
1008 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
1009 -f "${postgis_path}/postgis_comments.sql"
1010 retval=$?
1011 [[ $retval == 0 ]] && eend 0 || safe_exit
1012 done
1013
1014 for db in ${upgrade_from_1_2[@]} ; do
1015 ebegin "Upgrading from PostGIS 1.2 to ${PGIS} on ${db}"
1016 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
1017 -f "${postgis_path}/postgis_upgrade_12_to_${PGIS//.}.sql"
1018 retval=$?
1019 [[ $retval == 0 ]] && eend 0 || safe_exit
1020 done
1021
1022 for db in ${upgrade_from_1_3[@]} ; do
1023 ebegin "Upgrading from PostGIS 1.3 to ${PGIS} on ${db}"
1024 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
1025 -f "${postgis_path}/postgis_upgrade_13_to_${PGIS//.}.sql"
1026 retval=$?
1027 [[ $retval == 0 ]] && eend 0 || safe_exit
1028 done
1029
1030 for db in ${upgrade_from_1_4[@]} ; do
1031 ebegin "Minor upgrade for PostGIS ${PGIS} on ${db}"
1032 psql -q -U ${pguser} -p ${PGPORT} -d ${db} \
1033 -f "${postgis_path}/postgis_upgrade_${PGIS//.}_minor.sql"
1034 retval=$?
1035 [[ $retval == 0 ]] && eend 0 || safe_exit
1036 done
1037
1038 # Clean up and make it so the user has to edit postgis_dbs again that
1039 # way this script won't step on any toes due to user error.
1040 unset PGPASSWORD
1041 sed -e 's/\(configured\)/#\1/' -i "${EROOT%/}/etc/postgis_dbs"
1042 einfo "PostgreSQL ${PGSLOT} is now PostGIS enabled."
1043 einfo
1044 einfo "To enable other databases, change the default slot:"
1045 einfo " postgresql-config set <slot>"
1046 einfo "Then, emerge this package again:"
1047 einfo " emerge -av =${CATEGORY}/${PF}"
1048 }