[SM-Commit] GIT changes to master sorcery by Jaka Kranjc (48252af0b025f7e95699569971b087764f244a69)

Jaka Kranjc scm at sourcemage.org
Wed Aug 20 12:08:58 EDT 2008


GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 ChangeLog                                  |   15 ++++++++
 usr/sbin/cast                              |    4 +-
 usr/sbin/confmeld                          |    2 +
 usr/sbin/gaze                              |    2 -
 var/lib/sorcery/modules/dl_handlers/dl_git |   16 ++++-----
 var/lib/sorcery/modules/libmisc            |   50 ++++++++++++-----------------
 6 files changed, 50 insertions(+), 39 deletions(-)

New commits:
commit 48252af0b025f7e95699569971b087764f244a69
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

     libmisc: reverted smgl_dirname to the simpler previous implementation
          and added a oneliner to make it pass all the unit tests

commit 95fdfa8353c574a710779cd034b646f7e768679a
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    dl_git: use the multicall git binary; the hardlinks aren't available
          by default anymore from 1.6 on #14648

commit 6317ce72e5904dde0ef8781368ae79eacb71fbb1
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    cast: exit 1 when falling in an INT/TERM trap
    
    should make some parts exit a bit better

commit 9ff01f0cc4d31b3b60b61702681f1894af76611f
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    gaze: search now returns only one instance of every match

commit aabac43a741c6633dbaa415d8b72a534071ee096
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    confmeld: make sure the config stage dir exists

diff --git a/ChangeLog b/ChangeLog
index 713c556..e89c590 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-08-20 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libmisc: reverted smgl_dirname to the simpler previous implementation
+	  and added a oneliner to make it pass all the unit tests
+
+2008-08-19 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* cast: exit 1 when falling in an INT/TERM trap
+	* dl_git: use the multicall git binary; the hardlinks aren't available
+	  by default anymore since 1.6 #14648
+
+2008-08-18 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* gaze: made gaze search not display duplicates
+
+2008-08-16 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* confmeld: make sure the config stage dir exists
+
 2008-08-08 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* libtablet: fixed a coalescing regression #14618
 	  follow symbolic links when searching for the grimoire
