[SM-Commit] GIT changes to master quill by Jaka Kranjc (f64b7ae1b7053fe4f07f91578b6d23c04f1797dd)

Jaka Kranjc scm at sourcemage.org
Mon Aug 25 13:46:03 EDT 2008


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

 usr/bin/quill                    |   22 +++++++++++++++----
 var/lib/quill/ChangeLog          |    7 ++++++
 var/lib/quill/modules/libcopy    |    5 ++--
 var/lib/quill/modules/libcore    |   11 +++++++++
 var/lib/quill/modules/libgpg     |    3 +-
 var/lib/quill/modules/libhistory |   44 +++++++++++++++++++++++++++++++--------
 var/lib/quill/version            |    2 -
 7 files changed, 76 insertions(+), 18 deletions(-)

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

    	* libhistory: made add_history_entry work on arbitrary files and added
    	  a limited add_changelog_entry
    	* libcore: added unset_spell_paths, so we do that consistently
    	* quill, libgpg, libcopy: use unset_spell_paths
    	* version: 0.3.0-rc1

diff --git a/usr/bin/quill b/usr/bin/quill
index 96a5e47..f43d1b0 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -194,7 +194,7 @@ then
             'Add arbitrary HISTORY entries' \
             'Increment/add PATCHLEVEL or SECURITY_PATCH' \
             'Switch to upstream gpg verification' \
-            '--NOOP--' \
+            'Deprecate the spell (also for renames)' \
             '--NOOP--' \
             '--NOOP--' \
             '--NOOP--' \
@@ -268,6 +268,9 @@ then
       "${actions[3]}") #'Switch to upstream gpg verification'
         main_update_loop convert_to_upstream_gpg
       ;;
+      "${actions[4]}") # deprecate the spell
+        true deprecate_menu
+      ;;
       "${actions[9]}") #"Copy it here from the grimoire or QUILL_GIT_DIR"
         ask_and_copy_over || continue
       ;;
@@ -279,6 +282,7 @@ then
         if [[ ! -e $QUILL_SPELL_DIR/$SPELL_NAME ]]
         then
           error_msg "There is nothing to copy back!"
+          unset_spell_paths
           continue
         fi
         if [[ ! -e $GRIMOIRE/$SECTION/$SPELL_NAME ]]
@@ -288,16 +292,19 @@ then
           then
             quill_final_put_in_grimoire
           fi
+          unset_spell_paths
           continue
         fi
 
         quill_final_put_in_grimoire $GRIMOIRE $SECTION no
+        unset_spell_paths
       ;;
       "${actions[12]}") #"Try it out"
         codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
         if [[ ! -e $GRIMOIRE/$SECTION/$SPELL_NAME ]]
         then
           error_msg "Spell not found in the grimoire!"
+          unset_spell_paths
           continue
         fi
 
@@ -309,14 +316,18 @@ then
         if [[ $SPELL_UPDATED == n ]]
         then
           # 1. there is no difference; there is no change
-          query "Are you sure you want to cast the unchanged spell from the grimoire?" y ||
-          continue
+          query "Are you sure you want to cast the unchanged spell from the grimoire?" y || {
+            unset_spell_paths
+            continue
+          }
         fi
         if ! diff -q $QUILL_SPELL_DIR/$SPELL_NAME $GRIMOIRE/$SECTION/$SPELL_NAME -x DETAILS.orig > /dev/null
         then
           # 3. the spell was changed, but not copied over yet
-          query "Are you sure you want to cast the unchanged spell from the grimoire?" y ||
-          continue
+          query "Are you sure you want to cast the unchanged spell from the grimoire?" y || {
+            unset_spell_paths
+            continue
+          }
         fi
 
         if query "Do you want to cast -r? (possibly needed for multiversion spells)" n; then
@@ -324,6 +335,7 @@ then
         else
           $QUILL_SUDO -c "cast -c $SPELL_NAME"
         fi
+        unset_spell_paths
       ;;
     esac
 
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 4b1e2b2..fca90ef 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-21 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libhistory: made add_history_entry work on arbitrary files and added
+	  a limited add_changelog_entry
+	* libcore: added unset_spell_paths, so we do that consistently
+	* quill, libgpg, libcopy: use unset_spell_paths
+	* version: 0.3.0-rc1
+
 2008-08-21 Andraž "ruskie" Levstik <ruskie at mages.ath.cx>
 	* libfsfdirectory: updated for new layout
 	* version: 0.2.9, time for the dance
diff --git a/var/lib/quill/modules/libcopy b/var/lib/quill/modules/libcopy
index 7dd2d3d..36d0f9d 100644
--- a/var/lib/quill/modules/libcopy
+++ b/var/lib/quill/modules/libcopy
@@ -108,7 +108,8 @@ function copy_from_git()
   codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
   diff -q $QUILL_SPELL_DIR/$SPELL_NAME "$GRIMOIRE/$SECTION/$SPELL_NAME" -x DETAILS.orig > /dev/null || SPELL_UPDATED=y
 
-  unset GRIMOIRE2 SECTION2 GRIMOIRE SECTION GRIMOIRE_NAME SECTION_DIRECTORY
+  unset_spell_paths
+  unset GRIMOIRE2 SECTION2
   cd "$QUILL_SPELL_DIR/$SPELL_NAME"
 }
 
@@ -139,7 +140,7 @@ function ask_and_copy_over()
     rm -fr $QUILL_SPELL_DIR/$SPELL_NAME &&
     cp -pr $SECTION_DIRECTORY/$SPELL_NAME $QUILL_SPELL_DIR &&
     message "Done." &&
