Skip to Content.
Sympa Menu

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

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master quill by Jaka Kranjc (d03a86663d789c7cabae192e1c844d011004c04d)
  • Date: Fri, 4 May 2007 16:25:53 -0500

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

todo | 9
usr/bin/quill | 28 ++
var/lib/quill/ChangeLog | 26 ++
var/lib/quill/modules/libcopy | 7
var/lib/quill/modules/libcore | 70 +++++++
var/lib/quill/modules/libdetails | 24 --
var/lib/quill/modules/libgpg | 365
+++++++++++++++++++++++++++++++++++++++
var/lib/quill/modules/libupdate | 124 ++-----------
var/lib/quill/version | 2
9 files changed, 514 insertions(+), 141 deletions(-)

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

rc1 of the upstream gpg converters

commit a9eee55d767416ee3734770fc4903c8d1c200594
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

almost there

commit 1ed9cacfae803482d11c36dab1e6aa283a76c364
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

and more

commit 220dc2fe1a44d5bec9cdfc555065be69c60661ce
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

committing intermediate results

diff --git a/todo b/todo
index bd2dd96..a757ade 100644
--- a/todo
+++ b/todo
@@ -8,10 +8,6 @@ new menu choices
branches
SCM: wierd versions; also needs the autoupdate stuff; only for -w

- * 'Convert to upstream signing'
- try automatically on updates (check for .sig. .asc)?
- downloadable or manually included
-
* 'list/remove files?'

* 'Manage CONFIGURE options'
@@ -19,14 +15,12 @@ new menu choices
update mode:
* clean the namespace by moving more stuff into functions
* plug other linters at the end of the update and move them all in liblint
+ * add mirror support for SOURCE_URLs when adding new sources

improvements in the standard mode:
- * use some of the functions from update mode,
- especially the verification stuff
* handle bad entries and ^C better

fmxml:
- * improve the speed
* dump xml-grep (awk, sed)?
* redo html parsing

@@ -35,3 +29,4 @@ documentation:

overall:
* Improve scripting support to make it possible to write alternate
interfaces for it
+ * add quill mode to /quillrc to avoid the need to constantly pass it
diff --git a/usr/bin/quill b/usr/bin/quill
index 564be82..689c082 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -179,17 +179,23 @@ then
actions=('Update the spell to a newer version' \
'Add arbitrary HISTORY entries' \
'Increment/add PATCHLEVEL or SECURITY_PATCH' \
+ 'Switch to upstream gpg verification' \
+ '--NOOP--' \
+ '--NOOP--' \
+ '--NOOP--' \
+ '--NOOP--' \
+ '--NOOP--' \
'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' 'Add a another version' 'Convert to
upstream signing'
+ 'Quit' ) #'Manage patches' 'Add a another version'
echo
query_list "What do you want to do?" ANSWER "Quit" "${actions[@]}"

[[ $ANSWER == "Quit" ]] && exit 0

- if [[ $ANSWER == ${actions[0]} || $ANSWER == ${actions[1]} || $ANSWER ==
${actions[2]} ]]
+ if [[ $ANSWER == ${actions[0]} || $ANSWER == ${actions[1]} || $ANSWER ==
${actions[2]} || $ANSWER == ${actions[3]} ]]
then
echo
[[ -d $QUILL_SPELL_DIR/$SPELL_NAME ]] || ask_and_copy_over || continue
@@ -240,13 +246,16 @@ then
#update patchlevel?
#update HISTORY
#copy the spell back to the grimoire?
- "${actions[3]}") #"Copy it here from the grimoire or QUILL_GIT_DIR"
+ "${actions[3]}") #'Switch to upstream gpg verification'
+ main_update_loop convert_to_upstream_gpg
+ ;;
+ "${actions[9]}") #"Copy it here from the grimoire or QUILL_GIT_DIR"
ask_and_copy_over || continue
;;
- "${actions[4]}") #"Copy it under $QUILL_GIT_DIR"
+ "${actions[10]}") #"Copy it under $QUILL_GIT_DIR"
copy_to_git || continue
;;
- "${actions[5]}") #"Copy it back to the grimoire"
+ "${actions[11]}") #"Copy it back to the grimoire"
codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
if [[ ! -e $QUILL_SPELL_DIR/$SPELL_NAME ]]
then
@@ -261,7 +270,7 @@ then

