Skip to Content.
Sympa Menu

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

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 (dce5f09ff083cca6a2f109d8d899378b37eda97c)
  • Date: Sun, 8 Jul 2007 15:14:28 -0500

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

var/lib/quill/ChangeLog | 10 ++
var/lib/quill/modules/libcore | 135
++++++++++++++++++++--------------------
var/lib/quill/modules/libgpg | 48 ++++++++++----
var/lib/quill/modules/libupdate | 3
var/lib/quill/version | 2
5 files changed, 119 insertions(+), 79 deletions(-)

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

* libcore: added complete mirror support to check_source_urls
* libgpg: added mirror support (single version spells only)
made query_spell_signature accept 'skip' to skip converting a source
fixed some keyfile naming
made the converter traverse the sources in consistent ascending
order
* libupdate: made source_urls an array

Need to find some spells with mirrors, as the mirror support isn't tested
yet.
Converting casual spells to gpg still works and works better, snort is my
proof :)

diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index ba9d939..106a105 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,7 +1,17 @@
+2007-07-08 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcore: added complete mirror support to check_source_urls
+ * libgpg: added mirror support (single version spells only)
+ made query_spell_signature accept 'skip' to skip converting a source
+ fixed some keyfile naming
+ made the converter traverse the sources in consistent ascending
order
+ * libupdate: made source_urls an array
+ * version: 0.2.6-rc9
+
2007-06-30 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* quill: fixed local varibles and synced 13001 workaround
* libgpg: added import-minimal to the key generator
fixed success typos
+ made the new keyrings be named after their key
* version: 0.2.6-rc8

