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

skayser at users.sourceforge.net skayser at users.sourceforge.net
Sat Sep 24 10:00:56 CEST 2011


Revision: 546
          http://opencsw.svn.sourceforge.net/opencsw/?rev=546&view=rev
Author:   skayser
Date:     2011-09-24 08:00:56 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
mgar: fix index file path encoding, add command reindex

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

Modified: gar-wrapper/CHANGES
===================================================================
--- gar-wrapper/CHANGES	2011-09-23 17:38:35 UTC (rev 545)
+++ gar-wrapper/CHANGES	2011-09-24 08:00:56 UTC (rev 546)
@@ -1,7 +1,9 @@
 Changes with 0.94-dev:
 * NEW command "status" to query VCS status (^= svn status)
+* NEW command "reindex" to drop and re-build the search index
 * DROP command "scm", typing "svn <sth>" is shorter than "mgar scm <sth>"
 * CHANGE "locate" command output now sorted
+* FIX "index" now properly encodes file paths with special signs (e.g. '+')
 
 Changes with 0.93 (r543):
 * NEW command "show-var" to show runtime value of recipe vars (Maciej Blizinski)

Modified: gar-wrapper/bash_completion.mgar
===================================================================
--- gar-wrapper/bash_completion.mgar	2011-09-23 17:38:35 UTC (rev 545)
+++ gar-wrapper/bash_completion.mgar	2011-09-24 08:00:56 UTC (rev 546)
@@ -21,7 +21,7 @@
   done
 
   misctgts="modenv ccenv"
-  mgarcmds="help init index locate up commit show-srcdir show-stagedir"
+  mgarcmds="help init index reindex locate up commit show-srcdir show-stagedir"
   mgarcmds="${mgarcmds} find-file edit-file show-buildsys show-pkgtree version"
   mgarcmds="${mgarcmds} list-categories newpkg show-var grep-buildsys status"
   ustreamcmds="check-upstream get-uwatch-configuration"

Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar	2011-09-23 17:38:35 UTC (rev 545)
+++ gar-wrapper/mgar	2011-09-24 08:00:56 UTC (rev 546)
@@ -422,24 +422,25 @@
 
 # Build the index for locating Makefiles within the package build tree
 function build_index() {
-  local __buildtree=$1
-  [ -d "$__buildtree/.index" ] || mkdir "$__buildtree/.index"
-  cd "$__buildtree" && mknmz \
-      -Ux \
+  local __buildtree="$1"
+  local __index="$2"
+  [ -d "${__index}" ] || mkdir "${__index}"
+  cd "${__buildtree}" && mknmz \
+      -x \
       --allow=Makefile \
       -F <( ls */*/Makefile */*/*/Makefile 2>/dev/null ) \
-      -O "$__buildtree/.index"
+      -O "${__index}"
 }
 
 # The underlying index engine doesn't have a concept of lines or fields, that's
 # why we do a keyword search first and then - if a specific search "field" was
 # requested - narrow down the result set with grep.
 function search_index() {
-  local __buildtree=${1-}
+  local __index="${1-}"
   local __term="$2"
   local __searchby=""
 
-  [ -d "$__buildtree/.index" ] || \
+  [ -d "${__index}" ] || \
     { echo "Index not found, create it with: mgar index" >&2; exit 2; }
 
   case "$__term" in
@@ -450,7 +451,7 @@
       *)                      __searchby="(CATALOG|PACKAGES|NAME)";;
   esac
 
-  namazu -slr "*$__term*" $__buildtree/.index | while read f; do
+  namazu -slr "*$__term*" "{__index}" | while read f; do
     if [ -z "$__searchby" ]; then
       echo $f;
     else
@@ -599,9 +600,10 @@
 case $1 in
 
 # global-cmds
-            index) build_index "$BUILDTREE";;
-           locate) shift; search_index "$BUILDTREE" "${1-}";;
+            index) build_index "$BUILDTREE" "$BUILDTREE/.index";;
+           locate) shift; search_index "$BUILDTREE/.index" "${1-}";;
            newpkg) shift; cd "$BUILDTREE" && newpkg ${1:-} ${2:-};;
+          reindex) rm -rf "$BUILDTREE/.index"; $0 index;;
      show-pkgtree) echo "$BUILDTREE";;
            status) svn status;;
                up) if [ "${2:-}" == "--all" ]; then

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