Skip to Content.
Sympa Menu

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

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 (656b84deef1f5d857eeea2c69324de18688a80dd)
  • Date: Tue, 23 Jan 2007 05:26:48 -0600

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

usr/bin/quill | 47 +++++--------------------
var/lib/quill/ChangeLog | 7 +++
var/lib/quill/modules/libcore | 74
+++++++++++++++++++++++++++++++++++++++-
var/lib/quill/modules/libupdate | 5 --
4 files changed, 91 insertions(+), 42 deletions(-)

New commits:
commit 656b84deef1f5d857eeea2c69324de18688a80dd
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: 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
moved some code from quill to create check_source_url{,s}
try also changing the source url suffix before bailing out

diff --git a/usr/bin/quill b/usr/bin/quill
index 77518f0..59e2cd4 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -205,39 +205,11 @@ then
query_string if_var "${QUERY_COLOR}Please enter the
appropriate variable. Example: UGU_DEVEL=y${DEFAULT_COLOR} "
fi

- #check that (usually new) source urls are ok
+ # reparse the (usually new) source urls
get_sources_and_urls

- i=
- for su in $source_urls
- do
- if ! grep -q ftp:// <<< "$su"
- then
- # the return value acrobatics make both blocks return the
same
- wget -S --spider "$su" 2>&1 | grep -q "ERROR 404"
- if [[ $? == 0 ]]
- then
- rc=1
- else
- rc=0
- fi
- else
- wget -O - -S "${su%/*}/" 2>&1 | grep -q "${su##*/}"
- rc=$?
- fi
- #echo
- #... if they are not ok ask for fixed ones
- if [[ $rc == 0 ]]
- then
- message "SOURCE${i}_URL[0] is ok!"
- else
- error_msg "SOURCE${i}_URL[0] is broken! Fix it manually."
- sleep 2
- quill_edit DETAILS
- fi
- [[ ! $i ]] && i=1
- let i+=1
- done
+ # check that (usually new) source urls are ok
+ check_source_urls

#reparse the possibly new source urls and company
get_sources_and_urls
@@ -275,6 +247,9 @@ then
# restore patchlevel
update_patchlevel PATCHLEVEL skip remove

+ # remove UPDATED if any
+ sed -i "/^\s*UPDATED=/d" DETAILS
+
#get hashes and save them, removing any previous hash/gpg
i=
for source in $sources
@@ -418,12 +393,6 @@ then
continue
fi

- if [[ -w $GRIMOIRE/$SECTION/$SPELL_NAME && -w $GRIMOIRE/$SECTION ]]
- then
- rm -r "$GRIMOIRE/$SECTION/$SPELL_NAME"
- else
- su -c "rm -r '$GRIMOIRE/$SECTION/$SPELL_NAME'"
- fi
quill_final_put_in_grimoire $GRIMOIRE $SECTION no
;;
"${actions[6]}") #"Try it out"
@@ -577,6 +546,10 @@ else
cast $SPELL_NAME
fi
fi
+ if query "Do you want to put the spell into QUILL_GIT_DIR?" n
+ then
+ copy_from_git
+ fi
fi
message "That's all folks!"

diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 9472ecf..e35707d 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,10 @@
+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
+ moved some code from quill to create check_source_url{,s}
+ try also changing the source url suffix before bailing out
+
2007-01-21 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libupdate: try harder to find the real spelldir when copying to git
* quill: ask for where to copy from when starting an update
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index f0bd360..5603400 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -196,7 +196,11 @@ function quill_final_put_in_grimoire() {
message "Copying spell into $QUILL_GRIM_NAME/$QUILL_SECT_NAME/$SPELL_NAME
..."

quill_final_put_in_grimoire_sub(){
- mkdir -p $QUILL_GRIM_NAME/$QUILL_SECT_NAME
+ mkdir -p $QUILL_GRIM_NAME/$QUILL_SECT_NAME/$SPELL_NAME
+
+ # we wipe it first, so we can handle any files that we deleted before
+ rm -r "$QUILL_GRIM_NAME/$QUILL_SECT_NAME/$SPELL_NAME"
+
cp -r $QUILL_SPELL_DIR/$SPELL_NAME $QUILL_GRIM_NAME/$QUILL_SECT_NAME/
if [[ $? != 0 ]]; then
error_msg "Copying failed!"
@@ -248,6 +252,74 @@ function quill_purge() {
}

#---
+## @Synopsis checks if spell source urls are valid
+#---
+function check_source_urls() {
+ local su i= oldsu old_source_urls="$source_urls"
+
+ for su in $source_urls
+ do
+ check_source_url "$su" "$i"
+ if [[ $? == 0 ]]
+ then
+ message "SOURCE${i}_URL[0] is ok!"
+ else
+ # first retry with a changed suffix
+ oldsu="$su"
+ [[ ${su/.gz/.bz2} == $su ]] && su="${su/.bz2/.gz}" ||
su="${su/.gz/.bz2}"
+ if check_source_url "$su" "$i"
+ then
+ message "SOURCE${i}_URL[0] is ok after changing the file extension!"
+ old_source_urls="${old_source_urls/$oldsu/$su}"
+ 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
+ fi
+ fi
+ [[ ! $i ]] && i=1
+ let i+=1
+ done
+ source_urls="$old_source_urls"
+
+}
+
+#---
+## @Synopsis checks if passed source url is valid
+##
+## @param source url
+## @param current source iterator
+##
+## @return 0 if source url either is valid or just not trivially checkable
+## @return 1 otherwise (http or ftp source url failure)
+#---
+function check_source_url() {
+ local rc su="$1" i="$2"
+
+ if grep -q ftp:// <<< "$su"
+ then
+ wget -O - -S "${su%/*}/" 2>&1 | grep -q "${su##*/}"
+ rc=$?
+ elif grep -q http:// <<< "$su"
+ then
+ # the return value acrobatics make both blocks return the same
+ wget -S --spider "$su" 2>&1 | grep -q "ERROR 404"
+ if [[ $? == 0 ]]
+ then
+ rc=1
+ else
+ rc=0
+ fi
+ else
+ message "SOURCE${i}_URL[0] is not a http or ftp link, assuming it works."
+ rc=0
+ fi
+
+ return $rc
+}
+
+#---
## @Synopsis dumps the default spell file function, taking into
## account that devel has a new spell file inheritance scheme
#---
diff --git a/var/lib/quill/modules/libupdate b/var/lib/quill/modules/libupdate
index 4623e14..636798f 100644
--- a/var/lib/quill/modules/libupdate
+++ b/var/lib/quill/modules/libupdate
@@ -123,9 +123,6 @@ function copy_to_git()
{
copy_git_sub || return 1

- # we wipe it first, so we can handle any files that we deleted before
- rm -r "$GRIMOIRE2/$SECTION2/$SPELL_NAME"/*
-
quill_final_put_in_grimoire "$GRIMOIRE2" "$SECTION2" no
unset GRIMOIRE2 SECTION2
}
@@ -139,7 +136,7 @@ function copy_from_git()

# we wipe it first, so we can handle any files that were deleted
cd $QUILL_SPELL_DIR
- rm -r "$QUILL_SPELL_DIR/$SPELL_NAME"
+ rm -rf "$QUILL_SPELL_DIR/$SPELL_NAME"

if [[ -w $QUILL_SPELL_DIR ]]
then



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

Archive powered by MHonArc 2.6.24.

Top of Page