Skip to Content.
Sympa Menu

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

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 (ae139e561bbbd810473c87ac40fea5decec3f4ba)
  • Date: Wed, 9 Aug 2006 13:54:47 -0500

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

var/lib/quill/ChangeLog | 8 ++++
var/lib/quill/modules/libcore | 6 ++-
var/lib/quill/modules/libdetails | 66
+++++++++++----------------------------
3 files changed, 32 insertions(+), 48 deletions(-)

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

* libcore: made the get_spell_source output more consistent
added check for exsisting tarball
* libdetails: removed substitute_url_variables()
moved its two calls to add_details
fixed substitute_with_mirror_variables and sped it up; try apache :D
removed check_if_tarball(), do a check in hunt_src_dir

All substitutions work now!

diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 188546e..64661df 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-09 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcore: made the get_spell_source output more consistent
+ added check for exsisting tarball
+ * libdetails: removed substitute_url_variables()
+ moved its two calls to add_details
+ fixed substitute_with_mirror_variables and sped it up; try apache :D
+ removed check_if_tarball(), do a check in hunt_src_dir
+
2006-08-07 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libdetails: first try substituting SOURCE_URL with $SOURCE
moved substitutions to add_details
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index 7c33dad..2efce62 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -17,8 +17,10 @@ #---
function get_spell_source(){
mkdir -p ${QUILL_TMP_DIR}
cd ${QUILL_TMP_DIR}
- if [[ -e $SOURCE_CACHE/$SPELL_SRC_FILE ]]; then
- message -n "Copying the spell tarball over from the sorcery cache ... "
+ if [[ -e $SPELL_SRC_FILE ]]; then
+ message "Found the spell tarball in the quill dir, continuing ..."
+ elif [[ -e $SOURCE_CACHE/$SPELL_SRC_FILE ]]; then
+ message "Found the spell tarball in the sorcery cache, copying it over
..."
cp $SOURCE_CACHE/$SPELL_SRC_FILE .
message "Done."
else
diff --git a/var/lib/quill/modules/libdetails
b/var/lib/quill/modules/libdetails
index 4a0a77a..6a9866d 100644
--- a/var/lib/quill/modules/libdetails
+++ b/var/lib/quill/modules/libdetails
@@ -122,18 +122,6 @@ fi
}

#---
-## @Synopsis Process SPELL_SRC_URL: Subsitute expanded with escaped
-## @Synopsis SOURCE, SPELL and VERSION, Substitute mirror urls with mirror
url
-## @Synopsis variables.
-#---
-function substitute_url_variables(){
- substitute_with_variables SPELL_SRC_URL "$SPELL_SRC_FILE" SOURCE \
- "$SPELL_NAME" SPELL "$SPELL_VERSION" VERSION
- substitute_with_mirror_variables SPELL_SRC_URL
- SPELL_SRC_URL="$SUBSTITUTIONS"
-}
-
-#---
## @Synopsis Substitute download mirror urls with variable names in
## @Synopsis given variable. Store resulting string in
## @Synopsis SUBSTITUTIONS. Urls and variables are parsed from contents
@@ -141,33 +129,18 @@ ## @Synopsis of /etc/sorcery/mirrors/. E
## @Synopsis substitute_with_mirror_variables SPELL_SRC_URL
#---
function substitute_with_mirror_variables(){
-if [ -n "$1" ]; then
- local TARGET_STRING="${!1}"
- local MIRROR_LIST_FILE
- local MIRROR_VARIABLE
- local MIRROR_ENTRY
- for MIRROR_LIST_FILE in $(ls /etc/sorcery/mirrors/); do
- MIRROR_VARIABLE="${MIRROR_LIST_FILE}_URL"
- for MIRROR_ENTRY in $(cat /etc/sorcery/mirrors/${MIRROR_LIST_FILE}); do
- if [[ "$MIRROR_ENTRY" =~ "://" ]]; then
- TARGET_STRING=${TARGET_STRING//$MIRROR_ENTRY/\$\{$MIRROR_VARIABLE\}}
+if [[ -n $1 ]]; then
+ local target=$1 target_value mirror_list mirror_variable mirror_entry
+ eval target_value="\$$1"
+ for mirror_list in /etc/sorcery/mirrors/*; do
+ mirror_variable="$(smgl_basename $mirror_list)_URL"
+ while read mirror_entry; do
+ if [[ $mirror_entry != "Custom" ]]; then
+ target_value=${target_value/$mirror_entry/\$$mirror_variable}
fi
- done
+ done < <(sed 's,^.*\s\s*,,' $mirror_list)
done
- SUBSTITUTIONS="$TARGET_STRING"
-fi
-}
-
-#---
-## @Synopsis Check if file is a tarball.
-## @return 0 if a tarball
-## @return 1 if not a tarball
-#---
-function check_if_tarball(){
-if [[ -z $(tar tf "${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" 2>&1 | grep "^tar: "
| head -n1) ]]; then
- return 0
-else
- return 1
+ eval "$target=\"\$target_value\""
fi
}

@@ -178,14 +151,14 @@ ## @return 1 if a tarball but has no src
## @return 2 if not a tarball.
#---
function hunt_src_dir(){
-if check_if_tarball; then
- message -n "Checking what is in the tarball ... "
+ message "Checking what is in the tarball ..."
SPELL_SRC_DIR=$(tar tf "${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | grep / | sed
-e "s=/.*$==g;q")
+ if [[ $? != 0 ]]; then
+ message "Not a tarball."
+ unset SPELL_SRC_DIR
+ return 1
+ fi
message "Done.\n"
-else
- unset SPELL_SRC_DIR
- return 1
-fi
}

#---
@@ -197,8 +170,9 @@ function add_details(){
SPELL_DATE=$(date +%Y%m%d)
QUILL_SPELL_HASH="$(hash_get ${QUILL_TMP_DIR}/${SPELL_SRC_FILE})"

- substitute_url_variables
-
+ substitute_with_mirror_variables SPELL_SRC_URL
+ substitute_with_variables SPELL_SRC_URL "$SPELL_SRC_FILE" SOURCE \
+ "$SPELL_NAME" SPELL "$SPELL_VERSION" VERSION
substitute_with_variables SPELL_SRC_DIR "$SPELL_NAME" SPELL
"$SPELL_VERSION" VERSION
substitute_with_variables SPELL_SRC_FILE "$SPELL_NAME" SPELL
"$SPELL_VERSION" VERSION

@@ -217,7 +191,7 @@ cat << EOF
EOF" > DETAILS
rm ${QUILL_TMP_DIR}/${SPELL_DESC_NAME:-$SPELL_NAME}

- message "Done."
+ message "Done.\n"
}
#---
##



  • [SM-Commit] GIT changes to master quill by Jaka Kranjc (ae139e561bbbd810473c87ac40fea5decec3f4ba), Jaka Kranjc, 08/09/2006

Archive powered by MHonArc 2.6.24.

Top of Page