Portage is a package management system used by Gentoo Linux
# ChangeLog for dev-db/postgis
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.35 2008/05/21 15:57:24 dev-zero Exp $
21 May 2008; Tiziano Müller
postgis-1.2.0.ebuild, postgis-1.2.1.ebuild, postgis-1.3.1.ebuild,
postgis-1.3.3.ebuild:
Changed dependency for postgresql from dev-db/postgresql to
virtual/postgresql-server
09 May 2008;
Version 1.3.3 bumped
25 Feb 2008; Caleb Tennis
marking amd64 stable
19 Jan 2008; nixnut
Stable on ppc wrt bug 206529
18 Jan 2008; Dawid Węgliński
Stable on x86 (bug #206529)
*postgis-1.3.1 (19 Dec 2007)
*postgis-1.2.1 (19 Dec 2007)
19 Dec 2007;
+postgis-1.3.1.ebuild:
Version bump for 1.2.1 and 1.3.1 version of the PostGIS ebuild
19 Sep 2007; Denis Dupeyron
Fixed typo, see bug #193013.
11 Apr 2007; Luca Longinotti
Fix bug #167271.
09 Apr 2007; Luca Longinotti
-postgis-1.1.2.ebuild, -postgis-1.1.6.ebuild, postgis-1.2.0.ebuild:
Cleanup old unneeded versions, fixes bug #17808.
*postgis-1.2.0 (06 Jan 2007)
*postgis-1.1.6 (06 Jan 2007)
06 Jan 2007;
+postgis-1.2.0.ebuild:
Adding postgis-1.1.6 and postgis-1.2.0 ebuilds. Special thanks to
dev-zero for his help.
17 Dec 2006; Tobias Scherbaum
postgis-1.1.4.ebuild:
Stable on ppc wrt bug #157750.
14 Dec 2006; Christian Faulhammer
stable x86, bug #157750
30 Sep 2006; Tiziano Müller
Version bump.
01 Aug 2006; Luca Longinotti
postgis-0.7.5-r2.ebuild, -postgis-1.0.0_p20050512.ebuild,
-postgis-1.0.1_p20050805.ebuild, -postgis-1.1.1.ebuild:
Cleanup.
*postgis-1.1.2 (06 Apr 2006)
06 Apr 2006; Gérald Fenoy djay@gentoo.org +postgis-1.1.2.ebuild:
Version Bump to 1.1.2
*postgis-1.1.1 (20 Mar 2006)
20 Mar 2006; Masatomo Nakano
+files/postgis-1.1.1_doc.patch, +postgis-1.1.1.ebuild:
Version bump. Ebuild submitted by FENOY Gérald
*postgis-1.0.1_p20050805 (27 Aug 2005)
27 Aug 2005; Masatomo Nakano
+postgis-1.0.1_p20050805.ebuild:
Version bump.
*postgis-1.0.0_p20050512 (14 May 2005)
14 May 2005; Masatomo Nakano
+postgis-1.0.0_p20050512.ebuild:
Version bump.
06 May 2005; Sven Wegener
Removed * postfix from <, <=, >= and > dependencies.
28 Dec 2004; Olivier Fisette
postgis-0.7.5-r2.ebuild:
Dependency update: dev-libs/proj -> sci-libs/proj.
17 Jun 2004; Masatomo Nakano
Marked as stable on x86.
04 May 2004; David Holm
Added to ~ppc.
*postgis-0.7.5-r2 (03 May 2004)
03 May 2004; Masatomo Nakano
Fixed dependency.
20 Apr 2004; Martin Holzer
src_uri now uses mirror://postgresql
21 Mar 2004; Martin Holzer
adding categorie. see 45110 for details
07 Dec 2003; Masatomo Nakano
Clean up.
*postgis-0.7.5-r1 (30 Sep 2003)
30 Sep 2003; Masatomo Nakano
Fixed library path and changed dependency to postgresql-7.3.4. #29226
*postgis-0.7.5.ebuild (12 Jun 2003)
29 Sep 2003; Daniel Ahlberg
Added IUSE.
12 Jun 2003; Daniel Ahlberg
Version bump.
*postgis-0.7.3.ebuild (16 Dec 2002)
16 Dec 2002; George Shapovalov
initial release
adds support for geographic objects to PostgreSQL
ebuild submitted by Nathaniel C. Domingo
AUX postgis-1.1.1_doc.patch 711 RMD160 182a5127d83b18b48c5b013b63427d485f770e36 SHA1 00ad7282712c851fc38c852a8d21a70c5ab2b969 SHA256 4c0b50b26bc22e09d60ac14ad4639880e1fca7c92eb55929d6dc10c0ec4ce691
AUX postgis_xsl.patch 1058 RMD160 052a9578b27edbded5f7885de5efa3595b4c7ac1 SHA1 23e73c1f5eec58e781ba110d04d12bef4093bcee SHA256 ed309baa8aa7e9f10f1006c954f75aa9a4898c820ae46b76d5389c618fb7c08d
DIST postgis-1.1.4.tar.gz 1853989 RMD160 8441aba816154ebe743a93334df9df43a15fa87e SHA1 96afd988aeabb92efa0a99b25cc77be29c700dde SHA256 8f7c74c34431120364d623d0d7ef2556ae6c9bb153b9621eb93ebf56a5396018
DIST postgis-1.2.0.tar.gz 2077747 RMD160 4f2ce71ffd49649cd5712a8bc1a6b822d968797a SHA1 b6e33324c4c2dddc925e7bac86fb1f9c635f20a6 SHA256 7d8f5782ddca38199a1630765e4a2b6d7d703af0cc28d04685cbc6156177d9cb
DIST postgis-1.2.1.tar.gz 2084672 RMD160 b5f8c542a143d460ebc1387a0d9e4b69335e73c3 SHA1 0a47bde414bf691fb624ead37cc119687aba14df SHA256 edb57786b78bf89b72f60607cb38fa10da00354c2c4476c09bb3d88ca3c0d61f
DIST postgis-1.3.1.tar.gz 2148125 RMD160 f199505dc04bd2caa0400c9235bbf1aecfe14b6f SHA1 db8e954dfc19e73c2331358a396e2064d1333a72 SHA256 5ce999ae638c1c9f75a7cf85d416eac71cc2d6f668132c2b6a3ae6a12075555c
DIST postgis-1.3.3.tar.gz 2089526 RMD160 4e7d59672486a990f760e7cff2deb49a1332d7cc SHA1 12b0da709360f67340f88774b70cf3bac65fcc24 SHA256 2a3ffb4ffbde3b4e87b99ef5351efa837d60b84ecb34d40c0dcab8e776d15440
EBUILD postgis-1.1.4.ebuild 2693 RMD160 ecc850b462b45a710191f44fb13ef4a99f945d0d SHA1 d2be8d5ab0c0542cd4de97b7d750041c80087b2b SHA256 6f4b485c1e238fec52382f6e3923a7a10fe7aac9091aba5047171a0a0611cf59
EBUILD postgis-1.2.0.ebuild 5382 RMD160 04c06f7a0e97320635961a21a0c033f5674a4902 SHA1 de013cb188f392aa22bf71da7933d147ef81bc48 SHA256 73b08604bb50fb21de97cd5119a7941d69086e7acd35b77bfd3b83bac5d228f0
EBUILD postgis-1.2.1.ebuild 5578 RMD160 79bfdbf4ad691a6008e4634444a2e0399e613abb SHA1 c5052ef14917ae0952f169dede8208f9f4402359 SHA256 98e6c86c049f98b9f7c9c9d1aead141766b2bb9964aaef7cdc6b0be4e3c6834c
EBUILD postgis-1.3.1.ebuild 5296 RMD160 2d914033ff735de68713b63ee43e9a416c1ec34b SHA1 80f13540493f2e39887aba004f75dc42c56e66d4 SHA256 73d427679c58899ad0316601d7f37c1393a11b7da124409d540c4ee58cdf1136
EBUILD postgis-1.3.3.ebuild 5299 RMD160 73032561e267d73a1360de3276e0175018ec67a3 SHA1 1a2a49450717f7572db3a516dadbf5a7e4900193 SHA256 3304d9e552f6a8cbf707c90cef5266e387c7e6e56289c6b951c2f96d0548b53f
MISC ChangeLog 4390 RMD160 5e6ab5f48de576e3bae65881ccd166aa341f2b4a SHA1 466e841a39b3e2f15cc720433082fc9b5407c4c5 SHA256 3f055a57bd5969ce91fbfccdb0f5123d419b35272aae73c32082e0cd90b748f2
MISC metadata.xml 194 RMD160 19177cc0060792a4212a48493143cc82f0302ef8 SHA1 4acac2c575abc8f6bfe00506117dc2f83a8355a2 SHA256 58a43dec1240568210b57a8396a5d317593309353f64e474c93d12a39a7bc071
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.1.4.ebuild,v 1.5 2008/05/21 15:57:24 dev-zero Exp $
inherit autotools eutils
KEYWORDS="~amd64 ppc x86"
DESCRIPTION="Geographic Objects for PostgreSQL"
HOMEPAGE="http://postgis.refractions.net"
SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
IUSE="geos proj"
DEPEND=">=virtual/postgresql-server-7.4
app-text/docbook-xsl-stylesheets
geos? ( sci-libs/geos )
proj? ( sci-libs/proj )
sys-devel/autoconf"
RDEPEND=">=virtual/postgresql-server-7.4
geos? ( sci-libs/geos )
proj? ( sci-libs/proj )"
RESTRICT="test"
pkg_setup(){
tmp="$(portageq match / ${CATEGORY}/${PN})"
if [ "${tmp}" != "${CATEGORY}/${PF}" ]; then
ewarn "Don't forget to dump your databases with -Fc options before"
ewarn "upgrading postgis."
ewarn "(see http://postgis.refractions.net/docs/ch02.html#upgrading)"
ebeep 4
fi
}
src_unpack(){
unpack ${A}
cd "${S}"
epatch "${FILESDIR}/${PN}-1.1.1_doc.patch"
local xslv
xslv="$(ls /usr/share/sgml/docbook/ | grep xsl\-)"
einfo "doc will be build with template :"
einfo "${xslv}"
sed "s:xsl-stylesheets:${xslv}:" -i configure.in || die "xsl-stylesheets pb"
eautoconf
}
src_compile(){
cd "${S}"
econf \
--enable-autoconf \
--datadir=/usr/share/postgresql/contrib/ \
--libdir=/usr/$(get_libdir)/postgresql/ \
--with-docdir=/usr/share/doc/${PF}/html/ \
$(use_with geos) \
$(use_with proj)\
|| die "Error: econf failed"
emake || die "Error: emake failed"
emake docs || die "Unable to build documentation"
cd topology/
emake || die "Unable to build topology sql file"
}
src_install(){
cd "${S}"
dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
emake DESTDIR="${D}" install || die "emake install failed"
cd "${S}/topology/"
emake DESTDIR="${D}" install || die "emake install topology failed"
cd "${S}"
dodoc CHANGES CREDITS README.postgis TODO loader/README.* \
doc/*txt
docinto topology
dodoc topology/{TODO,README}
cd "${S}"
emake DESTDIR="${D}" docs-install || die "emake install docs failed"
dobin ./utils/postgis_restore.pl
}
pkg_postinst() {
einfo "To create your first postgis database use the following commands :"
einfo " # su postgres"
einfo " # createdb test"
einfo " # createlang plpgsql test"
einfo " # psql -d test -f /usr/share/postgresql/contrib/lwpostgis.sql"
einfo " # psql -d test -f /usr/share/postgresql/contrib/spatial_ref_sys.sql"
einfo "For more informations see : http://www.postgis.org/documentation.php"
einfo "(For french user only see http://postgis.fr)"
}
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.2.0.ebuild,v 1.6 2008/05/21 15:57:24 dev-zero Exp $
inherit autotools eutils versionator
KEYWORDS="~amd64 ~ppc ~x86"
DESCRIPTION="Geographic Objects for PostgreSQL"
HOMEPAGE="http://postgis.refractions.net"
SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
IUSE="geos proj doc"
RDEPEND=">=virtual/postgresql-server-7.4
geos? ( sci-libs/geos )
proj? ( sci-libs/proj )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xsl-stylesheets )"
RESTRICT="test"
pkg_setup(){
local tmp
tmp="$(portageq match / postgis | cut -d'.' -f2)"
if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
elog "You must soft upgrade your existing postgis enabled databases"
elog "using 'emerge --config postgis'."
require_soft_upgrade="1"
ebeep 2
fi
}
src_unpack(){
unpack ${A}
cd "${S}"
epatch "${FILESDIR}/${PN}_xsl.patch"
eautoconf
}
src_compile(){
local myconf
if use geos; then
myconf="--with-geos"
fi
if use doc;then
myconf="${myconf} --with-xsl=$(ls /usr/share/sgml/docbook/* | \
grep xsl\- | cut -d':' -f1)"
fi
econf --enable-autoconf \
--datadir=/usr/share/postgresql/contrib/ \
--libdir=/usr/$(get_libdir)/postgresql/ \
--with-docdir=/usr/share/doc/${PF}/html/ \
${myconf} \
$(use_with proj) ||\
die "Error: econf failed"
emake || die "Error: emake failed"
cd topology/
emake || die "Unable to build topology sql file"
if use doc ; then
cd "${S}"
emake docs || die "Unable to build documentation"
fi
}
src_install(){
dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
emake DESTDIR="${D}" install || die "emake install failed"
cd "${S}/topology/"
emake DESTDIR="${D}" install || die "emake install topology failed"
cd "${S}"
dodoc Changelog CREDITS TODO loader/README.* doc/*txt
docinto topology
dodoc topology/{TODO,README}
dobin ./utils/postgis_restore.pl
cd "${S}"
if use doc; then
emake DESTDIR="${D}" docs-install || die "emake install docs failed"
fi
if [ ! -z "${require_soft_upgrade}" ]; then
grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql |\
grep -v "'sql'" > \
"${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
fi
}
pkg_postinst() {
elog "To create new spatial database use 'emerge --config ${PN}.'"
}
pkg_config(){
myuser="${PG_USER:-postgres}"
mydb="${PGDATABASE:-template_gis}"
is_template=false
if [ "${mydb:0:8}" == "template" ];then
is_template=true
mytype="template database"
else
mytype="database"
fi
einfo "Create or upgrade a spatial template and database."
einfo "Using the user ${myuser} and the ${mydb} ${mytype}."
einfo "Please do 'export PG_USER=...' to use another user."
einfo "Please do 'export PGDATABASE=...' to set another template/database"
einfo "name (templates name have to be prefixed with 'template')."
logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
safe_exit(){
eerror "Removing created ${mydb} ${mytype}"
dropdb -q -U "${myuser}" "${mydb}" ||\
(eerror "${1}"
die "Removing old db failed, you must do it manually")
eerror "Please read ${logfile} for more information."
die "${1}"
}
# if there is not a table or a template existing with the same name, create.
if [ -z "$(psql -U "${myuser}" -l | grep "${mydb}")" ]; then
einfo
einfo "Please hit ENTER if you want to create the ${mydb}"
einfo "${mytype} as "${myuser}" user, or Control-C to abort now..."
read
createdb -q -O ${myuser} -U ${myuser} ${mydb} ||\
die "Unable to create the ${mydb} ${mytype} as ${myuser}"
createlang -U ${myuser} plpgsql ${mydb}
if [ "$?" == 2 ]; then
safe_exit "Unable to createlang plpgsql ${mydb}."
fi
(psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to load sql files."
fi
if ${is_template}; then
psql -q -U ${myuser} ${mydb} -c \
"UPDATE pg_database SET datistemplate = TRUE
WHERE datname = '${mydb}';
GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;
VACUUM FREEZE;" || die "Unable to create ${mydb}"
fi
else
einfo
einfo "Please hit ENTER if you want to upgrade the ${mydb}"
einfo "${mytype} as ${myuser} user, or Control-C to abort now..."
read
if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
then
einfo "Updating the dynamic library references"
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
2> "${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to update references."
fi
fi
if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
then
einfo "Running soft upgrade"
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to run soft upgrade."
fi
fi
fi
if ${is_template}; then
einfo "You can now create a spatial database using :"
einfo "'createdb -T ${mydb} test'"
fi
}
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.2.1.ebuild,v 1.2 2008/05/21 15:57:24 dev-zero Exp $
inherit autotools eutils versionator
KEYWORDS="~x86 ~ppc ~amd64"
DESCRIPTION="Geographic Objects for PostgreSQL"
HOMEPAGE="http://postgis.refractions.net"
SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
IUSE="geos proj doc"
RDEPEND=">=virtual/postgresql-server-7.4
geos? ( sci-libs/geos )
proj? ( sci-libs/proj )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xsl-stylesheets )"
RESTRICT="test"
pkg_setup(){
local tmp
tmp="$(portageq match / postgis | cut -d'.' -f2)"
if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
elog "You must soft upgrade your existing postgis enabled databases"
elog "using 'emerge --config postgis'."
require_soft_upgrade="1"
ebeep 2
fi
}
src_unpack(){
unpack ${A}
cd "${S}"
epatch "${FILESDIR}/${PN}_xsl.patch"
eautoconf
}
src_compile(){
local myconf
if use geos; then
myconf="--with-geos"
fi
if use doc;then
myconf="${myconf} --with-xsl=$(ls "${ROOT}"usr/share/sgml/docbook/* | \
grep xsl\- | cut -d':' -f1)"
fi
econf --enable-autoconf \
--datadir=/usr/share/postgresql/contrib/ \
--libdir=/usr/$(get_libdir)/postgresql/ \
--with-docdir=/usr/share/doc/${PF}/html/ \
${myconf} \
$(use_with proj) ||\
die "Error: econf failed"
emake || die "Error: emake failed"
cd topology/
emake || die "Unable to build topology sql file"
if use doc ; then
cd "${S}"
emake docs || die "Unable to build documentation"
fi
}
src_install(){
dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
emake DESTDIR="${D}" install || die "emake install failed"
cd "${S}/topology/"
emake DESTDIR="${D}" install || die "emake install topology failed"
cd "${S}"
dodoc Changelog CREDITS TODO loader/README.* doc/*txt
docinto topology
dodoc topology/{TODO,README}
dobin ./utils/postgis_restore.pl
cd "${S}"
if use doc; then
emake DESTDIR="${D}" docs-install || die "emake install docs failed"
fi
if [ ! -z "${require_soft_upgrade}" ]; then
grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql |\
grep -v "'sql'" > \
"${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
fi
}
pkg_postinst() {
elog "To create new spatial database use 'emerge --config ${PN}.'"
}
pkg_config(){
PGUSER="${PGUSER:-postgres}"
PGDATABASE="${PGDATABASE:-template_postgis}"
is_template=false
if [ "${PGDATABASE:0:8}" == "template" ];then
is_template=true
mytype="template database"
else
mytype="database"
fi
einfo "Create or upgrade a spatial template and database."
einfo "Using the user ${PGUSER} and the ${PGDATABASE} ${mytype}."
einfo "Please do 'export PGUSER=...' to use another user."
einfo "Please do 'export PGDATABASE=...' to set another template/database"
einfo "name (templates name have to be prefixed with 'template')."
logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
safe_exit(){
eerror "Removing created ${mydb} ${mytype}"
dropdb -q || (eerror "${1}"
die "Removing old db failed, you must do it manually")
eerror "Please see ${logfile} for more information."
die "${1}"
}
# if there is not a table or a template existing with the same name, create.
psql -ql 2> ${logfile}
if [ "$?" == 2 ];then
die "Unable to access databases server using the ${PGUSER} user"
fi
PGDBS="$(psql template1 -Atc \
'select 1 from pg_tables where tablename=${PGDATABASE};')"
if [ "$(psql -l | grep "${PGDATABASE}")" != 1 ]; then
einfo
einfo "Please hit ENTER if you want to create the ${PGDATABASE}"
einfo "${mytype} as "${PGUSER}" user, or Control-C to abort now..."
read
einfo "Creating the ${mytype} ${PGDATABASE}."
createdb -q -O ${PGUSER} ||\
die "Unable to create the ${mydb} ${mytype} as ${myuser}"
createlang plpgsql
if [ "$?" == 2 ]; then
safe_exit "${myuser} not allowed to createlang plpgsql ${mydb}."
fi
einfo "Loading PostGIS files into ${PGDATABASE}."
(psql -q -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
psql -q -f \
"${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to load the sql files."
fi
if ${is_template}; then
einfo "Configure ${PGDATABASE} as a ${mytype}"
psql -q -c \
"UPDATE pg_database SET datistemplate=TRUE, datallowconn=FALSE
WHERE datname = '${PGDATABASE}';
VACUUM FREEZE;" || die "Unable to create ${mydb}"
fi
else
einfo
einfo "Please hit ENTER if you want to upgrade the ${mydb}"
einfo "${mytype} as ${myuser} user, or Control-C to abort now..."
read
if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
then
einfo "Updating the dynamic library references"
psql -q -f \
"${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
2> "${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to update references."
fi
fi
if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
then
einfo "Running soft upgrade"
psql -q -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to run soft upgrade."
fi
fi
fi
if ${is_template}; then
einfo "You can now create a spatial database using :"
einfo "createdb -T ${PGDATABASE}
fi
}
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.3.1.ebuild,v 1.5 2008/05/21 15:57:24 dev-zero Exp $
inherit autotools eutils versionator
KEYWORDS="amd64 ppc x86"
DESCRIPTION="Geographic Objects for PostgreSQL"
HOMEPAGE="http://postgis.refractions.net"
SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
IUSE="geos proj doc"
RDEPEND=">=virtual/postgresql-server-7.4
geos? ( sci-libs/geos )
proj? ( sci-libs/proj )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xsl-stylesheets )"
RESTRICT="test"
pkg_setup(){
local tmp
tmp="$(portageq match / postgis | cut -d'.' -f2)"
if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
elog "You must soft upgrade your existing postgis enabled databases"
elog "using 'emerge --config postgis'."
require_soft_upgrade="1"
ebeep 2
fi
}
src_compile(){
local myconf
if use geos; then
myconf="--with-geos"
fi
if use doc;then
myconf="${myconf} --with-xsl=$(ls "${ROOT}"usr/share/sgml/docbook/* | \
grep xsl\- | cut -d':' -f1)"
fi
econf --enable-autoconf \
--datadir=/usr/share/postgresql/contrib/ \
--libdir=/usr/$(get_libdir)/postgresql/ \
--with-docdir=/usr/share/doc/${PF}/html/ \
${myconf} \
$(use_with proj) ||\
die "Error: econf failed"
emake || die "Error: emake failed"
cd topology/
emake || die "Unable to build topology sql file"
if use doc ; then
cd "${S}"
emake docs || die "Unable to build documentation"
fi
}
src_install(){
dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
emake DESTDIR="${D}" install || die "emake install failed"
cd "${S}/topology/"
emake DESTDIR="${D}" install || die "emake install topology failed"
cd "${S}"
dodoc Changelog CREDITS TODO loader/README.* doc/*txt
docinto topology
dodoc topology/{TODO,README}
dobin ./utils/postgis_restore.pl
cd "${S}"
if use doc; then
emake DESTDIR="${D}" docs-install || die "emake install docs failed"
fi
if [ ! -z "${require_soft_upgrade}" ]; then
grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql |\
grep -v "'sql'" > \
"${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
fi
}
pkg_postinst() {
elog "To create new spatial database use 'emerge --config ${PN}.'"
}
pkg_config(){
myuser="${PG_USER:-postgres}"
mydb="${PGDATABASE:-template_gis}"
is_template=false
if [ "${mydb:0:8}" == "template" ];then
is_template=true
mytype="template database"
else
mytype="database"
fi
einfo "Create or upgrade a spatial template and database."
einfo "Using the user ${myuser} and the ${mydb} ${mytype}."
einfo "Please do 'export PG_USER=...' to use another user."
einfo "Please do 'export PGDATABASE=...' to set another template/database"
einfo "name (templates name have to be prefixed with 'template')."
logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
safe_exit(){
eerror "Removing created ${mydb} ${mytype}"
dropdb -q -U "${myuser}" "${mydb}" ||\
(eerror "${1}"
die "Removing old db failed, you must do it manually")
eerror "Please read ${logfile} for more information."
die "${1}"
}
# if there is not a table or a template existing with the same name, create.
if [ -z "$(psql -U "${myuser}" -l | grep "${mydb}")" ]; then
einfo
einfo "Please hit ENTER if you want to create the ${mydb}"
einfo "${mytype} as "${myuser}" user, or Control-C to abort now..."
read
createdb -q -O ${myuser} -U ${myuser} ${mydb} ||\
die "Unable to create the ${mydb} ${mytype} as ${myuser}"
createlang -U ${myuser} plpgsql ${mydb}
if [ "$?" == 2 ]; then
safe_exit "Unable to createlang plpgsql ${mydb}."
fi
(psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to load sql files."
fi
if ${is_template}; then
psql -q -U ${myuser} ${mydb} -c \
"UPDATE pg_database SET datistemplate = TRUE
WHERE datname = '${mydb}';
GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;
VACUUM FREEZE;" || die "Unable to create ${mydb}"
fi
else
einfo
einfo "Please hit ENTER if you want to upgrade the ${mydb}"
einfo "${mytype} as ${myuser} user, or Control-C to abort now..."
read
if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
then
einfo "Updating the dynamic library references"
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
2> "${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to update references."
fi
fi
if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
then
einfo "Running soft upgrade"
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to run soft upgrade."
fi
fi
fi
if ${is_template}; then
einfo "You can now create a spatial database using :"
einfo "'createdb -T ${mydb} test'"
fi
}
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.3.3.ebuild,v 1.3 2008/05/21 15:57:24 dev-zero Exp $
inherit autotools eutils versionator
KEYWORDS="~amd64 ~ppc ~x86"
DESCRIPTION="Geographic Objects for PostgreSQL"
HOMEPAGE="http://postgis.refractions.net"
SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
IUSE="geos proj doc"
RDEPEND=">=virtual/postgresql-server-7.4
geos? ( sci-libs/geos )
proj? ( sci-libs/proj )"
DEPEND="${RDEPEND}
doc? ( app-text/docbook-xsl-stylesheets )"
RESTRICT="test"
pkg_setup(){
local tmp
tmp="$(portageq match / postgis | cut -d'.' -f2)"
if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
elog "You must soft upgrade your existing postgis enabled databases"
elog "using 'emerge --config postgis'."
require_soft_upgrade="1"
ebeep 2
fi
}
src_compile(){
local myconf
if use geos; then
myconf="--with-geos"
fi
if use doc;then
myconf="${myconf} --with-xsl=$(ls "${ROOT}"usr/share/sgml/docbook/* | \
grep xsl\- | cut -d':' -f1)"
fi
econf --enable-autoconf \
--datadir=/usr/share/postgresql/contrib/ \
--libdir=/usr/$(get_libdir)/postgresql/ \
--with-docdir=/usr/share/doc/${PF}/html/ \
${myconf} \
$(use_with proj) ||\
die "Error: econf failed"
emake || die "Error: emake failed"
cd topology/
emake || die "Unable to build topology sql file"
if use doc ; then
cd "${S}"
emake docs || die "Unable to build documentation"
fi
}
src_install(){
dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
emake DESTDIR="${D}" install || die "emake install failed"
cd "${S}/topology/"
emake DESTDIR="${D}" install || die "emake install topology failed"
cd "${S}"
dodoc Changelog CREDITS TODO loader/README.* doc/*txt
docinto topology
dodoc topology/{TODO,README}
dobin ./utils/postgis_restore.pl
cd "${S}"
if use doc; then
emake DESTDIR="${D}" docs-install || die "emake install docs failed"
fi
if [ ! -z "${require_soft_upgrade}" ]; then
grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql |\
grep -v "'sql'" > \
"${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
fi
}
pkg_postinst() {
elog "To create new spatial database use 'emerge --config ${PN}.'"
}
pkg_config(){
myuser="${PG_USER:-postgres}"
mydb="${PGDATABASE:-template_gis}"
is_template=false
if [ "${mydb:0:8}" == "template" ];then
is_template=true
mytype="template database"
else
mytype="database"
fi
einfo "Create or upgrade a spatial template and database."
einfo "Using the user ${myuser} and the ${mydb} ${mytype}."
einfo "Please do 'export PG_USER=...' to use another user."
einfo "Please do 'export PGDATABASE=...' to set another template/database"
einfo "name (templates name have to be prefixed with 'template')."
logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
safe_exit(){
eerror "Removing created ${mydb} ${mytype}"
dropdb -q -U "${myuser}" "${mydb}" ||\
(eerror "${1}"
die "Removing old db failed, you must do it manually")
eerror "Please read ${logfile} for more information."
die "${1}"
}
# if there is not a table or a template existing with the same name, create.
if [ -z "$(psql -U "${myuser}" -l | grep "${mydb}")" ]; then
einfo
einfo "Please hit ENTER if you want to create the ${mydb}"
einfo "${mytype} as "${myuser}" user, or Control-C to abort now..."
read
createdb -q -O ${myuser} -U ${myuser} ${mydb} ||\
die "Unable to create the ${mydb} ${mytype} as ${myuser}"
createlang -U ${myuser} plpgsql ${mydb}
if [ "$?" == 2 ]; then
safe_exit "Unable to createlang plpgsql ${mydb}."
fi
(psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to load sql files."
fi
if ${is_template}; then
psql -q -U ${myuser} ${mydb} -c \
"UPDATE pg_database SET datistemplate = TRUE
WHERE datname = '${mydb}';
GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;
VACUUM FREEZE;" || die "Unable to create ${mydb}"
fi
else
einfo
einfo "Please hit ENTER if you want to upgrade the ${mydb}"
einfo "${mytype} as ${myuser} user, or Control-C to abort now..."
read
if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
then
einfo "Updating the dynamic library references"
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
2> "${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to update references."
fi
fi
if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
then
einfo "Running soft upgrade"
psql -q -U ${myuser} ${mydb} -f \
"${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
"${logfile}"
if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
safe_exit "Unable to run soft upgrade."
fi
fi
fi
if ${is_template}; then
einfo "You can now create a spatial database using :"
einfo "'createdb -T ${mydb} test'"
fi
}