diff --git a/usr/sbin/cast b/usr/sbin/cast
index 75a63ef..a96186c 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -426,7 +426,7 @@ function pass_two()  {
     )
   else
     ( CAST_PASS="three"
-      trap exit INT TERM # this keep a rather nasty message
+      trap "exit 1" INT TERM # this keep a rather nasty message
                                     # from appearing if we get killed
       depengine_entry_point "$SPELLS" "$SPELLS_TO_CAST"
       if [[ $SCREEN_NAME ]] ; then
@@ -487,7 +487,7 @@ function pass_two()  {
 function pass_three()  {
   debug "cast" "pass_three - $*"
   unset CAST_PASS
-  trap exit INT TERM
+  trap "exit 1" INT TERM
   local SPELL=$1
 
   # download_log is removed with it's .done in libcast
diff --git a/usr/sbin/confmeld b/usr/sbin/confmeld
index 2364696..a6fd65d 100755
--- a/usr/sbin/confmeld
+++ b/usr/sbin/confmeld
@@ -298,6 +298,8 @@ function main()
   local last_spell=""
   local last_sdate=""
 
+  [[ -d $CONFIG_STAGE_DIRECTORY ]] || mkdir -p $CONFIG_STAGE_DIRECTORY
+
   process_parameters "$@"
 
   confmeld_all
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index bafba18..497a741 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -666,7 +666,7 @@ function gaze_search() {
     -short) shift; real_short_search "$@"  ;;
          *)        real_long_search  "$@"  ;;
 
-    esac
+    esac | awkuniq
 }
 
 #-----------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_git b/var/lib/sorcery/modules/dl_handlers/dl_git
index 9d73a48..3a8978d 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_git
+++ b/var/lib/sorcery/modules/dl_handlers/dl_git
@@ -43,19 +43,19 @@ function dl_git_get () {
     if test -d $GIT_DIRECTORY; then
       message "${MESSAGE_COLOR}Running git pull...${DEFAULT_COLOR}"
       ( cd $GIT_DIRECTORY &&
-      echo git-checkout $GIT_TAG &&
-      git-checkout $GIT_TAG &&
-      echo git-pull $GIT_ROOT $GIT_TAG
-      git-pull $GIT_ROOT $GIT_TAG )
+      echo git checkout $GIT_TAG &&
+      git checkout $GIT_TAG &&
+      echo git pull $GIT_ROOT $GIT_TAG
+      git pull $GIT_ROOT $GIT_TAG )
       rc=$?
       eval "$dl_target=\"$GIT_DIRECTORY\""
     else
       message "${MESSAGE_COLOR}Running git clone...${DEFAULT_COLOR}"
-      echo git-clone $GIT_ROOT $GIT_DIRECTORY
-      git-clone $GIT_ROOT $GIT_DIRECTORY &&
+      echo git clone $GIT_ROOT $GIT_DIRECTORY
+      git clone $GIT_ROOT $GIT_DIRECTORY &&
       cd $GIT_DIRECTORY &&
-      echo git-checkout $GIT_TAG
-      git-checkout $GIT_TAG &&
+      echo git checkout $GIT_TAG
+      git checkout $GIT_TAG &&
       cd ../
       rc=$?
       eval "$dl_target=\"$GIT_DIRECTORY\""
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index e37791e..4dbeea8 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1437,44 +1437,38 @@ function awkuniq() {
 ## Dirname written in bash, optionally uses an upvar (making it forkless).
 #---------------------------------------------------------------------
 function smgl_dirname() {
-  local __dir=() __dirname i __last_dir
+  local __dir=$1
+  local __last_dir __next_dir
 
   # Pull of any trailing /'s, there could be more than/one///
-  __dirname=$1
-  while [[ $__dirname != $__last_dir ]]; do
-    __last_dir=$__dirname
-    __dirname=${__dirname%/}
+  while [[ "$__dir" != "$__last_dir" ]] ; do
+    __last_dir=$__dir
+    __dir=${__dir%/}
   done
-  if [[ -z $__dirname ]]; then
-    __dirname=/
-  fi
 
-  explode "$__dirname" / __dir
-  [[ ${__dirname:0:1} == / ]] && unset __dirname || __dirname="."
-  for (( i=0; i < ${#__dir[@]}-1; i++ )); do
-    __dirname="$__dirname/${__dir[$i]}"
-  done
+  # remove the basename
+  __next_dir=${__dir%/*}
+  # make level one (/bin) directories work
+  [[ -z $__next_dir ]] && __next_dir=//
 
-  # Pull of any trailing /'s
-  while [[ $__dirname != $__last_dir ]]; do
-    __last_dir=$__dirname
-    __dirname=${__dirname%/}
-  done
-  if [[ -z $__dirname ]]; then
-    __dirname=/
+  # if the string had no more directory seperators in it (was aaa/, now aaa),
+  # then this is a special case, the answer is '.'
+  if [[ "$__next_dir" == "$__dir" ]] ; then
+    __dir="."
   else
-    if [[ ${__dirname:0:2} == // ]]; then
-      __dirname="${__dirname:1}"
-    elif [[ ${__dirname:0:2} == ./ ]]; then
-      # usually not strictly necessary, but let's be conformant with dirname
-      __dirname="${__dirname:2}"
-    fi
+    __dir=$__next_dir
+    # Trim off anymore leading /'s (was /aa//bb, now /aa//)
+    while [[ "$__dir" != "$__last_dir" ]] ; do
+      __last_dir=$__dir
+      __dir=${__dir%/}
+      [[ "$__dir" == "/" ]] && break
+    done
   fi
 
   if [[ "$2" ]] ; then
-    upvar "$2" "$__dirname"
+    upvar "$2" "$__dir"
   else
-    echo "$__dirname"
+    echo "$__dir"
   fi
 }
 



More information about the SM-Commit mailing list