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

skayser at users.sourceforge.net skayser at users.sourceforge.net
Sat Sep 24 16:04:00 CEST 2011


Revision: 550
          http://opencsw.svn.sourceforge.net/opencsw/?rev=550&view=rev
Author:   skayser
Date:     2011-09-24 14:04:00 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
mgar: add automatic index build and update for locate command

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

Modified: gar-wrapper/CHANGES
===================================================================
--- gar-wrapper/CHANGES	2011-09-24 10:25:33 UTC (rev 549)
+++ gar-wrapper/CHANGES	2011-09-24 14:04:00 UTC (rev 550)
@@ -4,6 +4,8 @@
 * NEW command alias (or rather full name) "update" for "up"
 * DROP command "scm", typing "svn <sth>" is shorter than "mgar scm <sth>"
 * CHANGE "locate" command output now sorted
+* CHANGE "locate" now automatically builds the index (if not present)
+* CHANGE "locate" will update the index if it's older than 14 days
 * FIX "index" now properly encodes file paths with special signs (e.g. '+')
 * FIX "init-existing" now properly removes obsolete gar/ symlinks
 

Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar	2011-09-24 10:25:33 UTC (rev 549)
+++ gar-wrapper/mgar	2011-09-24 14:04:00 UTC (rev 550)
@@ -440,8 +440,9 @@
   local __term="$2"
   local __searchby=""
 
-  [ -d "${__index}" ] || \
-    { echo "Index not found, create it with: mgar index" >&2; exit 2; }
+  local __stale=`find ${__index}/NMZ.status -mtime +14 2>/dev/null`
+  [ -d "${__index}" ] || { echo "Index not found, creating one."; $0 index; }
+  [ -z "${__stale}" ] || { echo "Index stale (>14d). Rebuilding."; $0 index; }
 
   case "$__term" in
     a:*) __term=${__term#a:}; __searchby="";;

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