diff options
author | Gérald Fenoy <djay@gentoo.org> | 2007-01-06 19:41:27 +0000 |
---|---|---|
committer | Gérald Fenoy <djay@gentoo.org> | 2007-01-06 19:41:27 +0000 |
commit | 52f7ed95182732317f5289e283d0b628d768abf7 (patch) | |
tree | ee5ab103900f6adff2e27bfd8c2f340cab9694d2 /dev-db | |
parent | Initial commit (diff) | |
download | historical-52f7ed95182732317f5289e283d0b628d768abf7.tar.gz historical-52f7ed95182732317f5289e283d0b628d768abf7.tar.bz2 historical-52f7ed95182732317f5289e283d0b628d768abf7.zip |
adding postgis 1.1.6 and 1.2.0 versions.
Package-Manager: portage-2.1.1-r2
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/postgis/ChangeLog | 12 | ||||
-rw-r--r-- | dev-db/postgis/Manifest | 40 | ||||
-rw-r--r-- | dev-db/postgis/files/digest-postgis-1.1.6 | 3 | ||||
-rw-r--r-- | dev-db/postgis/files/digest-postgis-1.2.0 | 3 | ||||
-rw-r--r-- | dev-db/postgis/metadata.xml | 1 | ||||
-rw-r--r-- | dev-db/postgis/postgis-1.1.4.ebuild | 4 | ||||
-rw-r--r-- | dev-db/postgis/postgis-1.1.6.ebuild | 190 | ||||
-rw-r--r-- | dev-db/postgis/postgis-1.2.0.ebuild | 190 |
8 files changed, 427 insertions, 16 deletions
diff --git a/dev-db/postgis/ChangeLog b/dev-db/postgis/ChangeLog index e919e42ba99b..583178f1f981 100644 --- a/dev-db/postgis/ChangeLog +++ b/dev-db/postgis/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for dev-db/postgis -# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.25 2006/12/17 16:13:34 dertobi123 Exp $ +# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.26 2007/01/06 19:41:27 djay Exp $ + +*postgis-1.2.0 (06 Jan 2007) +*postgis-1.1.6 (06 Jan 2007) + + 06 Jan 2007; <djay@gentoo.org> metadata.xml, +postgis-1.1.6.ebuild, + +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 <dertobi123@gentoo.org> postgis-1.1.4.ebuild: diff --git a/dev-db/postgis/Manifest b/dev-db/postgis/Manifest index 3c3e15d789b5..d68e16ab893d 100644 --- a/dev-db/postgis/Manifest +++ b/dev-db/postgis/Manifest @@ -5,6 +5,8 @@ SHA256 4c0b50b26bc22e09d60ac14ad4639880e1fca7c92eb55929d6dc10c0ec4ce691 files/po DIST postgis-0.7.5.tar.gz 336368 RMD160 c45d2e797b358dc0bf81aa2bc70d153bceae7029 SHA1 7b3417790010dd3ce8bbcfc21ccab772107c3527 SHA256 51a9dc56b34b7325aaeb5ca3540d6ce1ae830bf7ce601a827126fb6028452afb DIST postgis-1.1.2.tar.gz 1547680 RMD160 0536e91dc65d3ea8ead7e788f0b0fa1ee81f295a SHA1 e9162c06cee6125011d85dcf37b4a29e78e7e45c SHA256 5d63b1875e6dd8610001ad89d97351eaaf1c3205fc6ec57365e2bb9f6b990fb5 DIST postgis-1.1.4.tar.gz 1853989 RMD160 8441aba816154ebe743a93334df9df43a15fa87e SHA1 96afd988aeabb92efa0a99b25cc77be29c700dde SHA256 8f7c74c34431120364d623d0d7ef2556ae6c9bb153b9621eb93ebf56a5396018 +DIST postgis-1.1.6.tar.gz 2039011 RMD160 414b7d03e1b14f7e46dabc32484ec25b4dc42916 SHA1 b13c36e50e30c572298cb8631bc83e5318d24bcc SHA256 18923e610e23e4c5fe706b5d52ff3d44fbddac9876775d36917268d32d7d1580 +DIST postgis-1.2.0.tar.gz 2077747 RMD160 4f2ce71ffd49649cd5712a8bc1a6b822d968797a SHA1 b6e33324c4c2dddc925e7bac86fb1f9c635f20a6 SHA256 7d8f5782ddca38199a1630765e4a2b6d7d703af0cc28d04685cbc6156177d9cb DIST postgresql-7.3.6.tar.gz 11288430 RMD160 66dc806f0eab410059b9233d62b0744fd8b6192b SHA1 5135ed429a22f8290eece18d67a459716a80871a SHA256 ecfbbdd16c0ace4ae1d10997765cfefc49092d01f9198846ad58a79bd06e23e0 EBUILD postgis-0.7.5-r2.ebuild 1819 RMD160 c88a1807587b16c24e4816da2e756680a379551f SHA1 1b9bb8126c1c73ddb265abd2ec02bfc9998be9f1 SHA256 3e91e8fbe26403397d883009717cf2cb59e17f507351e1446007f9cd2887a092 MD5 566f2c9cd28601b48aed55459bb49689 postgis-0.7.5-r2.ebuild 1819 @@ -14,18 +16,26 @@ EBUILD postgis-1.1.2.ebuild 2722 RMD160 d974bf1b2ed0c23748f42f68dfb0928092cc10e9 MD5 1a5f5dbae554e5e59505490e4a222b7f postgis-1.1.2.ebuild 2722 RMD160 d974bf1b2ed0c23748f42f68dfb0928092cc10e9 postgis-1.1.2.ebuild 2722 SHA256 85b4391834041a4a92c99cad5e52e397c6b113252a5e035deaabf971052f618d postgis-1.1.2.ebuild 2722 -EBUILD postgis-1.1.4.ebuild 2679 RMD160 30c7e3f5e417a9d96dbb7a887b9fa70003079bc0 SHA1 a2676673b38af2d32afadd958ee82d2b1482fbe9 SHA256 04a2f5a00860bdb7b1b9bf94b7608f49b3d2270454481fa16a77a006fd7fcd17 -MD5 a9b81160bfa1f3aeb44c7b88b7da14d3 postgis-1.1.4.ebuild 2679 -RMD160 30c7e3f5e417a9d96dbb7a887b9fa70003079bc0 postgis-1.1.4.ebuild 2679 -SHA256 04a2f5a00860bdb7b1b9bf94b7608f49b3d2270454481fa16a77a006fd7fcd17 postgis-1.1.4.ebuild 2679 -MISC ChangeLog 2922 RMD160 eb044c08a13dbfe1789e3d7b72d01d5589e49311 SHA1 fc91c7c83f32727646caca77e4e4daeca6dccfdf SHA256 bfa267e29c3c001e90b015d166fa57c24598219e99b16b3bdd15d5ebc9f48ad9 -MD5 4a74f58754d9ed4fa29f36b84e33ecb8 ChangeLog 2922 -RMD160 eb044c08a13dbfe1789e3d7b72d01d5589e49311 ChangeLog 2922 -SHA256 bfa267e29c3c001e90b015d166fa57c24598219e99b16b3bdd15d5ebc9f48ad9 ChangeLog 2922 -MISC metadata.xml 164 RMD160 becfe652663bd65719dd11fa6ffb588b3d5b4ecc SHA1 f67b7ac1c5e6e65ef5a19a589d4759c84918f86c SHA256 7e8e8126bc8701c4a42c7dfed8bb755ac6040fe3d0e3f994d888f8b2b4fa7d8b -MD5 6fe52df942ef15801d56449cd8299604 metadata.xml 164 -RMD160 becfe652663bd65719dd11fa6ffb588b3d5b4ecc metadata.xml 164 -SHA256 7e8e8126bc8701c4a42c7dfed8bb755ac6040fe3d0e3f994d888f8b2b4fa7d8b metadata.xml 164 +EBUILD postgis-1.1.4.ebuild 2673 RMD160 b6ce2679497231931e4f3ca1d5d60e5db63805ae SHA1 a5203055b41fabb4610a6137a98dd50e6dc134ff SHA256 19e71582fa0a997e44ff594b8bcef5818884ad3e48c512673e486ccce3f76523 +MD5 228658ca0a66b4490f83fedcdc5beee8 postgis-1.1.4.ebuild 2673 +RMD160 b6ce2679497231931e4f3ca1d5d60e5db63805ae postgis-1.1.4.ebuild 2673 +SHA256 19e71582fa0a997e44ff594b8bcef5818884ad3e48c512673e486ccce3f76523 postgis-1.1.4.ebuild 2673 +EBUILD postgis-1.1.6.ebuild 5403 RMD160 ea72e7d3a376b72905ba7ffe67847f1f7f37a738 SHA1 95f74d680958805e3e97062b082508e678a90ee6 SHA256 9901ef3ee424170f0d9f7ad211e137f73be738b6d7dea3110dcbac731669ae64 +MD5 301a39dda34db2cfe9f234bf38fa8665 postgis-1.1.6.ebuild 5403 +RMD160 ea72e7d3a376b72905ba7ffe67847f1f7f37a738 postgis-1.1.6.ebuild 5403 +SHA256 9901ef3ee424170f0d9f7ad211e137f73be738b6d7dea3110dcbac731669ae64 postgis-1.1.6.ebuild 5403 +EBUILD postgis-1.2.0.ebuild 5403 RMD160 d7852fd2c5ece0d0d0d40ffde47d27e8b689525a SHA1 983752a378fe8489b1e1a83b261d97ff2f5ec719 SHA256 bcfdba95541ea5445fd360a5e4bce4c05c9c9bc47b976335ed788bfa76fac6b9 +MD5 6afc337e2ce0802618c713061e65b216 postgis-1.2.0.ebuild 5403 +RMD160 d7852fd2c5ece0d0d0d40ffde47d27e8b689525a postgis-1.2.0.ebuild 5403 +SHA256 bcfdba95541ea5445fd360a5e4bce4c05c9c9bc47b976335ed788bfa76fac6b9 postgis-1.2.0.ebuild 5403 +MISC ChangeLog 3165 RMD160 efee1877a548ca149ab6e43d95732335d4532850 SHA1 242e2606866e1778d4b2194e42bd99dc53cb4803 SHA256 6e615199238b1c71ce561a1b193173c954de60ad0b93473d818c7655c778b227 +MD5 68cde65cdbe40ec0d313aa38083b9f2c ChangeLog 3165 +RMD160 efee1877a548ca149ab6e43d95732335d4532850 ChangeLog 3165 +SHA256 6e615199238b1c71ce561a1b193173c954de60ad0b93473d818c7655c778b227 ChangeLog 3165 +MISC metadata.xml 194 RMD160 19177cc0060792a4212a48493143cc82f0302ef8 SHA1 4acac2c575abc8f6bfe00506117dc2f83a8355a2 SHA256 58a43dec1240568210b57a8396a5d317593309353f64e474c93d12a39a7bc071 +MD5 b37bf0bf48388c9f32b981c5bb00468e metadata.xml 194 +RMD160 19177cc0060792a4212a48493143cc82f0302ef8 metadata.xml 194 +SHA256 58a43dec1240568210b57a8396a5d317593309353f64e474c93d12a39a7bc071 metadata.xml 194 MD5 2db1c5915dbd7611af6934a26d3a6013 files/digest-postgis-0.7.5-r2 497 RMD160 0d0124fc5429a511155d66725f8c6e1e305575cf files/digest-postgis-0.7.5-r2 497 SHA256 dd81ed8116cf975c877b3911f0a4a5c9798261abbf5299e92d71cd1a9e59dc52 files/digest-postgis-0.7.5-r2 497 @@ -35,3 +45,9 @@ SHA256 c81dd0e4008794ce0b9f9add53e8c74935f65acce6b9a1dbe9474678aefb9c28 files/di MD5 fe40aee1dd66bf3f650789430be3c26c files/digest-postgis-1.1.4 244 RMD160 77a1bd4aa3c4ef4aeb58e19229f44a2290e5797c files/digest-postgis-1.1.4 244 SHA256 ab448b547354b8a5cf4e1eb12d643d1dd8c0427c932f35a8f5ad5c5e64f97b10 files/digest-postgis-1.1.4 244 +MD5 ab3e538298261e4c8cc0a91e21c816ed files/digest-postgis-1.1.6 244 +RMD160 bac03daea0f1472df5670c176e2a007ed7d5bdd4 files/digest-postgis-1.1.6 244 +SHA256 67a2f2ae2598a277edc25fd27e836439d1bad0dd19ed978458c55ab82bfded04 files/digest-postgis-1.1.6 244 +MD5 eb0637aa1fc2a780e1ec9ed54d0d6a2f files/digest-postgis-1.2.0 244 +RMD160 390369df28592de2364eed68ada3d0f67b2fcc82 files/digest-postgis-1.2.0 244 +SHA256 c9bcac468877fd1a90215723d8c00fd69caee2286b631b04ff6e798ee20c639c files/digest-postgis-1.2.0 244 diff --git a/dev-db/postgis/files/digest-postgis-1.1.6 b/dev-db/postgis/files/digest-postgis-1.1.6 new file mode 100644 index 000000000000..cb168c1fd524 --- /dev/null +++ b/dev-db/postgis/files/digest-postgis-1.1.6 @@ -0,0 +1,3 @@ +MD5 d9df1ea49df747607e7ed9fdccf728cb postgis-1.1.6.tar.gz 2039011 +RMD160 414b7d03e1b14f7e46dabc32484ec25b4dc42916 postgis-1.1.6.tar.gz 2039011 +SHA256 18923e610e23e4c5fe706b5d52ff3d44fbddac9876775d36917268d32d7d1580 postgis-1.1.6.tar.gz 2039011 diff --git a/dev-db/postgis/files/digest-postgis-1.2.0 b/dev-db/postgis/files/digest-postgis-1.2.0 new file mode 100644 index 000000000000..5f141e8b96e5 --- /dev/null +++ b/dev-db/postgis/files/digest-postgis-1.2.0 @@ -0,0 +1,3 @@ +MD5 59b5f89d0a0230b00d80e779bb517520 postgis-1.2.0.tar.gz 2077747 +RMD160 4f2ce71ffd49649cd5712a8bc1a6b822d968797a postgis-1.2.0.tar.gz 2077747 +SHA256 7d8f5782ddca38199a1630765e4a2b6d7d703af0cc28d04685cbc6156177d9cb postgis-1.2.0.tar.gz 2077747 diff --git a/dev-db/postgis/metadata.xml b/dev-db/postgis/metadata.xml index d06e452b35af..bbcdf2bec405 100644 --- a/dev-db/postgis/metadata.xml +++ b/dev-db/postgis/metadata.xml @@ -2,4 +2,5 @@ <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <herd>postgresql</herd> + <herd>sci-geosciences</herd> </pkgmetadata> diff --git a/dev-db/postgis/postgis-1.1.4.ebuild b/dev-db/postgis/postgis-1.1.4.ebuild index 64a3ecacefa6..43a6f712498f 100644 --- a/dev-db/postgis/postgis-1.1.4.ebuild +++ b/dev-db/postgis/postgis-1.1.4.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2007 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.3 2006/12/17 16:13:34 dertobi123 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.1.4.ebuild,v 1.4 2007/01/06 19:41:27 djay Exp $ inherit autotools eutils diff --git a/dev-db/postgis/postgis-1.1.6.ebuild b/dev-db/postgis/postgis-1.1.6.ebuild new file mode 100644 index 000000000000..c9e8b48d89a0 --- /dev/null +++ b/dev-db/postgis/postgis-1.1.6.ebuild @@ -0,0 +1,190 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.1.6.ebuild,v 1.1 2007/01/06 19:41:27 djay Exp $ + +WANT_AUTOCONF="lastest" +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=">=dev-db/postgresql-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(){ + 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 +} diff --git a/dev-db/postgis/postgis-1.2.0.ebuild b/dev-db/postgis/postgis-1.2.0.ebuild new file mode 100644 index 000000000000..fbcdc72b3023 --- /dev/null +++ b/dev-db/postgis/postgis-1.2.0.ebuild @@ -0,0 +1,190 @@ +# Copyright 1999-2007 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.1 2007/01/06 19:41:27 djay Exp $ + +WANT_AUTOCONF="lastest" +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=">=dev-db/postgresql-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(){ + 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 +} |