Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master quill by Jaka Kranjc (a00cd6bf4054e949b034fb17f8de6b139e8e8a8a)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT mail.sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master quill by Jaka Kranjc (a00cd6bf4054e949b034fb17f8de6b139e8e8a8a)
  • Date: Thu, 25 Jan 2007 15:42:09 -0600

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

todo | 27 ++++++++++++
usr/bin/quill | 76
++++++++++++++++++++++++++--------
var/lib/quill/ChangeLog | 13 +++++
var/lib/quill/modules/libcore | 35 +++++++++++++--
var/lib/quill/modules/libdetails | 2
var/lib/quill/modules/libfreshmeatxml | 2
var/lib/quill/modules/libupdate | 28 +++++++++++-
var/lib/quill/version | 2
8 files changed, 161 insertions(+), 24 deletions(-)

New commits:
commit a00cd6bf4054e949b034fb17f8de6b139e8e8a8a
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* quill: added last menu entry for 0.2: patchlevel adding
factored out multiversion_check
fixed copying to git of new spells
added MD5[] support, we have far too many of these left
* libcore: fix the appearance of DETAILS.orig in the copies
added utility function dir_check
* libupdate: improved ask_and_copy_over and update_patchlevel
* libfreshmeatxml: fallback on argument for spell name
* libdetails: quote the website too, some contain # and wouldn't show
whole
* version: 0.2 final

also added todo with some future plans

diff --git a/todo b/todo
new file mode 100644
index 0000000..d080fd9
--- /dev/null
+++ b/todo
@@ -0,0 +1,27 @@
+post 0.2 things that would be cool to have done:
+new menu choices
+ * 'Manage patches'
+ add/remove them and their references in PRE_BUILD
+ add/remove PRE_BUILD
+
+ * 'Add another version'
+ branches
+ SCM: wierd versions; also needs the autoupdate stuff
+
+ * 'Convert to upstream signing'
+ try automatically on updates (check for .sig)?
+
+update mode:
+ * create a main_update_loop and use it in the patching case too
+ * clean the namespace by moving more stuff into functions, using locals and
+ documenting global vars used in all functions
+
+improvements in the standard mode:
+ * use some of the functions from update mode,
+ especially the verification stuff
+ * handle bad entries and ^C better
+ * use summon and more of the sorcery code?
+
+fmxml:
+ * sanitize, dump curl?
+ * improve the speed, dump xml-grep?
diff --git a/usr/bin/quill b/usr/bin/quill
index 76b0428..1cd55dd 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -141,16 +141,17 @@ then
SPELL_NAME=$QUILL_TARGET
codex_does_spell_exist $SPELL_NAME || exit 6
ask_and_copy_over || exit 7
+ cd $QUILL_SPELL_DIR/$SPELL_NAME

while true; do
actions=('Update the spell to a newer version' \
'Add arbitrary HISTORY entries' \
- 'Add a another version' \
+ 'Increment/add PATCHLEVEL or SECURITY_PATCH' \
'Copy it here from the grimoire or QUILL_GIT_DIR' \
'Copy it under QUILL_GIT_DIR' \
'Copy it back to the grimoire' \
'Try it out' \
- 'Quit' ) #'Manage patches'
+ 'Quit' ) #'Manage patches' 'Add a another version' 'Convert to
upstream signing'
echo
query_list "What do you want to do?" ANSWER "Quit" "${actions[@]}"

@@ -160,6 +161,7 @@ then
then
echo
[[ -d $QUILL_SPELL_DIR/$SPELL_NAME ]] || ask_and_copy_over || continue
+ [[ -e DETAILS.orig ]] || cp DETAILS DETAILS.orig
echo
fi
case "$ANSWER" in
@@ -184,15 +186,7 @@ then
sed -i "s/\sVERSION=['\"]*${version}['\"]*\s*$/
VERSION=$SPELL_VERSION/" DETAILS

