[GRASS-SVN] r57573 - in grass/branches/releasebranch_6_4/scripts: v.convert.all v.db.addtable v.db.reconnect.all v.db.renamecol v.db.update

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 31 23:46:04 PDT 2013


Author: hamish
Date: 2013-08-31 23:46:04 -0700 (Sat, 31 Aug 2013)
New Revision: 57573

Modified:
   grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all
   grass/branches/releasebranch_6_4/scripts/v.db.addtable/v.db.addtable
   grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all
   grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol
   grass/branches/releasebranch_6_4/scripts/v.db.update/v.db.update
Log:
better handle spaces in GISDBASE (#1683), rm some unused vars (merge r55220,r55194,r55222,r55196,r55203 from devbr6)

Modified: grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all	2013-09-01 06:33:55 UTC (rev 57572)
+++ grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all	2013-09-01 06:46:04 UTC (rev 57573)
@@ -34,10 +34,9 @@
 fi
 
 
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
+MAPSET=`g.gisenv get=MAPSET`
 
+
 CONVERTEDMAPS=0
 for i in `g.mlist type=oldvect`
 do

Modified: grass/branches/releasebranch_6_4/scripts/v.db.addtable/v.db.addtable
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.addtable/v.db.addtable	2013-09-01 06:33:55 UTC (rev 57572)
+++ grass/branches/releasebranch_6_4/scripts/v.db.addtable/v.db.addtable	2013-09-01 06:46:04 UTC (rev 57573)
@@ -52,7 +52,7 @@
 
 if  [ -z "$GISBASE" ] ; then
     echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
+    exit 1
 fi
 
 # save command line
@@ -79,10 +79,17 @@
 export LC_NUMERIC
 
 ### setup enviro vars ###
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
+MAPSET=`g.gisenv get=MAPSET`
+LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
+GISDBASE=`g.gisenv get=GISDBASE`
+# the following line simply complains if any of these vars are unset.
+#  It could be removed, as `` will at least set to "", but is left
+#  here for historical-instructive purposes
+: ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
+
 LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
+
 # does map exist in CURRENT mapset?
 eval `g.findfile element=vector file="$GIS_OPT_MAP" mapset="$MAPSET"`
 MAP_MAPSET=`echo "$GIS_OPT_MAP" | grep '@' | cut -f2 -d'@'`

Modified: grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all	2013-09-01 06:33:55 UTC (rev 57572)
+++ grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all	2013-09-01 06:46:04 UTC (rev 57573)
@@ -47,14 +47,11 @@
     exit 1
 fi
 
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
-
 if [ "$1" != "@ARGS_PARSED@" ] ; then
    exec g.parser "$0" "$@"
 fi
 
+
 OLD_DATABASE="$GIS_OPT_OLD_DATABASE"
 NEW_DATABASE="$GIS_OPT_NEW_DATABASE"
 OLD_SCHEMA="$GIS_OPT_OLD_SCHEMA"
@@ -70,10 +67,13 @@
   exit 1
 fi
 
+
+MAPSET=`g.gisenv get=MAPSET`
+
 for VECT in `g.list type=vect mapset="$MAPSET" | sed 1,2d | grep -v '^-*$'`
 do
-    g.message message="Reconnecting vector '${VECT}@${MAPSET}'"
-    for LINK in `v.db.connect -g fs="|" map=${VECT}@${MAPSET}` ; do
+    g.message message="Reconnecting vector <$VECT> in mapset <$MAPSET>"
+    for LINK in `v.db.connect -g fs="|" map="$VECT@$MAPSET"` ; do
         eval `echo "$LINK" | sed 's$\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)$LAYER=\1 SCHEMA_TABLE=\2 KEY=\3 DATABASE=\4 DRIVER=\5$'`
 
         SCHEMA=`echo "$SCHEMA_TABLE" | grep '\.' | sed 's/\([^.]*\)\..*/\1/'`

Modified: grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol	2013-09-01 06:33:55 UTC (rev 57572)
+++ grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol	2013-09-01 06:46:04 UTC (rev 57573)
@@ -80,8 +80,8 @@
 }
 
 ### setup enviro vars ###
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
+MAPSET=`g.gisenv get=MAPSET`
+
 # does map exist in CURRENT mapset?
 eval `g.findfile element=vector file="$GIS_OPT_MAP" mapset="$MAPSET"`
 if [ ! "$file" ] ; then

Modified: grass/branches/releasebranch_6_4/scripts/v.db.update/v.db.update
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.update/v.db.update	2013-09-01 06:33:55 UTC (rev 57572)
+++ grass/branches/releasebranch_6_4/scripts/v.db.update/v.db.update	2013-09-01 06:46:04 UTC (rev 57573)
@@ -77,25 +77,16 @@
     exec g.parser "$0" "$@"
 fi
 
-PROG=`basename "$0"`
-
-#### check if we have awk
-if [ ! -x "`which awk`" ] ; then
-    g.message -e "awk required, please install awk or gawk first"
-    exit 1
-fi
-
 # setting environment, so that awk works properly in all languages
 unset LC_ALL
 LC_NUMERIC=C
 export LC_NUMERIC
 
 ### setup enviro vars ###
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
+MAPSET=`g.gisenv get=MAPSET`
 
 # does map exist in CURRENT mapset?
-eval `g.findfile element=vector file=$GIS_OPT_MAP mapset=$MAPSET`
+eval `g.findfile element=vector file="$GIS_OPT_MAP" mapset="$MAPSET"`
 if [ ! "$file" ] ; then
    g.message -e "Vector map '$GIS_OPT_MAP' not found in current mapset"
    exit 1



More information about the grass-commit mailing list