-    unset GRIMOIRE SECTION GRIMOIRE_NAME SECTION_DIRECTORY &&
+    unset_spell_paths &&
     SPELL_UPDATED=n
   elif [[ $reply == "QUILL_GIT_DIR" ]]
   then
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index 370e4c0..3bbe61f 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -495,6 +495,17 @@ function check_description_wrap(){
 }
 
 #---
+## @Synopsis unsets vars added by codex_get_spell_paths
+##
+## @Globals GRIMOIRE SECTION GRIMOIRE_NAME SECTION_DIRECTORY
+## @Globals SPELL_DIRECTORY SCRIPT_DIRECTORY SPELL_CONFIG
+#---
+function unset_spell_paths(){
+  unset GRIMOIRE SECTION GRIMOIRE_NAME SECTION_DIRECTORY \
+    SPELL_DIRECTORY SCRIPT_DIRECTORY SPELL_CONFIG
+}
+
+#---
 ## @Synopsis checks if anything needs summoning and does so
 ##
 ## @param none
diff --git a/var/lib/quill/modules/libgpg b/var/lib/quill/modules/libgpg
index 98f84bd..2e461f3 100644
--- a/var/lib/quill/modules/libgpg
+++ b/var/lib/quill/modules/libgpg
@@ -184,6 +184,7 @@ function convert_to_upstream_gpg() {
         error_msg "Failed!"
       fi
       sleep 2"
+      unset_spell_paths
     fi
   else
     let UPDATE_COUNTER--
@@ -254,7 +255,7 @@ function quill_get_spell_keyring() {
       fi
       SPELL_KEYRING=$(basename $SPELL_KEYRING)
     fi
-    unset GRIMOIRE SECTION GRIMOIRE_NAME SECTION_DIRECTORY
+    unset_spell_paths
   else
     # get a hint from the failed verification
     message "Creating a keyring from the key that made the signature ..."
diff --git a/var/lib/quill/modules/libhistory b/var/lib/quill/modules/libhistory
index d60e91c..24267f2 100644
--- a/var/lib/quill/modules/libhistory
+++ b/var/lib/quill/modules/libhistory
@@ -22,38 +22,40 @@ function add_history()
 #---
 ## @Synopsis Adds a new HISTORY entry. Uses idempotent date title handling.
 ## @param entry without the leading tab, bullet and space
+## @param file, defaults to HISTORY - used for adding Changelog entries
 ##
 ## @Globals HISTORY_DATE GURU_NAME GURU_EMAIL
 #---
 function add_history_entry()
 {
   local title="$HISTORY_DATE $GURU_NAME <$GURU_EMAIL>" file
+  local history_file=${1:-HISTORY}
 
-  if [[ ! -e HISTORY ]]; then
-    error_msg "Spell is missing a HISTORY file!"
+  if [[ ! -e $history_file ]]; then
+    error_msg "Spell is missing a $history_file file!"
     [[ -e DETAILS.orig ]] && mv DETAILS.orig ..
-    add_history "added missing HISTORY file"
+    add_history "added missing $history_file file"
     [[ -e ../DETAILS.orig ]] && mv ../DETAILS.orig .
   fi
 
-  if grep -q "$title" HISTORY;
+  if grep -q "$title" $history_file;
   then
     # check if we already have an entry for the same file
     file="${1%%:*}"
-    if [[ -z $(sed -n "1,/^\s*$/ s%\* $file:%&%p" HISTORY) ]]
+    if [[ -z $(sed -n "1,/^\s*$/ s%\* $file:%&%p" $history_file) ]]
     then # we don't
-      sed -i "/$title/ a\\\t* $1" HISTORY
+      sed -i "/$title/ a\\\t* $1" $history_file
     else
       # we do, but first check that the new addition is unique
-      if ! sed -n "1,/^\s*$/p" HISTORY | grep -qF "* $1"
+      if ! sed -n "1,/^\s*$/p" $history_file | grep -qF "* $1"
       then
         sed -i "1,/^\s*$/ {
                 /\* $file:/ a\\\t ${1#*:}
-               }" HISTORY
+               }" $history_file
       fi
     fi
   else # first time today
-    sed -i "1 s%^.*$%$title\n\t* $1\n\n&%" HISTORY
+    sed -i "1 s%^.*$%$title\n\t* $1\n\n&%" $history_file
   fi
 }
 
@@ -103,6 +105,30 @@ function add_user_history_entries()
 }
 
 #---
+## @Synopsis Adds a new Changelog entry
+## @param entry without the leading tab, bullet and space
+##
+## WARNING: currently only modifies the live grimoire!
+##
+## @Globals SPELL_NAME
+#---
+function add_changelog_entry()
+{
+  local tmpf=cl.$$
+  codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME) &&
+  add_history_entry "$@" $GRIMOIRE/ChangeLog
+  unset_spell_paths
+
+  echo > $tmpf
+  add_history_entry "$@" $tmpf
+  message "The Changelog entry was added directly to the grimoire."
+  message "Either copy it over or add this to your git grimoire (if applicable)"
+  message "and fix the initial tab:"
+  cat $tmpf
+  rm $tmpf
+}
+
+#---
 ##
 ## This software is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
diff --git a/var/lib/quill/version b/var/lib/quill/version
index 1866a36..fbc5196 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.9
+0.3.0-rc1



More information about the SM-Commit mailing list