#check for multiversion spells
- if [[ ${#versions[@]} != 1 ]]
- then #we have a problem
- message "Oh dear, detected a multiversion spell. Going to cat
DETAILS for you "
- message "and then you will tell me which variable I need to
set, so I can get "
- message "to the correct version ($version)."
- sleep 3
- cat DETAILS
- query_string if_var "${QUERY_COLOR}Please enter the
appropriate variable. Example: UGU_DEVEL=y${DEFAULT_COLOR} "
- fi
+ multiversion_check

# reparse the (usually new) source urls
get_sources_and_urls
@@ -245,7 +239,7 @@ then
do
hash=$(quill_hash_get $SOURCE_CACHE/$source)
# use the original DETAILS, as we already changed the VERSION
- current_check=$(eval ${if_var:-:}; . DETAILS.orig &>
/dev/null; eval echo \$SOURCE${i}_HASH\$SOURCE${i}_GPG\$SOURCE${i}_IGNORE)
+ current_check=$(eval ${if_var:-:}; . DETAILS.orig &>
/dev/null; eval echo
\$SOURCE${i}_HASH\$SOURCE${i}_GPG\$SOURCE${i}_IGNORE\$\{MD5[${i:-0}]\})

if [[ -z $current_check ]]
then
@@ -264,6 +258,18 @@ then
continue
fi

+ # MD5? These contain no :
+ if ! grep -q ":" <<< "$current_check"
+ then
+ new_value=$(count_spaces SOURCE${i}_HASH)
+ sed -i
"s/^.*MD5\[${i:-0}\]=['\"]*${current_check}['\"]*\s*$/${new_value}SOURCE${i}_HASH=sha512:$hash/"
DETAILS
+ remove_old_sigs "$version"
+
+ [[ ! $i ]] && i=1
+ let i+=1
+ continue
+ fi
+
#SOURCE_GPG?
if grep -Eq "(^(sha(512|256|1)|md5):.*|UPSTREAM_KEY)" <<<
"$current_check"
then
@@ -306,7 +312,6 @@ then


#it is either a SOURCE_HASH or the user wants to replace
SOURCE_GPG
-#echo "+$current_check++"
new_value=$(count_spaces SOURCE${i}_HASH)
sed -i
"s/^.*SOURCE${i}_[^=]*=['\"]*${current_check}['\"]*\s*$/${new_value}SOURCE${i}_HASH=sha512:$hash/"
DETAILS

@@ -343,12 +348,30 @@ then
"${actions[1]}") #"Add an arbitrary HISTORY entry"
add_user_history_entries
;;
- "${actions[2]}") #"Add another version"
+ "${actions[2]}") #"Increment/add PATCHLEVEL or SECURITY_PATCH"
+ #fetch current versions, ignoring SCM ones
+ versions=( $(sed -n 's/\s*\<VERSION=//p' DETAILS |
+ grep -Eiv '\$[(]date *+|cvs|svn|tla|git|scm' | sort |
uniq) )
+ [[ -z ${versions[@]} ]] && error_msg "No versions to update!" &&
continue
+
+ message "Current relevant version(s): ${versions[@]}"
+
+ for version in "${versions[@]}"
+ do
+ if query "Do you want to do it for $version?" y
+ then
+ SPELL_VERSION="$version"
+ update_patchlevel PATCHLEVEL
+ update_patchlevel SECURITY_PATCH
+ message "Done."
+ fi
+ done
+ ;;
+# "${actions[2]}") #"Add another version"
#SCM or branch?
#update patchlevel?
#update HISTORY
#copy the spell back to the grimoire?
- echo ++"$ANSWER"++ ;;
"${actions[3]}") #"Copy it here from the grimoire or QUILL_GIT_DIR"
ask_and_copy_over || continue
;;
@@ -523,7 +546,28 @@ else
fi
if query "Do you want to put the spell into QUILL_GIT_DIR?" n
then
- copy_from_git
+ if [[ -z $QUILL_GIT_DIR ]]
+ then
+ error_msg "\$QUILL_GIT_DIR is empty, run quill -r to set it!"
+ echo
+ else
+ find "$QUILL_GIT_DIR" -maxdepth 1 -type d -printf "%P "
+ echo
+ query_string GRIMOIRE "Which of the above is the target git grimoire? "
+ dir_check "$QUILL_GIT_DIR/$GRIMOIRE" fatal
+ echo
+ # maybe we have QUILL_SECT_NAME from the previous query, so default to
it
+ find "$QUILL_GIT_DIR/$GRIMOIRE" -maxdepth 1 -type d -printf "%P\n" |
column
+ query_string SECTION "Which section do you want to put it in? "
$QUILL_SECT_NAME
+ dir_check "$QUILL_GIT_DIR/$GRIMOIRE/$SECTION" fatal
+ if [[ -w $QUILL_GIT_DIR/$GRIMOIRE/$SECTION ]]
+ then
+ mkdir "$QUILL_GIT_DIR/$GRIMOIRE/$SECTION/$SPELL_NAME"
+ else
+ ${QUILL_SUDO:-su} -c "mkdir
'$QUILL_GIT_DIR/$GRIMOIRE/$SECTION/$SPELL_NAME'"
+ fi
+ copy_to_git
+ fi
fi
fi
message "That's all folks!"
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 81839fd..95dc4bb 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,16 @@
+2007-01-24 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * quill: added last menu entry for 0.2: patchlevel adding
+ factored out multiversion_check
+ fixed copying to git of new spells
+ added MD5[] support, we have far too many of these left
+ * libcore: fix the appearance of DETAILS.orig in the copies
+ added utility function dir_check
+ don't reindex if overwriting in quill_final_put_in_grimoire
+ * libupdate: improved ask_and_copy_over and update_patchlevel
+ * libfreshmeatxml: fallback on argument for spell name
+ * libdetails: quote the website too, some contain # and wouldn't show
whole
+ * version: 0.1.15, third, internal 0.2 release candidate
+
2007-01-23 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libhistory: added add_user_history_entries for adding arbitrary
entries
* quill: factored out ask_and_copy_over, so it is optional and saner
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index 087c5c2..1c7ec8f 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -179,6 +179,7 @@ function quill_set_executable_bit() {
## @param flag toggling scribe reindex, set it to "no" to toggle
#---
function quill_final_put_in_grimoire() {
+ local reindex=$3

if [[ -z $2 ]]; then
query_list "Into which grimoire do you wish to put the spell:"
QUILL_GRIM_NAME \
@@ -193,7 +194,9 @@ function quill_final_put_in_grimoire() {

if [[ -e $QUILL_GRIM_NAME/$QUILL_SECT_NAME/$SPELL_NAME ]]; then
message "${MESSAGE_COLOR}There is an exsisting spell for $SPELL_NAME
in $QUILL_GRIM_NAME/$QUILL_SECT_NAME"
- if ! query "Do you want to overwrite it?" y; then
+ if query "Do you want to overwrite it?" y; then
+ reindex=no
+ else
quill_final_put_in_grimoire
return
fi
@@ -209,6 +212,7 @@ function quill_final_put_in_grimoire() {

# we wipe it first, so we can handle any files that we deleted before
rm -r "$QUILL_GRIM_NAME/$QUILL_SECT_NAME/$SPELL_NAME" || return 1
+ rm -f "$QUILL_SPELL_DIR/$SPELL_NAME/DETAILS.orig"

cp -r $QUILL_SPELL_DIR/$SPELL_NAME $QUILL_GRIM_NAME/$QUILL_SECT_NAME/
if [[ $? != 0 ]]; then
@@ -225,18 +229,18 @@ function quill_final_put_in_grimoire() {
}

if [[ -w $QUILL_GRIM_NAME && -w $QUILL_GRIM_NAME/$QUILL_SECT_NAME ]]; then
- quill_final_put_in_grimoire_sub $3
+ quill_final_put_in_grimoire_sub $reindex
if [[ $? == 1 ]]
then
error_msg "Permission problems, trying as root ..."
export QUILL_GRIM_NAME QUILL_SECT_NAME QUILL_SPELL_DIR SPELL_NAME
${QUILL_SUDO:-su} -c "$(declare -f quill_final_put_in_grimoire_sub); \
- quill_final_put_in_grimoire_sub $3"
+ quill_final_put_in_grimoire_sub $reindex"
fi
else
export QUILL_GRIM_NAME QUILL_SECT_NAME QUILL_SPELL_DIR SPELL_NAME
${QUILL_SUDO:-su} -c "$(declare -f quill_final_put_in_grimoire_sub); \
- quill_final_put_in_grimoire_sub $3"
+ quill_final_put_in_grimoire_sub $reindex"
fi

}
@@ -436,6 +440,29 @@ function check_parameter() {
}

#---
+## @Synopsis verbosely checks if the argument is a dir and optionally exits
+##
+## @param path
+## @param (optional) be fatal
+##
+## @return 0 if it is a dir
+## @return 1 otherwise
+#---
+function dir_check() {
+ if [[ ! -d $1 ]]
+ then
+ error_msg "Not a directory: $1!"
+ if [[ -z $2 ]]
+ then
+ return 1
+ else
+ exit 17
+ fi
+ fi
+ return 0
+}
+
+#---
## @Synopsis prints a colored error message
#---
function error_msg() {
diff --git a/var/lib/quill/modules/libdetails
b/var/lib/quill/modules/libdetails
index a7384c1..c66fb16 100644
--- a/var/lib/quill/modules/libdetails
+++ b/var/lib/quill/modules/libdetails
@@ -193,7 +193,7 @@ echo \
SOURCE_URL[0]=${SPELL_SRC_URL}
SOURCE_HASH=sha512:${QUILL_SPELL_HASH}
SOURCE_DIRECTORY=\"\${BUILD_DIRECTORY}/$SPELL_SRC_DIR\"
- WEB_SITE=${SPELL_URL}
+ WEB_SITE=\"${SPELL_URL}\"
LICENSE[0]=${SPELL_LICENSE}
ENTERED=${HISTORY_DATE//-/}
SHORT=\"${SPELL_SHORT_DESCRIPTION}\"
diff --git a/var/lib/quill/modules/libfreshmeatxml
b/var/lib/quill/modules/libfreshmeatxml
index 4568f45..440e1b8 100644
--- a/var/lib/quill/modules/libfreshmeatxml
+++ b/var/lib/quill/modules/libfreshmeatxml
@@ -45,12 +45,14 @@ function quill_fmxml_core(){
if grep -q "$not_found" "$FRESHMEAT_FILE"; then
error_msg "$not_found"
rm "$FRESHMEAT_FILE"
+ SPELL_NAME="$1"
return 2
fi

# fill in variables from xml file
if [[ $1 ]] ; then
SPELL_NAME=$(quill_fmxml_grab_from_xml projectname_short $1|tr 'A-Z'
'a-z')
+ SPELL_NAME="${SPELL_NAME:-$1}"
SPELL_DESC_NAME="${SPELL_NAME}"
for each in url_bz2 url_tgz; do
TMP=$(quill_fmxml_grab_from_xml $each $1)
diff --git a/var/lib/quill/modules/libupdate b/var/lib/quill/modules/libupdate
index 8acdfa9..6faafaf 100644
--- a/var/lib/quill/modules/libupdate
+++ b/var/lib/quill/modules/libupdate
@@ -53,7 +53,7 @@ function update_patchlevel_sub()
if [[ $current_value == none ]]
then
new_value=$(count_spaces $1)
- sed -i "s,VERSION=$SPELL_VERSION,&\n$new_value$1=1," DETAILS
+ sed -i "s, VERSION=['\"]*${SPELL_VERSION}['\"]*\s*$,&\n$new_value$1=1,"
DETAILS
add_history_entry "DETAILS: $1++"
else
new_value=$(( current_value + 1 ))
@@ -175,6 +175,7 @@ function remove_old_sigs()
fi

}
+
#---
## @Synopsis Unexpands SOURCE_GPG if necessary to be later able to match it
##
@@ -241,14 +242,37 @@ function ask_and_copy_over()
rm -fr $QUILL_SPELL_DIR/$SPELL_NAME &&
cp -r $SECTION_DIRECTORY/$SPELL_NAME $QUILL_SPELL_DIR &&
message "Done."
- else
+ elif [[ $reply == "QUILL_GIT_DIR" ]]
+ then
copy_from_git &&
message "Done."
+ else
+ error_msg "Bad choice"
+ ask_and_copy_over
+ return
fi &&
cd $QUILL_SPELL_DIR/$SPELL_NAME &&
cp DETAILS DETAILS.orig || return 1
}

+
+#---
+## @Synopsis Checks if the spell is multiversioned and sets the delimiter
+## @Synopsis variable (if_var) if it is
+#---
+function multiversion_check()
+{
+ if [[ ${#versions[@]} != 1 ]]
+ then #we have a problem
+ message "Oh dear, detected a multiversion spell. Going to cat DETAILS
for you "
+ message "and then you will tell me which variable I need to set, so I
can get "
+ message "to the correct version ($version)."
+ sleep 3
+ cat DETAILS
+ query_string if_var "${QUERY_COLOR}Please enter the appropriate
variable. Example: UGU_DEVEL=y${DEFAULT_COLOR} "
+ fi
+}
+
#---
##
## This software is free software; you can redistribute it and/or modify
diff --git a/var/lib/quill/version b/var/lib/quill/version
index 71d6a66..3b04cfb 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.1.14
+0.2



  • [SM-Commit] GIT changes to master quill by Jaka Kranjc (a00cd6bf4054e949b034fb17f8de6b139e8e8a8a), Jaka Kranjc, 01/25/2007

Archive powered by MHonArc 2.6.24.

Top of Page