2007-05-06 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index 789ed32..7092ab1 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -243,87 +243,90 @@ function quill_purge() {
## @Globals SPELL_VERSION SPELL_NAME "source_urls" "sources_and_urls"
"version"
#---
function check_source_urls() {
- local i= su old_su oldest_su source old_source rc
+ local su old_su oldest_su source old_source rc i source_num

message "Checking source urls (this may take a while) ..."
- for su in $source_urls
+ for ((source_num=0; source_num < ${#source_urls[@]}; source_num++))
do
- if url_verify "$su" > /dev/null
- then
- message "SOURCE${i}_URL[0] is ok!"
- rc=0
- else
- # first retry with a changed suffix
- old_su="$su"
- [[ ${su/.gz/.bz2} == $su ]] && su="${su/.bz2/.gz}" ||
su="${su/.gz/.bz2}"
+ for su in ${source_urls[$source_num]}
+ do
if url_verify "$su" > /dev/null
then
- message "SOURCE${i}_URL[0] is ok after changing the file extension!"
- # tricky tricky - if we only change the url, it is likely
- # that the accompanying SOURCE will be bad. So we need to change
- # SOURCEn too. Or just that, if the url contains it as a variable
-
- # try to unexpanded the url - maybe changing the source is enough
- old_source=$(sed -n "s, $old_su,,p" <<< "$sources_and_urls")
- source="$old_source"
- if [[ ${source/.gz/.bz2} == $source ]]
- then
- source="${source/.bz2/.gz}"
- else
- source="${source/.gz/.bz2}"
- fi
-
- # we need another one since $old_source would match only $old_su
- # and we also need the substituted $old_su
- oldest_su="$old_su"
- substitute_with_variables old_su "$old_source" {SOURCE$i}
- if grep -Eq "\.(bz2|gz)$" <<< "$old_su"
+ message "SOURCE${i}_URL[$source_num] is ok!"
+ rc=0
+ else
+ # first retry with a changed suffix
+ old_su="$su"
+ [[ ${su/.gz/.bz2} == $su ]] && su="${su/.bz2/.gz}" ||
su="${su/.gz/.bz2}"
+ if url_verify "$su" > /dev/null
then
- # the url most likely does not use SOURCE then
- # however if it does, lets put the substitutions in anyway
- # so we change the url in the file; reparsing is the next call
- # also check if it contains the old expanded VERSION ($version)
-
- # substitute the longer string first, more likely to give correct
results
- # think 1.2 and 1.2.1
- if (( ${#SPELL_VERSION} > ${#version} ))
+ message "SOURCE${i}_URL[$source_num] is ok after changing the file
extension!"
+ # tricky tricky - if we only change the url, it is likely
+ # that the accompanying SOURCE will be bad. So we need to change
+ # SOURCEn too. Or just that, if the url contains it as a variable
+
+ # try to unexpanded the url - maybe changing the source is enough
+ old_source=$(sed -n "s, $old_su .*,,p" <<< "$sources_and_urls")
+ source="$old_source"
+ if [[ ${source/.gz/.bz2} == $source ]]
then
- substitute_with_variables su "$old_source" {SOURCE$i}
"$SPELL_NAME" {SPELL} "$SPELL_VERSION" {VERSION} "$version" {VERSION}
+ source="${source/.bz2/.gz}"
else
- substitute_with_variables su "$old_source" {SOURCE$i}
"$SPELL_NAME" {SPELL} "$version" {VERSION} "$SPELL_VERSION" {VERSION}
+ source="${source/.gz/.bz2}"
fi

- # some urls may contain other expanded vars that we are not aware
of
- if grep -q "$oldest_su" DETAILS
- then # all is fine
- sed -i "s,$oldest_su,$su," DETAILS
+ # we need another one since $old_source would match only $old_su
+ # and we also need the substituted $old_su
+ oldest_su="$old_su"
+ substitute_with_variables old_su "$old_source" {SOURCE$i}
+ if grep -Eq "\.(bz2|gz)$" <<< "$old_su"
+ then
+ # the url most likely does not use SOURCE then
+ # however if it does, lets put the substitutions in anyway
+ # so we change the url in the file; reparsing is the next call
+ # also check if it contains the old expanded VERSION ($version)
+
+ # substitute the longer string first, more likely to give
correct results
+ # think 1.2 and 1.2.1
+ if (( ${#SPELL_VERSION} > ${#version} ))
+ then
+ substitute_with_variables su "$old_source" {SOURCE$i}
"$SPELL_NAME" {SPELL} "$SPELL_VERSION" {VERSION} "$version" {VERSION}
+ else
+ substitute_with_variables su "$old_source" {SOURCE$i}
"$SPELL_NAME" {SPELL} "$version" {VERSION} "$SPELL_VERSION" {VERSION}
+ fi
+
+ # some urls may contain other expanded vars that we are not
aware of
+ if grep -q "$oldest_su" DETAILS
+ then # all is fine
+ sed -i "s,$oldest_su,$su," DETAILS
+ else
+ error_msg "Couldn't find $oldest_su in DETAILS,"
+ error_msg "probably due to it containing nonstandard variables"
+ message "Replace it manually with $su"
+ fi
+ add_history_entry "DETAILS: Changed SOURCE${i}_URL[$source_num]
extension"
else
- error_msg "Couldn't find $oldest_su in DETAILS,"
- error_msg "probably due to it containing nonstandard variables"
- message "Replace it manually with $su"
+ substitute_with_variables source "$SPELL_NAME" {SPELL}
"$SPELL_VERSION" {VERSION}
+ sed -i "s,$old_source,$source," DETAILS
+ # we don't know if the SOURCE is expanded or not, trying just
both extremes
+ substitute_with_variables old_source "$SPELL_NAME" {SPELL}
"$SPELL_VERSION" {VERSION}
+ sed -i "s,$old_source,$source," DETAILS
+ # and with the beautiful syntax last
+ old_source="$(tr -d "{}" <<< "$old_source")"
+ sed -i "s,$old_source,$source," DETAILS
+ add_history_entry "DETAILS: Changed SOURCE${i} extension"
fi
- add_history_entry "DETAILS: Changed SOURCE${i}_URL[0] extension"
+ rc=0
else
- substitute_with_variables source "$SPELL_NAME" {SPELL}
"$SPELL_VERSION" {VERSION}
- sed -i "s,$old_source,$source," DETAILS
- # we don't know if the SOURCE is expanded or not, trying just both
extremes
- substitute_with_variables old_source "$SPELL_NAME" {SPELL}
"$SPELL_VERSION" {VERSION}
- sed -i "s,$old_source,$source," DETAILS
- # and with the beautiful syntax last
- old_source="$(tr -d "{}" <<< "$old_source")"
- sed -i "s,$old_source,$source," DETAILS
- add_history_entry "DETAILS: Changed SOURCE${i} extension"
+ # if they are still not ok ask for fixed ones
+ error_msg "SOURCE${i}_URL[$source_num] is hopelessly broken! Fix
it manually."
+ sleep 2
+ quill_edit DETAILS
+ add_history_entry "DETAILS: Fixed SOURCE${i}_URL[$source_num]"
+ rc=1
fi
- rc=0
- else
- # if they are still not ok ask for fixed ones
- error_msg "SOURCE${i}_URL[0] is hopelessly broken! Fix it manually."
- sleep 2
- quill_edit DETAILS
- add_history_entry "DETAILS: Fixed SOURCE${i}_URL[0]"
- rc=1
fi
- fi
+ done
inc_src_num i
done
return $rc
diff --git a/var/lib/quill/modules/libgpg b/var/lib/quill/modules/libgpg
index ad5f970..5f7fef6 100644
--- a/var/lib/quill/modules/libgpg
+++ b/var/lib/quill/modules/libgpg
@@ -6,22 +6,23 @@
#---
function convert_to_upstream_gpg() {
local update_counter=${#versions[@]} source su i new_value new_su
new_source
- local version_switch j l
+ local version_switch j ll ll_max mirrors
if query "Do you want to do it for $version?" y; then
multiversion_check
SPELL_VERSION="$version"

get_sources_and_urls
+#echo -e "---\n${source_urls[@]}\n---"
i=
SPELL_KEYRING=
- l=$(wc -l <<< "$sources_and_urls")
- while [[ $l > 0 ]]; do
+ ll_max=$(wc -l <<< "$sources_and_urls")
+ for (( ll=1; ll <= $ll_max; ll++ )); 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
+ read source su mirrors <<< $(sed -n "$ll p" <<< "$sources_and_urls")
+#echo "$source --- $su --- $mirrors"
+# let ll-=1

if [[ -z $current_check ]]; then
error_msg "Missing SOURCE${i}_HASH/SOURCE${i}_GPG/SOURCE${i}_IGNORE"
@@ -57,6 +58,7 @@ function convert_to_upstream_gpg() {

SPELL_SIGNATURE="$new_su"
query_spell_signature
+ [[ $SPELL_SIGNATURE == skip ]] && continue
while ! url_verify "$SPELL_SIGNATURE" &> /dev/null; do
error_msg "You entered a bad signature url!"
echo
@@ -110,6 +112,30 @@ function convert_to_upstream_gpg() {
if (( $s_ln > $su_ln )); then
sed -i "$su_ln{ x;d }; $s_ln G" DETAILS
fi
+
+
+
+ # now that the order is pretty much fine, add any other mirrors
+ local mirror_url suffix k=$(wc -w <<< "$mirrors")
+
+ if [[ $k != 0 ]]; then
+ # get the suffix that was used from new_source
+ suffix="${new_source##*.}"
+
+ # traverse over mirror numbers in reverse, so mirrors end up
+ # ordered ascendingly, since we're adding them at a fixed location
+ for mirror_url in $mirrors; do
+ if url_verify "$mirror_url.$suffix" > /dev/null; then
+ # add it after original, first su
+ new_value=$(count_spaces SOURCE${j}_URL[$k])
+ sed -i "/^\s*SOURCE${i}_URL\[0\]=/
s%^.*$%&\n${new_value}SOURCE${i}_URL[$k]=$mirror_url.$suffix%" DETAILS
+ fi
+ let k-=1
+ done
+ fi
+
+
+
else
# sed in the new source[j] before $current_check
new_value=$(count_spaces SOURCE${j})
@@ -134,12 +160,12 @@ function convert_to_upstream_gpg() {

[[ $SPELL_UPDATED == n ]] && return 0

+ echo
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;
@@ -240,10 +266,10 @@ function quill_get_spell_keyring() {
gpg --import-options import-minimal --no-default-keyring --keyring \
$QUILL_SPELL_DIR/$SPELL_NAME/$SPELL_KEYRING.gpg --recv-keys
$SPELL_KEYRING

- SPELL_KEYRING=$SPELL_NAME.gpg
+ SPELL_KEYRING=$SPELL_KEYRING.gpg

if query "Is there a more complete keyring available?" y; then
- rm $QUILL_SPELL_DIR/$SPELL_NAME/$SPELL_NAME.gpg
+ rm $QUILL_SPELL_DIR/$SPELL_NAME/$SPELL_KEYRING
unset SPELL_KEYRING
query_spell_keyring
while ! url_verify "$SPELL_KEYRING" &> /dev/null; do
@@ -270,7 +296,7 @@ function query_spell_signature(){
read "SPELL_SIGNATURE"
fi
while ! [[ $SPELL_SIGNATURE ]]; do
- query_msg "Please enter the url of the signature:"
+ query_msg "Please enter the url of the signature or 'skip' to skip this
source:"
read "SPELL_SIGNATURE"
done
}
@@ -295,7 +321,7 @@ function query_spell_keyring(){
#---
function upstream_gpg_ad() {
# plug in the ad for upstream sigs if valid urls were found
- local su=$(sed -n "s,^$source ,,p" <<< "$sources_and_urls")
+ local su=$(sed -n "s,^$source \(\S*\) .*$,\1,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" &&
diff --git a/var/lib/quill/modules/libupdate b/var/lib/quill/modules/libupdate
index f6faf39..e368a32 100644
--- a/var/lib/quill/modules/libupdate
+++ b/var/lib/quill/modules/libupdate
@@ -8,7 +8,8 @@ function get_sources_and_urls()
{
sources_and_urls=$(eval ${version_switch:-:}; . DETAILS &> /dev/null;
get_spell_files_and_urls)
sources=$(cut -d" " -f1 <<< "$sources_and_urls")
- source_urls=$(cut -d" " -f2 <<< "$sources_and_urls")
+ source_urls=()
+ explode "$(cut -d" " -f2- <<< "$sources_and_urls")" $'\n' source_urls
}

#---
diff --git a/var/lib/quill/version b/var/lib/quill/version
index ae5393f..33395cd 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.6-rc8
+0.2.6-rc9



  • [SM-Commit] GIT changes to master quill by Jaka Kranjc (dce5f09ff083cca6a2f109d8d899378b37eda97c), Jaka Kranjc, 07/08/2007

Archive powered by MHonArc 2.6.24.

Top of Page