[csw-devel] SF.net SVN: opencsw:[328] gar-wrapper/mgar

skayser at users.sourceforge.net skayser at users.sourceforge.net
Thu Feb 24 01:04:54 CET 2011


Revision: 328
          http://opencsw.svn.sourceforge.net/opencsw/?rev=328&view=rev
Author:   skayser
Date:     2011-02-24 00:04:53 +0000 (Thu, 24 Feb 2011)

Log Message:
-----------
mgar: add undocumented init-existing command

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

Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar	2011-02-23 23:36:00 UTC (rev 327)
+++ gar-wrapper/mgar	2011-02-24 00:04:53 UTC (rev 328)
@@ -51,7 +51,7 @@
 GAR_REPO=https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/
 PKG_REPO=https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/
 
-REQ_TOOLS="gfind ggrep gmake mknmz namazu svn"
+REQ_TOOLS="gfind ggrep gmake gxargs mknmz namazu svn"
 REQ_PKGS="findutils ggrep gmake namazu svn"
 
 function assert_required_tools {
@@ -161,14 +161,32 @@
   return 0
 }
 
-# WIP stub for re-using an existing GAR tree instead of checking out a full one
+# 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 {
   __buildtree="$1"
-  echo "Checking for and removing obsolete gar links from the package build tree."
+
+  [ -f $__buildtree/Makefile ] || {
+    echo "$__buildtree doesn't look like a package build tree." >&2
+    echo "Top level Makefile expected, but none found. Please make" >&2
+    echo "sure to specify the root of all package build descriptions." >&2
+    exit 2
+  }
+  
+  echo "Checking out GAR to $__buildtree/.buildsys"
+  svn co $GAR_REPO "$__buildtree/.buildsys"
+
+  echo
+  echo "Removing gar symlinks from $__buildtree (takes some time)"
   find $__buildtree \
     -name work -prune -o -name cookies -prune -o \
-    -type s -name gar | grep /gar$ | xargs rm
-  #if [ "$1" == "--use-existing" ]; then { shift; __fullco=0; } || { shift; __fullco=1; }
+    -type s -name gar | grep /gar$ | gxargs -r rm
+
+  echo "Registering $__buildtree/.buildsys in ~/.garrc"
+  echo -e "\nBUILDTREE=$__buildtree" >> ~/.garrc
+
+  echo
+  echo 'All set. Basically, use mgar instead of gmake now (see mgar --help).'
 }
 
 function init_buildtree {
@@ -180,7 +198,7 @@
   fi
 
   echo "Initializing the package build tree at $__buildtree"
-  mkdir -p $__buildtree/.buildsys
+  mkdir -p "$__buildtree/.buildsys"
   svn co $GAR_REPO "$__buildtree/.buildsys"
   svn co --depth empty $PKG_REPO "$__buildtree"
 
@@ -355,6 +373,7 @@
 assert_required_tools
 
 [ $1 == "init" ] && { init_buildtree ${2-$DEF_BUILDTREE}; exit; }
+[ $1 == "init-existing" ] && { convert_existing_buildtree ${2}; exit; }
 
 BUILDTREE="`read_config_value BUILDTREE`"; eval BUILDTREE="$BUILDTREE"
 assert_multi_buildsys_tree "$BUILDTREE/.buildsys"


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