quill_final_put_in_grimoire $GRIMOIRE $SECTION no
;;
- "${actions[6]}") #"Try it out"
+ "${actions[12]}") #"Try it out"
codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
if [[ ! -e $GRIMOIRE/$SECTION/$SPELL_NAME ]]
then
@@ -298,6 +307,13 @@ then
done
else
query_spell_name
+ while codex_does_spell_exist $SPELL_NAME > /dev/null; do
+ message "This spell name is already taken!"
+ gaze short $SPELL_NAME
+ unset SPELL_NAME
+ echo
+ query_spell_name
+ done
query_spell_source_url
# the semirandom fallback url is there to circumvent sorcery bug #13729
while ! url_verify "${SPELL_SRC_URL:-ftp://34tqgsad}"; > /dev/null; do
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index a8f55ce..b216e89 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,29 @@
+2007-05-04 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * quill: ensure the spell name is unique
+ * libgpg: created to house all the gpg related functions
+ finished and added another file change implementation
+ factored out quill_get_spell_keyring, guess_signature_url
+ added support for automagically creating the keyring from the
signature
+ added HISTORY updates
+ fixed dry run
+ misc changes to complete the beta version of convert_to_upstream_gpg
+ * libupdate: added silent checking, but yelling for upstream
signatures
+ renamed conditional_set_var to *_get_var and plugged the variable
leak
+ * version: 0.2.6-rc5
+
+2007-05-03 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcore: added inc_src_num and inc_to_unique_src_num to enhace
readability
+ factored summon_sources out of version_bump for other uses
+ * libupdate: remove_old_sigs now handles .sign files too
+ use *src_num functions
+ implement convert_to_upstream_gpg
+ * libdetails: added query_spell_keyring, adapted query_spell_signature
+ * quill: add convert_to_upstream_gpg to the menu
+ add placeholders to the menu to avoid future renumbering
+
+2007-05-02 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcopy: suggest only git clones for target git grimoires
+
2007-04-25 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* quill: redefine url_ftp_verify for #13001
* version: 0.2.6-rc2
diff --git a/var/lib/quill/modules/libcopy b/var/lib/quill/modules/libcopy
index 6e49e14..87fa965 100644
--- a/var/lib/quill/modules/libcopy
+++ b/var/lib/quill/modules/libcopy
@@ -5,14 +5,17 @@
#---
function copy_new_to_git()
{
- local grimoire section
+ local grimoire section dir
if [[ -z $QUILL_GIT_DIR ]]
then
error_msg "\$QUILL_GIT_DIR is empty, run quill -r to set it!"
echo
return 1
else
- find "$QUILL_GIT_DIR" -maxdepth 1 -type d -printf "%P\n" | column
+ find "$QUILL_GIT_DIR" -maxdepth 1 -type d |
+ while read dir; do
+ [[ -d $dir/.git ]] && basename $dir
+ done | column
query_string grimoire "Which of the above is the target git grimoire? "
while ! dir_check "$QUILL_GIT_DIR/$grimoire"; do
query_string grimoire "Which of the above is the target git grimoire? "
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index c153c98..789ed32 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -324,8 +324,7 @@ function check_source_urls() {
rc=1
fi
fi
- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
done
return $rc
}
@@ -479,6 +478,73 @@ function check_description_wrap(){
}

#---
+## @Synopsis checks if anything needs summoning and does so
+##
+## @param none
+##
+## @Globals "sources" "sources_and_urls"
+#---
+function summon_sources() {
+ local to_summon source
+
+ message "Summoning ..."
+ #download; we are not a grimoire so some hacking is needed
+ # also workaround sorcery bug #13412
+ to_summon="$sources_and_urls"
+ for source in $sources; do
+ [[ -e $SOURCE_CACHE/$source ]] &&
+ to_summon="$(sed "/^$source /d" <<< "$to_summon")"
+ done
+ if [[ -z $to_summon ]]; then
+ message "Nothing new to summon, all sources found."
+ else
+ if ! summon -r <<< "$to_summon"; then
+ error_msg "Summoning failed, aborting update!"
+ query "Do you want to edit DETAILS? (you can retry the update)" n &&
quill_edit DETAILS
+ continue 2 || return 1
+ fi
+ fi
+ echo
+}
+
+#---
+## @Synopsis sets the parameter to the next free (biggest+1) source number
+##
+## @param variable
+##
+## @Globals "version_switch"
+#---
+function inc_to_unique_src_num() {
+ local name="$1" num
+
+ num=$(
+ eval ${version_switch:-:}; . DETAILS &> /dev/null
+ # the numbers are alphabetically sorted, which is not good enough in the
+ # rare case where there are more than 9 sources - so we resort to
resorting
+ get_source_nums | sort -n | tail -n1
+ )
+ [[ ! $num ]] && num=1
+
+ eval $name=\$\(\(++num\)\)
+}
+
+#---
+## @Synopsis increments the parameter by 1 or sets it to 1 if it is empty
+##
+## @param variable
+##
+## @Globals none
+#---
+function inc_src_num() {
+ local name="$1" num
+
+ num="${!name}"
+ [[ ! $num ]] && num=1
+
+ eval $name=\$\(\(++num\)\)
+}
+
+#---
## @Synopsis prints a colored error message
##
## @Globals none
diff --git a/var/lib/quill/modules/libdetails
b/var/lib/quill/modules/libdetails
index 46e0897..897da4b 100644
--- a/var/lib/quill/modules/libdetails
+++ b/var/lib/quill/modules/libdetails
@@ -59,28 +59,6 @@ function query_spell_version(){
}

##
-## @Globals SPELL_SIGNATURE DOWNLOAD_SIGNATURE
-function query_spell_signature(){
-if [[ $SPELL_SIGNATURE ]] &&
- ! query "Is $SPELL_SIGNATURE the proper signature key url?" y; then
- query_msg "Please enter the url of the signature key:"
- read "SPELL_SIGNATURE"
-fi
-if ! [[ $SPELL_SIGNATURE ]]; then
- if query "Do you want to use an upstream signature key?" n; then
- query_msg "Please enter the url of the signature key:"
- read "SPELL_SIGNATURE"
- fi
-fi
-if [[ $SPELL_SIGNATURE ]] &&
- ! [[ $DOWNLOAD_SIGNATURE ]]; then
- if query "Use downloadable upstream signature key?" y; then
- DOWNLOAD_SIGNATURE="y"
- fi
-fi
-}
-
-##
## @Globals SPELL_LICENSE
function query_spell_license(){
if ! [[ $SPELL_LICENSE ]] ||
@@ -220,7 +198,7 @@ function hunt_src_dir(){
bzip2|gzip|compress*|tar) SPELL_SRC_DIR=$(tar tf
"${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | sed -n "1 s=/.*$==p") ||
{ error_msg "Error: getting path from
tarball" && return 1; } ;;
Zip) SPELL_SRC_DIR=$(zipinfo -1
"${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | sed -n "1 s=/.*$==p") ||
- { error_msg "Error: getting path from
zipfile" && return 1; }
+ { error_msg "Error: getting path from
zipfile" && return 1; }
if [[ $SPELL_SRC_DIR == "" ]] ; then

SPELL_SRC_DIR=${SPELL_NAME}-${SPELL_VERSION}
PREBUILDISON="PRE_BUILD, "
diff --git a/var/lib/quill/modules/libgpg b/var/lib/quill/modules/libgpg
new file mode 100644
index 0000000..128db52
--- /dev/null
+++ b/var/lib/quill/modules/libgpg
@@ -0,0 +1,365 @@
+#---
+## @Synopsis Tries to change the source verification in favour of upstream
gpg
+##
+## @Globals "version" "versions" SPELL_KEYRING SPELL_SIGNATURE SPELL_UPDATED
+## @Globals SPELL_NAME SPELL_VERSION
+#---
+function convert_to_upstream_gpg() {
+ local update_counter=${#versions[@]} source su i new_value new_su
new_source
+ local version_switch j l
+ if query "Do you want to do it for $version?" y; then
+ multiversion_check
+ SPELL_VERSION="$version"
+
+ get_sources_and_urls
+ i=
+ SPELL_KEYRING=
+ l=$(wc -l <<< "$sources_and_urls")
+ while [[ $l > 0 ]]; do
+ # use the original DETAILS, as we already changed the VERSION
+ current_check=$(eval ${version_switch:-:}; . DETAILS.orig &>
/dev/null; eval echo
\$SOURCE${i}_HASH\$SOURCE${i}_GPG\$SOURCE${i}_IGNORE\$\{MD5[${i:-0}]\})
+
+ read source su extras <<< $(sed -n "$l p" <<< "$sources_and_urls")
+ unset extras
+ let l-=1
+
+ if [[ -z $current_check ]]; then
+ error_msg "Missing SOURCE${i}_HASH/SOURCE${i}_GPG/SOURCE${i}_IGNORE"
+ message "Add the appropriate one to the spell!"
+ inc_src_num i
+ continue
+ fi
+
+ # skip already upstream signed sources and SOURCE_IGNORE
+ if grep -Eq "UPSTREAM_KEY|volatile|signature|unversioned" <<<
"$current_check"; then
+ message "SOURCE${i} is already upstream signed or the verification
is ignored."
+ inc_src_num i
+ continue
+ fi
+
+ if ! grep -Eq "^((sha(512|256|1)|md5):.*|[^:]*)$" <<<
"$current_check"; then
+ # probably a non-upstream SOURCE_GPG
+ if ! grep -q "gurus.gpg" <<< "$current_check"; then
+ echo "SOURCE${i}_GPG=$current_check"
+ error_msg "This looks like an upstream keyring and should be
marked as such."
+ error_msg "Probably with :UPSTREAM_KEY at the end of
$current_check."
+ echo
+ inc_src_num i
+ continue
+ fi
+ fi
+
+ guess_signature_url verbose
+ echo
+
+ j="$i"
+ inc_to_unique_src_num j
+
+ SPELL_SIGNATURE="$new_su"
+ query_spell_signature
+ while ! url_verify "$SPELL_SIGNATURE" &> /dev/null; do
+ error_msg "You entered a bad signature url!"
+ echo
+ unset SPELL_SIGNATURE
+ query_spell_signature
+ done
+ substitute_with_variables new_source "$source" {SOURCE$i} \
+ "$SPELL_NAME" {SPELL} "$SPELL_VERSION" {VERSION}
+
+ echo
+ quill_get_spell_keyring
+
+ substitute_with_variables SPELL_SIGNATURE "$su" {SOURCE${i}_URL} \
+ "$new_source" {SOURCE$j} "$SPELL_NAME" {SPELL} "$SPELL_VERSION"
{VERSION}
+
+ # two modes of new line insertion
+ # for single-versioned spells we can have the prettier one
+ # for multiversioned ones we use the safe(r), but uglier aggregate one
+ if [[ -z $version_switch ]]; then
+ # sed in the new source[j] right after source[i]
+ new_value=$(count_spaces SOURCE${j})
+ sed -i "/^\s*SOURCE$i=/
s%^.*$%&\n${new_value}SOURCE${j}=$new_source%" DETAILS
+ SPELL_UPDATED=y
+
+ # sed in the new su[j] right after su[i]
+ new_value=$(count_spaces SOURCE${j}_URL[0])
+ sed -i "/^\s*SOURCE${i}_URL\[0\]=/
s%^.*$%&\n${new_value}SOURCE${j}_URL[0]=$SPELL_SIGNATURE%" DETAILS
+
+ # ignore the signature
+ new_value=$(count_spaces SOURCE${j}_IGNORE)
+ sed -i
"s%^.*${current_check}.*$%&\n${new_value}SOURCE${j}_IGNORE=signature%" DETAILS
+
+ # finally change verification to upstream source_gpg
+ new_value=$(count_spaces SOURCE${i}_GPG)
+ sed -i
"s%^.*${current_check}.*$%${new_value}SOURCE${i}_GPG=$SPELL_KEYRING:\$SOURCE$j:UPSTREAM_KEY%"
DETAILS
+
+ # SOURCE must be first since others reference it
+ # compare line numbers and move the vars if necessary
+ local s_ln su_ln sgpg_ln
+ s_ln=$(sed -n "/^\s*SOURCE$j=$new_source/=" DETAILS)
+ sgpg_ln=$(sed -n
"/^\s*SOURCE${i}_GPG=$SPELL_KEYRING:\$SOURCE$j:UPSTREAM_KEY/=" DETAILS)
+ if (( $s_ln > $sgpg_ln )); then
+ sed -i "$sgpg_ln{ x;d }; $s_ln G" DETAILS
+ si_ln=$(sed -n "/^\s*SOURCE${j}_IGNORE=signature/=" DETAILS)
+ s_ln=$(sed -n "/^\s*SOURCE$j=$new_source/=" DETAILS)
+ sed -i "$si_ln{ x;d }; $s_ln G" DETAILS
+ s_ln=$(sed -n "/^\s*SOURCE$j=$new_source/=" DETAILS)
+ fi
+ su_ln=$(sed -n "/^\s*SOURCE${j}_URL[^=]*=$SPELL_SIGNATURE/=" DETAILS)
+ if (( $s_ln > $su_ln )); then
+ sed -i "$su_ln{ x;d }; $s_ln G" DETAILS
+ fi
+ else
+ # sed in the new source[j] before $current_check
+ new_value=$(count_spaces SOURCE${j})
+ sed -i
"s%^.*${current_check}.*$%${new_value}SOURCE${j}=$new_source\n&%" DETAILS
+ SPELL_UPDATED=y
+
+ # sed in the new su[j] right after source[j] (before $current_check)
+ new_value=$(count_spaces SOURCE${j}_URL[0])
+ sed -i
"s%^.*${current_check}.*$%${new_value}SOURCE${j}_URL[0]=$SPELL_SIGNATURE\n&%"
DETAILS
+
+ # ignore the signature after $current_check
+ new_value=$(count_spaces SOURCE${j}_IGNORE)
+ sed -i
"s%^.*${current_check}.*$%&\n${new_value}SOURCE${j}_IGNORE=signature%" DETAILS
+
+ # finally change verification to upstream source_gpg
+ new_value=$(count_spaces SOURCE${i}_GPG)
+ sed -i
"s%^.*${current_check}.*$%${new_value}SOURCE${i}_GPG=$SPELL_KEYRING:\$SOURCE$j:UPSTREAM_KEY%"
DETAILS
+ fi
+
+ inc_src_num i
+ done
+
+ [[ $SPELL_UPDATED == n ]] && return 0
+
+ add_history_entries "DETAILS: converted to upstream signature checking"
+ echo
+
+ # ugly, but avoids excessive suing
+ if query "Do you want to try if the new verification system works?" y;
then
+ get_sources_and_urls
+ SOURCE_DIRECTORY=$(conditional_get_var SOURCE_DIRECTORY)
+ codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
+ $QUILL_SUDO -c ". /etc/sorcery/config; . $QUILL_MODULES/libcore;
+ . $QUILL_MODULES/libcopy; . $QUILL_MODULES/libupdate
+ SPELL_NAME=$SPELL_NAME; QUILL_SPELL_DIR=$QUILL_SPELL_DIR
+ get_sources_and_urls
+ SOURCE_DIRECTORY=$(conditional_get_var SOURCE_DIRECTORY)
+ codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
+ summon_sources || exit 1
+ quill_final_put_in_grimoire $GRIMOIRE $SECTION no
+ delve -c start PRE_BUILD $SPELL_NAME; rc=\$?
+ rm -r $SOURCE_DIRECTORY
+ if [[ \$rc == 0 ]]; then
+ message "Succes!"
+ else
+ error_msg "Failed!"
+ fi
+ sleep 2"
+ fi
+
+ else
+ let update_counter-=1
+ fi
+ [[ $update_counter == 0 ]] && continue 2 # there were no updates
+
+}
+
+#---
+## @Synopsis guesses signature urls from the source url
+##
+## @param silent - silent to print nothing
+##
+## @return 0 if a guess is a valid url
+## @return 1 otherwise
+##
+## @Globals "i" "su" "source"
+function guess_signature_url() {
+ local suffix silent=$1
+
+ [[ $silent != silent ]] && message -n "Trying to guess the signature url
for SOURCE$i ... "
+ for suffix in sig asc sign; do
+ if url_verify "$su.$suffix" &> /dev/null; then
+ new_su="$su.$suffix"
+ new_source="$source.$suffix"
+ [[ $silent != silent ]] && message "Succes!"
+ return 0
+ fi
+ done
+ [[ $silent != silent ]] && message "Failed."
+ return 1
+}
+
+#---
+## @Synopsis sets up SPELL_KEYRING, either from an exsisting or from
+## @Synopsis a remote one
+##
+## @Globals SPELL_KEYRING QUILL_MODE QUILL_SPELL_DIR SPELL_NAME
+## @Globals QUILL_TMP_DIR
+function quill_get_spell_keyring() {
+ # return if a previous pass already set it
+ [[ -n $SPELL_KEYRING ]] && return 0
+
+ if query "Is the appropriate keyring already in the grimoire?" n; then
+ # list them as suggestions
+ codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
+ case $QUILL_MODE in
+ apprentice)
+ message "Here is a list of grimoire level keyrings:"
+ find $GRIMOIRE -maxdepth 1 -iname "*.gpg" -printf "%P\n" ;;
+ mage)
+ message "Here is a list of grimoire and section level keyrings:"
+ find $GRIMOIRE -maxdepth 2 -iname "*.gpg" -printf "%P\n" ;;
+ wizard)
+ message "Here is a list of all keyrings:"
+ find $GRIMOIRE -iname "*.gpg" -printf "%P\n" ;;
+ esac | grep -v gurus.gpg | column
+ shopt -s nullglob
+ query_string SPELL_KEYRING "Which of the above is the correct keyring? "
*.gpg
+ shopt -u nullglob
+
+ local kr_path=$(dirname $SPELL_KEYRING)
+ if [[ $QUILL_MODE != apprentice && $kr_path != "." ]]; then
+ if [[ $kr_path != $SECTION && $kr_path != $SECTION/$SPELL_NAME ]]; then
+ message "Copying the keyring to the spell dir as it is not a
grimoire"
+ message "level one, from the same section nor from the same spell!\n"
+ cp $GRIMOIRE/$SPELL_KEYRING "$QUILL_SPELL_DIR/$SPELL_NAME"
+ fi
+ SPELL_KEYRING=$(basename $SPELL_KEYRING)
+ fi
+ unset GRIMOIRE SECTION GRIMOIRE_NAME SECTION_DIRECTORY
+ else
+ # get a hint from the failed verification
+ message "Creating a keyring from the key that made the signature ..."
+ $QUILL_SUDO -c "wget -nc -P $SOURCE_CACHE $SPELL_SIGNATURE"
+ # get the key id, reuse a var
+ SPELL_KEYRING=$(gpg --verify $SOURCE_CACHE/${SPELL_SIGNATURE##*/} 2>&1 |
sed -n 's,^.* key ID ,,p')
+
+ # create the keyring
+ gpg --no-default-keyring --keyring
$QUILL_SPELL_DIR/$SPELL_NAME/$SPELL_NAME.gpg --recv-keys $SPELL_KEYRING
+ SPELL_KEYRING=$SPELL_NAME.gpg
+
+ if query "Is there a more complete keyring available?" y; then
+ rm $QUILL_SPELL_DIR/$SPELL_NAME/$SPELL_NAME.gpg
+ unset SPELL_KEYRING
+ query_spell_keyring
+ while ! url_verify "$SPELL_KEYRING" &> /dev/null; do
+ error_msg "You entered a bad keyring url!"
+ unset SPELL_KEYRING
+ query_spell_keyring
+ done
+ wget -nc -P $QUILL_SPELL_DIR/$SPELL_NAME/ "$SPELL_KEYRING"
+ SPELL_KEYRING=$(basename "$SPELL_KEYRING")
+ fi
+ rm $QUILL_SPELL_DIR/$SPELL_NAME/*.gpg~
+ add_history_entry "$SPELL_KEYRING: added gpg keyring"
+ fi
+
+}
+
+##
+## @Globals SPELL_SIGNATURE
+function query_spell_signature(){
+ if [[ $SPELL_SIGNATURE ]] &&
+ ! query "Is $SPELL_SIGNATURE the proper signature url?" y; then
+ query_msg "Please enter the url of the signature:"
+ read "SPELL_SIGNATURE"
+ fi
+ while ! [[ $SPELL_SIGNATURE ]]; do
+ query_msg "Please enter the url of the signature:"
+ read "SPELL_SIGNATURE"
+ done
+}
+
+##
+## @Globals SPELL_KEYRING
+function query_spell_keyring(){
+ while ! [[ $SPELL_KEYRING ]]; do
+ query_msg "Please enter the url of the keyring:"
+ read "SPELL_KEYRING"
+ done
+}
+
+#---
+## @Synopsis Unexpands SOURCE_GPG if necessary to be later able to match it
+##
+## @Globals "current_check" "version_switch"
+##
+## @return 0 if current_check was found
+## @return 1 otherwise
+#---
+function unexpand_source_gpg()
+{
+ local j
+
+ if grep -q "$current_check" DETAILS.orig
+ then
+ return 0
+ else # looks like it is expanded
+ current_check=$(
+ eval ${version_switch:-:}; . DETAILS.orig &> /dev/null;
+ for j in `get_source_nums s`
+ do
+ j="${j%s}"
+ SOURCE=$(eval echo \$SOURCE$j)
+ substitute_with_variables current_check "$SOURCE" {SOURCE$j}
+ done
+ substitute_with_variables current_check "$SPELL_NAME" {SPELL} "$VERSION"
{VERSION}
+ echo $current_check
+ )
+ fi
+ if grep -q "$current_check" DETAILS.orig
+ then # maybe the author doesn't like the ugly braces too
+ return 0
+ else
+ current_check="$(tr -d "{}" <<< "$current_check")"
+ fi
+ if grep -q "$current_check" DETAILS.orig
+ then
+ return 0
+ else # give up
+ error_msg "Giving up, you'll have to update SOURCE${i}_(GPG|HASH)
yourself."
+ return 1
+ fi
+}
+
+#---
+## @Synopsis Removes unneeded sigs
+##
+## @param old version
+## @Globals none
+#---
+function remove_old_sigs()
+{
+ local version="$1" files
+ if ! grep -q "VERSION=$version *$" DETAILS;
+ then
+ # compgen has a plain wierd output
+ # lynx wants interactivity and no 404s
+ # the glob could expand to more than one file, so test -e could break
+ files=$(compgen -G "*$version*.sig" | tr '\n' ' ')
+ files="$files $(compgen -G "*$version*.asc" | tr '\n' ' ')"
+ files="$files $(compgen -G "*$version*.sign" | tr '\n' ' ')"
+ [[ $files != " " ]] && rm -i $files
+ fi
+
+}
+
+#---
+##
+## 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
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---
diff --git a/var/lib/quill/modules/libupdate b/var/lib/quill/modules/libupdate
index aa9fa68..aaac6a0 100644
--- a/var/lib/quill/modules/libupdate
+++ b/var/lib/quill/modules/libupdate
@@ -17,9 +17,9 @@ function get_sources_and_urls()
##
## @Globals "version_switch"
#---
-function conditional_set_var()
+function conditional_get_var()
{
- eval ${version_switch:-:}; . DETAILS &> /dev/null; eval echo -n \$$1
+ ( eval ${version_switch:-:}; . DETAILS &> /dev/null; eval echo -n \$$1 )
}

#---
@@ -35,7 +35,7 @@ function conditional_set_var()
#---
function update_patchlevel()
{
- local current_value=$(conditional_set_var $1)
+ local current_value=$(conditional_get_var $1)

if [[ -z $current_value ]]
then
@@ -101,70 +101,6 @@ function count_spaces()
}

#---
-## @Synopsis Removes unneeded sigs
-##
-## @param old version
-## @Globals none
-#---
-function remove_old_sigs()
-{
- local version="$1" files
- if ! grep -q "VERSION=$version *$" DETAILS;
- then
- # compgen has a plain wierd output
- # lynx wants interactivity and no 404s
- # the glob could expand to more than one file, so test -e could break
- files=$(compgen -G "*$version*.sig" | tr '\n' ' ')
- files="$files $(compgen -G "*$version*.asc" | tr '\n' ' ')"
- [[ $files != " " ]] && rm -i $files
- fi
-
-}
-
-#---
-## @Synopsis Unexpands SOURCE_GPG if necessary to be later able to match it
-##
-## @Globals "current_check" "version_switch"
-##
-## @return 0 if current_check was found
-## @return 1 otherwise
-#---
-function unexpand_source_gpg()
-{
- local j
-
- if grep -q "$current_check" DETAILS.orig
- then
- return 0
- else # looks like it is expanded
- current_check=$(
- eval ${version_switch:-:}; . DETAILS.orig &> /dev/null;
- for j in `get_source_nums s`
- do
- j="${j%s}"
- SOURCE=$(eval echo \$SOURCE$j)
- substitute_with_variables current_check "$SOURCE" {SOURCE$j}
- done
- substitute_with_variables current_check "$SPELL_NAME" {SPELL} "$VERSION"
{VERSION}
- echo $current_check
- )
- fi
- if grep -q "$current_check" DETAILS.orig
- then # maybe the author doesn't like the ugly braces too
- return 0
- else
- current_check="$(tr -d "{}" <<< "$current_check")"
- fi
- if grep -q "$current_check" DETAILS.orig
- then
- return 0
- else # give up
- error_msg "Giving up, you'll have to update SOURCE${i}_(GPG|HASH)
yourself."
- return 1
- fi
-}
-
-#---
## @Synopsis Checks if the spell is multiversioned and sets the delimiter
## @Synopsis variable (version_switch) if it is
##
@@ -205,10 +141,11 @@ function user_increment_patchlevel() {
## @Synopsis The core function that ties all the version update stuff
##
## @Globals SPELL_VERSION SPELL_UPDATED GURU_GPGKEY QUILL_SPELL_DIR "version"
+## @Globals "versions"
#---
function version_bump() {
local update_counter="${#versions[@]}" version_switch
- local to_summon sources_and_urls sources source_urls source
+ local sources_and_urls sources source_urls source
local hash current_check i new_value
if query "Do you want to update $version?" y; then
query_spell_version
@@ -231,24 +168,11 @@ function version_bump() {
get_sources_and_urls
echo

- message "Summoning ..."
- #download; we are not a grimoire so some hacking is needed
- # also workaround sorcery bug #13412
- to_summon="$sources_and_urls"
- for source in $sources; do
- [[ -e $SOURCE_CACHE/$source ]] &&
- to_summon="$(sed "/^$source /d" <<< "$to_summon")"
- done
- if [[ -z $to_summon ]]; then
- message "Nothing new to summon, all sources found."
- else
- if ! summon -r <<< "$to_summon"; then
- error_msg "Summoning failed, aborting update!"
- query "Do you want to edit DETAILS? (you can retry the update)" n &&
quill_edit DETAILS
- continue 2
- fi
- fi
- echo
+# do the silent check for gpg
+# if succesful then convert
+# else continue
+
+ summon_sources

#update HISTORY - already here, so that the patchlevels come later
add_history_entries "DETAILS: updated ${version_switch:-spell} to
$SPELL_VERSION"
@@ -273,26 +197,30 @@ function version_bump() {
if [[ -z $current_check ]]; then
error_msg "Missing SOURCE${i}_HASH/SOURCE${i}_GPG/SOURCE${i}_IGNORE"
message "Add the appropriate one to the spell!"
- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
continue
fi

#skip SOURCE_IGNORE
if grep -Eq "volatile|signature|unversioned" <<< "$current_check"; then
- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
continue
fi

+ # plug in the ad for upstream sigs if valid urls were found
+ local su=$(sed -n "s,^$source ,,p" <<< "$sources_and_urls")
+ guess_signature_url silent &&
+ message "${MESSAGE_COLOR}Cool! It looks like this spell would easily
be" &&
+ message "converted to upstream signing. Please choose that option
from" &&
+ message "the menu once this update finishes.$DEFAULT_COLOR"
+
# 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
+ inc_src_num i
continue
fi

@@ -300,8 +228,7 @@ function version_bump() {
if grep -Eq "(^(sha(512|256|1)|md5):.*|UPSTREAM_KEY)" <<<
"$current_check"; then
# UPSTREAM_HASH is rare and probably not fetched - ignoring
if grep -q "UPSTREAM_KEY" <<< "$current_check"; then
- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
continue
fi
# otherwise just do nothing, SOURCE_HASH handling comes next
@@ -319,8 +246,7 @@ function version_bump() {
echo
remove_old_sigs "$version"

- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
continue
fi
fi
@@ -328,8 +254,7 @@ function version_bump() {
# it is either a SOURCE_HASH or the user wants to replace SOURCE_GPG
# SOURCE_GPG usually has unexpanded variables, while we have the
expanded
unexpand_source_gpg || {
- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
continue; }


@@ -340,8 +265,7 @@ function version_bump() {
# remove sigs, trying not to touch any that are still needed
remove_old_sigs "$version"

- [[ ! $i ]] && i=1
- let i+=1
+ inc_src_num i
done

echo
diff --git a/var/lib/quill/version b/var/lib/quill/version
index d278023..182e69a 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.6-rc2
+0.2.6-rc5



  • [SM-Commit] GIT changes to master quill by Jaka Kranjc (d03a86663d789c7cabae192e1c844d011004c04d), Jaka Kranjc, 05/04/2007

Archive powered by MHonArc 2.6.24.

Top of Page