diff options
author | gdt <gdt> | 2006-10-03 12:53:44 +0000 |
---|---|---|
committer | gdt <gdt> | 2006-10-03 12:53:44 +0000 |
commit | 2cf717fd018629584efd0e389dfe82f9cdb75fb6 (patch) | |
tree | b2d77cd74899618f6a4d8fd77f799a03fc1baba2 /geography/epsg | |
parent | c713baf62ddb30c5422f27a405e5fabb3e078eda (diff) | |
download | pkgsrc-2cf717fd018629584efd0e389dfe82f9cdb75fb6.tar.gz |
Packaging update from Brook Milligan:
change DIST_SUBDIR to be based on date
add helper script to load data into a database
PKGREVISION++
Diffstat (limited to 'geography/epsg')
-rw-r--r-- | geography/epsg/MESSAGE | 22 | ||||
-rw-r--r-- | geography/epsg/Makefile | 19 | ||||
-rw-r--r-- | geography/epsg/PLIST | 4 | ||||
-rw-r--r-- | geography/epsg/distinfo | 26 | ||||
-rw-r--r-- | geography/epsg/files/epsg.sh | 112 |
5 files changed, 149 insertions, 34 deletions
diff --git a/geography/epsg/MESSAGE b/geography/epsg/MESSAGE index ab84ab26a52..312b160e048 100644 --- a/geography/epsg/MESSAGE +++ b/geography/epsg/MESSAGE @@ -1,24 +1,12 @@ =========================================================================== -$NetBSD: MESSAGE,v 1.1.1.1 2006/08/16 14:37:21 gdt Exp $ +$NetBSD: MESSAGE,v 1.2 2006/10/03 12:53:44 gdt Exp $ -You need to install the EPSG data into a relational database. The -data files are installed in ${EPSGDIR}. Suitable commands -are (assuming ${EPSGDB} refers to the target database). - -For PostgreSQL: - cd ${EPSGDIR} - psql -f EPSG_v6_11.mdb_Tables_PostgreSQL.sql ${EPSGDB} - psql -f EPSG_v6_11.mdb_Data_PostgreSQL.sql ${EPSGDB} - psql -f EPSG_v6_11.mdb_FKeys_PostgreSQL.sql ${EPSGDB} - -For MySQL: - cd ${EPSGDIR} - mysql -f EPSG_v6_11.mdb_Tables_MySQL.sql ${EPSGDB} - mysql -f EPSG_v6_11.mdb_Data_MySQL.sql ${EPSGDB} - mysql -f EPSG_v6_11.mdb_FKeys_MySQL.sql ${EPSGDB} +Before the EPSG data can be used, it must be installed into a +relational database. The data files are installed in ${EPSGDIR}. For +an example script that will install the data, see ${EGDIR}/epsg. See the following two documents, which are located in ${DOCDIR}, -for a complete description. +for a complete description of the dataset. Using the EPSG Geodetic Parameter Dataset (Surveying and Positioning Guidance Note Number 7, part 1) diff --git a/geography/epsg/Makefile b/geography/epsg/Makefile index 20f928dc027..7066ed41bac 100644 --- a/geography/epsg/Makefile +++ b/geography/epsg/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.2 2006/08/23 18:29:53 wiz Exp $ +# $NetBSD: Makefile,v 1.3 2006/10/03 12:53:44 gdt Exp $ # DISTNAME= epsg-v6_11sql-PostgreSQL PKGNAME= epsg-6.11 +PKGREVISION= 1 CATEGORIES= geography databases MASTER_SITES+= http://www.epsg.org/databases/ DISTFILES+= epsg-v6_11sql-PostgreSQL.zip \ @@ -10,7 +11,7 @@ DISTFILES+= epsg-v6_11sql-PostgreSQL.zip \ G7-1.pdf G7-2.pdf EXTRACT_ONLY= epsg-v6_11sql-PostgreSQL.zip \ epsg-v6_11sql-mySQL.zip -DIST_SUBDIR= epsg-6.11 +DIST_SUBDIR= epsg-20060823 MAINTAINER= brook@nmsu.edu HOMEPAGE= http://www.epsg.org/ @@ -31,9 +32,11 @@ WRKSRC.mysql= ${WRKDIR}/epsg-v6_11sql-mySQL NO_BUILD= yes DOCDIR= ${PREFIX}/share/doc/epsg +EGDIR= ${PREFIX}/share/examples/epsg EPSGDIR= ${PREFIX}/share/epsg MESSAGE_SUBST+= DOCDIR=${DOCDIR:Q} +MESSAGE_SUBST+= EGDIR=${EGDIR:Q} MESSAGE_SUBST+= EPSGDIR=${EPSGDIR:Q} DATAFILES.pgsql+= EPSG_v6_11.mdb_Data_PostgreSQL.sql @@ -44,16 +47,26 @@ DATAFILES.mysql+= EPSG_v6_11.mdb_Data_MySQL.sql DATAFILES.mysql+= EPSG_v6_11.mdb_FKeys_MySQL.sql DATAFILES.mysql+= EPSG_v6_11.mdb_Tables_MySQL.sql +SUBST_CLASSES+= epsg +SUBST_STAGE.epsg= configure +SUBST_FILES.epsg= epsg.sh +SUBST_SED.epsg= -e "s:$$[{]PREFIX[}]:${PREFIX:Q}:" +SUBST_SED.epsg+= -e "s:$$[{]EPSGDIR[}]:${EPSGDIR:Q}:" +SUBST_MESSAGE.epsg= Fixing EPSG example script + post-extract: ${CP} ${_DISTDIR}/G7-1.pdf ${WRKSRC} ${CP} ${_DISTDIR}/G7-2.pdf ${WRKSRC} + ${CP} ${FILESDIR}/epsg.sh ${WRKSRC} do-install: - ${INSTALL_DATA_DIR} ${EPSGDIR} ${INSTALL_DATA_DIR} ${DOCDIR} + ${INSTALL_DATA_DIR} ${EGDIR} + ${INSTALL_DATA_DIR} ${EPSGDIR} ${INSTALL_DATA} ${WRKSRC}/G7-1.pdf ${DOCDIR:Q} ${INSTALL_DATA} ${WRKSRC}/G7-2.pdf ${DOCDIR:Q} ${INSTALL_DATA} ${WRKSRC}/epsg-v6_11-readme.pdf ${DOCDIR:Q} + ${INSTALL_SCRIPT} ${WRKSRC}/epsg.sh ${EGDIR}/epsg .for d in pgsql mysql .for f in ${DATAFILES.${d}} ${INSTALL_DATA} ${WRKSRC.${d}}/${f} ${EPSGDIR:Q}/${f} diff --git a/geography/epsg/PLIST b/geography/epsg/PLIST index aa24f5b3207..094989a2293 100644 --- a/geography/epsg/PLIST +++ b/geography/epsg/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.1.1.1 2006/08/16 14:37:21 gdt Exp $ +@comment $NetBSD: PLIST,v 1.2 2006/10/03 12:53:44 gdt Exp $ share/doc/epsg/G7-1.pdf share/doc/epsg/G7-2.pdf share/doc/epsg/epsg-v6_11-readme.pdf @@ -8,5 +8,7 @@ share/epsg/EPSG_v6_11.mdb_FKeys_MySQL.sql share/epsg/EPSG_v6_11.mdb_FKeys_PostgreSQL.sql share/epsg/EPSG_v6_11.mdb_Tables_MySQL.sql share/epsg/EPSG_v6_11.mdb_Tables_PostgreSQL.sql +share/examples/epsg/epsg +@dirrm share/examples/epsg @dirrm share/epsg @dirrm share/doc/epsg diff --git a/geography/epsg/distinfo b/geography/epsg/distinfo index a963da482c1..fcc06b238e5 100644 --- a/geography/epsg/distinfo +++ b/geography/epsg/distinfo @@ -1,14 +1,14 @@ -$NetBSD: distinfo,v 1.1.1.1 2006/08/16 14:37:21 gdt Exp $ +$NetBSD: distinfo,v 1.2 2006/10/03 12:53:44 gdt Exp $ -SHA1 (epsg-6.11/epsg-v6_11sql-PostgreSQL.zip) = 4c3733da69b9ca59ba76483f656cea8333428df1 -RMD160 (epsg-6.11/epsg-v6_11sql-PostgreSQL.zip) = 1359739ebb2bfce4ed09be38c93a80ae5f51cca5 -Size (epsg-6.11/epsg-v6_11sql-PostgreSQL.zip) = 1082987 bytes -SHA1 (epsg-6.11/epsg-v6_11sql-mySQL.zip) = 9aea90ac8d7c0e9715735625fd57f4754dbbdabe -RMD160 (epsg-6.11/epsg-v6_11sql-mySQL.zip) = 4247d8c7b0d10a2fa67c60b1a46483c64b5d9b5b -Size (epsg-6.11/epsg-v6_11sql-mySQL.zip) = 1083069 bytes -SHA1 (epsg-6.11/G7-1.pdf) = fdf31f6d4fe534011e62a1498d8b054bb1fd1025 -RMD160 (epsg-6.11/G7-1.pdf) = f331d158d241b128a2b9e1d2a63c06c0f6ae855c -Size (epsg-6.11/G7-1.pdf) = 831907 bytes -SHA1 (epsg-6.11/G7-2.pdf) = 3fcd4d6d9f028716a27ea4f40b43e9c3f016cb32 -RMD160 (epsg-6.11/G7-2.pdf) = 06620849762a5b1419487850272fa7fe809d849f -Size (epsg-6.11/G7-2.pdf) = 954725 bytes +SHA1 (epsg-20060823/epsg-v6_11sql-PostgreSQL.zip) = 4c3733da69b9ca59ba76483f656cea8333428df1 +RMD160 (epsg-20060823/epsg-v6_11sql-PostgreSQL.zip) = 1359739ebb2bfce4ed09be38c93a80ae5f51cca5 +Size (epsg-20060823/epsg-v6_11sql-PostgreSQL.zip) = 1082987 bytes +SHA1 (epsg-20060823/epsg-v6_11sql-mySQL.zip) = 9aea90ac8d7c0e9715735625fd57f4754dbbdabe +RMD160 (epsg-20060823/epsg-v6_11sql-mySQL.zip) = 4247d8c7b0d10a2fa67c60b1a46483c64b5d9b5b +Size (epsg-20060823/epsg-v6_11sql-mySQL.zip) = 1083069 bytes +SHA1 (epsg-20060823/G7-1.pdf) = fdf31f6d4fe534011e62a1498d8b054bb1fd1025 +RMD160 (epsg-20060823/G7-1.pdf) = f331d158d241b128a2b9e1d2a63c06c0f6ae855c +Size (epsg-20060823/G7-1.pdf) = 831907 bytes +SHA1 (epsg-20060823/G7-2.pdf) = f3d7e1fe7cdf6029736dfcec478f6ad9056ff425 +RMD160 (epsg-20060823/G7-2.pdf) = bf684d8782f1dd729ddd246c4f7384615690ebdc +Size (epsg-20060823/G7-2.pdf) = 952449 bytes diff --git a/geography/epsg/files/epsg.sh b/geography/epsg/files/epsg.sh new file mode 100644 index 00000000000..66a891093a8 --- /dev/null +++ b/geography/epsg/files/epsg.sh @@ -0,0 +1,112 @@ +#!/bin/sh +# $NetBSD: epsg.sh,v 1.1 2006/10/03 12:53:44 gdt Exp $ + +# epsg - import EPSG data into a relational database + +# Copyright (c) 2006 Brook Milligan <brook@nmsu.edu> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +HOST= +PORT= +DB=epsg +USERNAME=$USER + +HELP=0 +USE_PGSQL=0 +USE_MYSQL=0 + +SRCDIR=${EPSGDIR} + +PSQL=${PREFIX}/bin/psql +MYSQL=${PREFIX}/bin/mysql + +while [ $# -gt 0 ]; do + case $1 in + --help) HELP=1;; + --dbname) DB=$2; shift;; + --host) HOST=$2; shift;; + --mysql) USE_MYSQL=1;; + --port) PORT=$2; shift;; + --pgsql) USE_PGSQL=1;; + --srcdir) SRCDIR=$2; shift;; + --username) USERNAME=$2; shift;; + *) HELP=1; echo "epsg: unrecognized option: $1";; + esac + shift; +done + +if [ $HELP -eq 1 ]; then + echo "epsg -- load the EPSG dataset into a database" + echo "usage: epsg [options]" + echo "options:" + echo " --help [ print a help message ]" + echo " --pgsql [ connect to a PostgreSQL database ]" + echo " --mysql [ connect to a mySQL database ]" + echo " --host hostname [ connect to a specific host ]" + echo " --port port [ connect to a specific port ]" + echo " --dbname database [ connect to a specific database ]" + echo " --username user [ connect as user ]" + exit 1 +fi + +echo "epsg - importing EPSG data ..." +if [ "$HOST" != "" ]; then + echo " host: $HOST" + PSQL_FLAGS="$PSQL_FLAGS --host $HOST" + MYSQL_FLAGS="$MYSQL_FLAGS --host=$HOST" +fi +if [ "$PORT" != "" ]; then + echo " port: $PORT" + PSQL_FLAGS="$PSQL_FLAGS --port $PORT" + MYSQL_FLAGS="$MYSQL_FLAGS --port=$PORT" +fi +if [ "$DB" != "" ]; then + echo " database: $DB" + PSQL_FLAGS="$PSQL_FLAGS --dbname $DB" + MYSQL_FLAGS="$MYSQL_FLAGS --database=$DB" +fi +if [ "$USERNAME" != "" ]; then + echo " username: $USERNAME" + PSQL_FLAGS="$PSQL_FLAGS --username $USERNAME" + MYSQL_FLAGS="$MYSQL_FLAGS --user=$USERNAME" +fi + +if [ $USE_PGSQL -eq 1 ]; then + echo "importing into a PostgreSQL database ..." + $PSQL -f $SRCDIR/EPSG_v6_11.mdb_Tables_PostgreSQL.sql $PSQL_FLAGS + $PSQL -f $SRCDIR/EPSG_v6_11.mdb_Data_PostgreSQL.sql $PSQL_FLAGS + $PSQL -f $SRCDIR/EPSG_v6_11.mdb_FKeys_PostgreSQL.sql $PSQL_FLAGS +fi + +if [ $USE_MYSQL -eq 1 ]; then + echo "importing into a mySQL database ..." + $MYSQL $MYSQL_FLAGS < $SRCDIR/EPSG_v6_11.mdb_Tables_MySQL.sql + $MYSQL $MYSQL_FLAGS < $SRCDIR/EPSG_v6_11.mdb_Data_MySQL.sql + $MYSQL $MYSQL_FLAGS < $SRCDIR/EPSG_v6_11.mdb_FKeys_MySQL.sql +fi |