[csw-devel] SF.net SVN: opencsw:[377] gar-wrapper

skayser at users.sourceforge.net skayser at users.sourceforge.net
Tue Jul 5 23:29:13 CEST 2011


Revision: 377
          http://opencsw.svn.sourceforge.net/opencsw/?rev=377&view=rev
Author:   skayser
Date:     2011-07-05 21:29:13 +0000 (Tue, 05 Jul 2011)

Log Message:
-----------
mgar: make init deal with relative paths

Modified Paths:
--------------
    gar-wrapper/CHANGES
    gar-wrapper/mgar

Modified: gar-wrapper/CHANGES
===================================================================
--- gar-wrapper/CHANGES	2011-07-05 20:41:12 UTC (rev 376)
+++ gar-wrapper/CHANGES	2011-07-05 21:29:13 UTC (rev 377)
@@ -6,6 +6,7 @@
 * commit: automatically commits parent directory when needed (new packages)
 * find-file: exclude .git directories
 * find-file: default to list all files if no argument given
+* init: fix bug when calling with a relative path (Oliver Kiddle)
 * show-buildsys: fall back to "unknown" when GAR is not in subversion
 * ~/.garrc: add variable OVERRIDE_BUILDSYS to globally override the
   path to GAR. Can be used to test new GAR branches

Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar	2011-07-05 20:41:12 UTC (rev 376)
+++ gar-wrapper/mgar	2011-07-05 21:29:13 UTC (rev 377)
@@ -190,6 +190,19 @@
   return 0
 }
 
+function get_absolute_dirname {
+  ( cd `dirname "$1"` && pwd -P )
+}
+
+function register_buildtree {
+  local __buildtree="$1"
+
+  # Make sure to register an absolute path in ~/.garrc
+  # Make sure to prepend a newline in case ~/.garrc doesn't end with \n
+  local __buildtree_absolute=`get_absolute_dirname "$__buildtree"`
+  echo -e "\nBUILDTREE=$__buildtree_absolute" >> ~/.garrc
+}
+
 # Undocumented function to ease the migration of existing local build trees
 # for existing GAR (non-mgar) users. Not intended to stay here forever.
 function convert_existing_buildtree {
@@ -211,8 +224,8 @@
     -name work -prune -o -name cookies -prune -o \
     -type s -name gar | grep /gar$ | gxargs -r rm
 
-  echo "Registering $__buildtree/.buildsys in ~/.garrc"
-  echo -e "\nBUILDTREE=$__buildtree" >> ~/.garrc
+  echo "Registering $__buildtree in ~/.garrc"
+  register_buildtree "$__buildtree"
 
   echo
   echo 'All set. Basically, use mgar instead of gmake now (see mgar --help).'
@@ -234,9 +247,7 @@
   echo
   echo "Initialized the package build tree at $__buildtree."
   echo "Registering the package build tree location in ~/.garrc"
-  # this is just in case .garrc doesn't end with a newline.
-  echo >> ~/.garrc
-  echo BUILDTREE="$__buildtree" >> ~/.garrc
+  register_buildtree "$__buildtree"
   echo
   echo 'Now you can fetch the package build descriptions via: "mgar up --all"'
   echo 'Please be advised that this will take some time. So grab yourself a cup'


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list