Skip to Content.
Sympa Menu

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

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 (406d2bd4b692fc1526ef4c72bba6cd27d25c7777)
  • Date: Mon, 7 Aug 2006 16:49:01 -0500

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

usr/bin/quill | 9 ------
var/lib/quill/ChangeLog | 13 +++++++++
var/lib/quill/modules/libcore | 12 ++++++--
var/lib/quill/modules/libdetails | 54
++++++++++++++++++++-------------------
4 files changed, 51 insertions(+), 37 deletions(-)

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

* libdetails: first try substituting SOURCE_URL with $SOURCE
moved substitutions to add_details
made substitute_with_variables more generic, so it works for
everything
made it do all the storing internally, then put it to use
made hunt_src_dir verbose, as it can take a while
FIXME merge it with check_if_tarball
FIXME make substitute_with_mirror_variables work
* libcore: renamed download_spell_source to get_spell_source
as I've made it check $SOURCE_CACHE for the tarball first
(useful for testing quill and spell comparisons)
fixed quill_final_tarball, missing test

diff --git a/usr/bin/quill b/usr/bin/quill
index 97a4f6d..51c8f7d 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -181,17 +181,10 @@ then

show_spell_source_file_info

- download_spell_source
+ get_spell_source

hunt_src_dir

- # use this once it is possible
- #substitute_with_variables SPELL_SRC_FILE SPELL_NAME SPELL_VERSION
- QUILL_SPELL_HASH="$(hash_get ${QUILL_TMP_DIR}/${SPELL_SRC_FILE})"
- SPELL_SRC_FILE=${SPELL_SRC_FILE//${SPELL_NAME}/\$\{SPELL\}}
- SPELL_SRC_FILE=${SPELL_SRC_FILE//${SPELL_VERSION}/\$\{VERSION\}}
- substitute_url_variables
-
add_details

if [[ "${PREPAREISON}" == "PREPARE, " ]]
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 55a84aa..188546e 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,16 @@
+2006-08-07 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libdetails: first try substituting SOURCE_URL with $SOURCE
+ moved substitutions to add_details
+ made substitute_with_variables more generic, so it works for
everything
+ made it do all the storing internally, then put it to use
+ made hunt_src_dir verbose, as it can take a while
+ FIXME merge it with check_if_tarball
+ FIXME make substitute_with_mirror_variables work
+ * libcore: renamed download_spell_source to get_spell_source
+ as I've made it check $SOURCE_CACHE for the tarball first
+ (useful for testing quill and spell comparisons)
+ fixed quill_final_tarball, missing test
+
2006-08-06 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* added a global EDITOR fallback and removed the single ones
removed trailing white space
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index ae3982c..7c33dad 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -14,10 +14,16 @@ #---
## @Synopsis download spell's source file
#---

-function download_spell_source(){
+function get_spell_source(){
mkdir -p ${QUILL_TMP_DIR}
cd ${QUILL_TMP_DIR}
- wget -c "${SPELL_SRC_URL}"
+ if [[ -e $SOURCE_CACHE/$SPELL_SRC_FILE ]]; then
+ message -n "Copying the spell tarball over from the sorcery cache ... "
+ cp $SOURCE_CACHE/$SPELL_SRC_FILE .
+ message "Done."
+ else
+ wget -c "${SPELL_SRC_URL}"
+ fi
cd ${QUILL_SPELL_DIR}/${SPELL_NAME}
}

@@ -110,7 +116,7 @@ function quill_final_tarball() {
message "Now creating a bziped2 tarball of the spell files"
cd ${QUILL_SPELL_DIR}
tar -jcvf ${SPELL_NAME}.tar.bz2 ${SPELL_NAME}
- if $? != 0 ; then
+ if [[ $? != 0 ]]; then
message "Failed to create spell tarball"
else
message "Spell tarball created successfully"
diff --git a/var/lib/quill/modules/libdetails
b/var/lib/quill/modules/libdetails
index c3e7706..4a0a77a 100644
--- a/var/lib/quill/modules/libdetails
+++ b/var/lib/quill/modules/libdetails
@@ -99,33 +99,36 @@ function show_spell_source_file_info(){
}

#---
-## @Synopsis Substitute any number of expanded variables in given string
-## @Synopsis with corresponding variable names, store resulting string
-## @Synopsis in $SUBSTITUTIONS. $1 is target variable, $2 and so on are
-## @Synopsis variables to substitute with var names. Omit $, give only
-## @Synopsis var names. Example:
-## @Synopsis substitute_with_variables SPELL_SRC_URL SPELL VERSION
+## @Synopsis Substitute any number of expanded variables in given variable
+## @Synopsis with corresponding variable names
+## @param target variable
+## @param the string to search for (variable contents)
+## @param the replacement for said string (variable name)
+## @param the string to search for (variable contents)
+## @param the replacement for said string (variable name)
+## @param ...
#---
function substitute_with_variables() {
-if [ -n "$1" ]; then
- local TARGET_STRING="${!1}"
+if [[ -n $1 ]]; then
+ local target=$1 target_value
+ eval target_value="\$$1"
shift 1
- while [ -n "$1" ]; do
- TARGET_STRING=${TARGET_STRING//${!1}/\$\{$1\}}
- shift 1
+ while [[ -n $2 ]]; do
+ target_value="${target_value//$1/\$$2}"
+ shift 2
done
- SUBSTITUTIONS=$TARGET_STRING
+ eval "$target=\"\$target_value\""
fi
}

#---
## @Synopsis Process SPELL_SRC_URL: Subsitute expanded with escaped
-## @Synopsis SPELL and VERSION, Substitute mirror urls with mirror url
+## @Synopsis SOURCE, SPELL and VERSION, Substitute mirror urls with mirror
url
## @Synopsis variables.
#---
function substitute_url_variables(){
- substitute_with_variables SPELL_SRC_URL SPELL VERSION
- SPELL_SRC_URL="$SUBSTITUTIONS"
+ 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"
}
@@ -170,24 +173,18 @@ fi

#---
## @Synopsis Assign to SPELL_SRC_DIR the source dir inside a tarball,
-## @Synopsis substitute expanded with escaped SPELL and VERSION.
## @return 0 if a tarball and has a src dir
## @return 1 if a tarball but has no src dir
## @return 2 if not a tarball.
#---
function hunt_src_dir(){
if check_if_tarball; then
+ message -n "Checking what is in the tarball ... "
SPELL_SRC_DIR=$(tar tf "${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | grep / | sed
-e "s=/.*$==g;q")
- if [ -n "$SPELL_SRC_DIR" ]; then
- SPELL_SRC_DIR=${SPELL_SRC_DIR//${SPELL_NAME}/\$\{SPELL\}}
- SPELL_SRC_DIR=${SPELL_SRC_DIR//${SPELL_VERSION}/\$\{VERSION\}}
- return 0
- else
- return 1
- fi
+ message "Done.\n"
else
unset SPELL_SRC_DIR
- return 2
+ return 1
fi
}

@@ -195,10 +192,15 @@ #---
## @Synopsis generate DETAILS file
#---
function add_details(){
+ message "Generating the DETAILS file..."

SPELL_DATE=$(date +%Y%m%d)
+ QUILL_SPELL_HASH="$(hash_get ${QUILL_TMP_DIR}/${SPELL_SRC_FILE})"
+
+ substitute_url_variables

- message "Generating DETAILS file..."
+ substitute_with_variables SPELL_SRC_DIR "$SPELL_NAME" SPELL
"$SPELL_VERSION" VERSION
+ substitute_with_variables SPELL_SRC_FILE "$SPELL_NAME" SPELL
"$SPELL_VERSION" VERSION

echo \
" SPELL=${SPELL_NAME}
@@ -215,7 +217,7 @@ cat << EOF
EOF" > DETAILS
rm ${QUILL_TMP_DIR}/${SPELL_DESC_NAME:-$SPELL_NAME}

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



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

Archive powered by MHonArc 2.6.24.

Top of Page