Skip to Content.
Sympa Menu

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

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 (153b855be51deee416df5e1eceac940fb7127069)
  • Date: Tue, 23 Jan 2007 16:12:31 -0600

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

usr/bin/quill | 69
++++++++++++++++------------------------
var/lib/quill/ChangeLog | 7 ++++
var/lib/quill/modules/libupdate | 66 +++++++++++++++++++++++++++++++++++++-
3 files changed, 99 insertions(+), 43 deletions(-)

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

* libupdate: use find -regex instead of find and grep
fixed count_spaces for unusual files by making it do statistics
factored out remove_old_sigs and unexpand_source_gpg from quill
* quill: added gpg signing support

diff --git a/usr/bin/quill b/usr/bin/quill
index 59e2cd4..69527b5 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -211,7 +211,7 @@ then
# check that (usually new) source urls are ok
check_source_urls

- #reparse the possibly new source urls and company
+ # reparse the possibly new source urls and company
get_sources_and_urls
echo

@@ -261,7 +261,7 @@ then
if [[ -z $current_check ]]
then
error_msg "Missing
SOURCE${i}_HASH/SOURCE${i}_GPG/SOURCE${i}_IGNORE"
- message "Add the appropriate one!"
+ message "Add the appropriate one to the spell!"
[[ ! $i ]] && i=1
let i+=1
continue
@@ -276,52 +276,45 @@ then
fi

#SOURCE_GPG?
- if ! grep -Eq "(^(sha(512|256|1)|md5):.*|UPSTREAM_KEY)" <<<
"$current_check"
- then #it is a non-upstream gpg
- echo "SOURCE${i}_GPG=$current_check"
- if ! query "Do you want to replace SOURCE${i}_GPG with a
hash?" n
+ 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
- #TODO: else sign it and continue
[[ ! $i ]] && i=1
let i+=1
continue
fi
+ # otherwise just do nothing, SOURCE_HASH handling comes next
else
- # UPSTREAM_HASH is rare and probably not fetched - ignoring
- if grep -q "UPSTREAM_KEY" <<< "$current_check"
+ #it is a non-upstream gpg
+ echo "SOURCE${i}_GPG=$current_check"
+ if ! grep -q "gurus.gpg" <<< "$current_check"
+ then
+ error_msg "This looks like an upstream keyring and should
be marked as such."
+ error_msg "Probably with :UPSTREAM_KEY at the end of the
$current_check."
+ error_msg "Do not replace it!"
+ fi
+ if ! query "Do you want to replace SOURCE${i}_GPG with a
hash?" n
then
+ # sign it and continue
+ gpg -v --digest-algo SHA512 -o
$QUILL_SPELL_DIR/$SPELL_NAME/$source.sig --detach-sign $SOURCE_CACHE/$source
+ echo
+ remove_old_sigs "$version"
+
[[ ! $i ]] && i=1
let i+=1
continue
fi
fi

+ # 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
- if ! grep -q $current_check DETAILS.orig
- then # looks like it is expanded
- current_check=$(
- eval ${if_var:-:}; . 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
- current_check="$(tr -d "{}" <<< $current_check)"
- fi
- if ! grep -q $current_check DETAILS.orig
- then # give up
- error_msg "Giving up, you'll have to update
SOURCE${i}_(GPG|HASH) yourself."
- [[ ! $i ]] && i=1
- let i+=1
- continue
- fi
+ unexpand_source_gpg || {
+ [[ ! $i ]] && i=1
+ let i+=1
+ continue; }
+

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

# remove sigs, trying not to touch any that are still needed
- if ! grep -q "VERSION=$version *$" DETAILS;
- then
- # compgen has a plain wierd output
- files=$(compgen -G "*$version*.sig" | tr '\n' ' ')
- files="$files $(compgen -G "*$version*.asc" | tr '\n' ' ')"
- [[ $files != " " ]] && rm -i $files
- fi
+ remove_old_sigs "$version"

[[ ! $i ]] && i=1
let i+=1
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index f86f9c8..c020053 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,4 +1,11 @@
2007-01-22 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libupdate: use find -regex instead of find and grep
+ fixed count_spaces for unusual files by making it do statistics
+ factored out remove_old_sigs and unexpand_source_gpg from quill
+ * quill: added gpg signing support
+ * version: 0.1.14, second 0.2 release candidate
+
+2007-01-22 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* quill: remove UPDATED if any; handle other link types nicely
added copy_to_git query when creating spells too
* libcore: moved some deletions to quill_final_put_in_grimoire, one
su less
diff --git a/var/lib/quill/modules/libupdate b/var/lib/quill/modules/libupdate
index 636798f..192dd66 100644
--- a/var/lib/quill/modules/libupdate
+++ b/var/lib/quill/modules/libupdate
@@ -76,13 +76,14 @@ function update_patchlevel_sub()

#---
## @Synopsis Compute how to insert $1, so = will be aligned properly
+## @Synopsis it finds the most used = position
##
## @return string with adequate number of spaces
#---
function count_spaces()
{
local count spaces eq_col
- eq_col=$(awk -F '=' '{ print length($1); exit}' DETAILS)
+ eq_col=$(awk -F '=' '{ print length($1); exit}' DETAILS | sort | uniq -c |
sort -n | sed -n '$ s,^\s*\S*\s,,p')
count=$(( $eq_col - ${#1} ))
for (( i=0 ; i<$count; i++ )) ; do
spaces="$spaces "
@@ -104,7 +105,7 @@ function copy_git_sub()

# find where under $QUILL_GIT_DIR the spell actually is
# perhaps the section path is /home/navaden/sorcery/git/gnome1-libs
- SECTION2=$(find "$QUILL_GIT_DIR" -name $SPELL_NAME -type d -printf "%h\n"|
grep "${QUILL_GIT_DIR%/}/[^/]*/[^/]*$")
+ SECTION2=$(find "$QUILL_GIT_DIR" -regex
"${QUILL_GIT_DIR%/}/[^/]*/[^/]*/$SPELL_NAME$" -type d -printf "%h\n")
if [[ -z $SECTION2 ]]
then
error_msg "Couldn't find the spell, \$QUILL_GIT_DIR is probably bad!"
@@ -149,6 +150,67 @@ function copy_from_git()
}

#---
+## @Synopsis Removes unneeded sigs
+##
+## @param old version
+#---
+function remove_old_sigs()
+{
+ local version="$1"
+ 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
+##
+## @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 ${if_var:-:}; . 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
+}
+
+
+#---
##
## 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



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

Archive powered by MHonArc 2.6.24.

Top of Page