Skip to Content.
Sympa Menu

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

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 (c477568d2e93994958ed63fb00b98483e7af9984)
  • Date: Fri, 2 Mar 2007 10:14:23 -0600

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

usr/bin/quill | 50
++++++++++++++--------------------
var/lib/quill/ChangeLog | 15 ++++++++++
var/lib/quill/modules/libbuild | 4 +-
var/lib/quill/modules/libcore | 14 ++++-----
var/lib/quill/modules/libfreshmeatxml | 30 +++++++++++---------
var/lib/quill/modules/libperlcpan | 4 ++
var/lib/quill/modules/librubyraa | 6 +++-
var/lib/quill/version | 2 -
8 files changed, 72 insertions(+), 53 deletions(-)

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

* quill: simplified the various fetching modules code, now adding a
new one
requires only more parameter parsing and quill_help
added short flag for --rubyraa and the combos with -u
added config versioning support, on important config changes
increment
QUILL_CONFIG_VERSION and the user will be forced to reconfigure
* libbuild: accompanying changes
* libcore: save the config version in quillrc, not the quill version
updated quill_help
fixed quill_purge to delete everything - including secret files
* libfreshmeatxml: reinstated the erroneously removed name
preservation
simplified some blocks, reversed the order of project file fetching
* libperlcpan, librubyraa: added the same name preservation snippet
* version: 0.2.3

diff --git a/usr/bin/quill b/usr/bin/quill
index ad76214..dea4cab 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -7,8 +7,6 @@
## @ToDo Add option to use upstream gpg signature as included or
## @ToDo downloadable .sig file
## @ToDo Put a multiversion option
-## @ToDo single line or multiline depending on the length of line if
-## @ToDo <80 single else multi
## @ToDo Interface to add CONFIGURE options
## @ToDo Make quill the be-all for spells
##
@@ -44,6 +42,8 @@ QUILL_QUILLRC=${QUILL_HOME_DIR}/quillrc
QUILL_OLD_QUILLRC=~/.quillrc
QUILL_SPELL_DIR=~/.sourcemage/spells
QUILL_TMP_DIR=~/.sourcemage/tmp
+QUILL_CONFIG_VERSION=1
+QUILL_OLD_CONFIG_VERSION=$QUILL_CONFIG_VERSION

#---
## Not really a function it's supposed to parse the command line parameters
@@ -53,15 +53,15 @@ while [[ -n $1 ]]; do
case $1 in
--fmxml|-f)
check_parameter $2
- QUILL_FMXML_MODE="on"
+ QUILL_FETCH_MODE="fmxml"
shift ;;
--perlcpan|-c)
check_parameter $2
- QUILL_CPAN_MODE="on"
+ QUILL_FETCH_MODE="cpan"
shift ;;
- --rubyraa)
+ --rubyraa|-y)
check_parameter $2
- QUILL_RAA_MODE="on"
+ QUILL_FETCH_MODE="raa"
shift ;;
--update|-u)
check_parameter $2
@@ -70,12 +70,17 @@ while [[ -n $1 ]]; do
-uf|-fu)
check_parameter $2
QUILL_UPDATE="on"
- QUILL_FMXML_MODE="on"
+ QUILL_FETCH_MODE="fmxml"
shift ;;
-uc|-cu)
check_parameter $2
QUILL_UPDATE="on"
- QUILL_CPAN_MODE="on"
+ QUILL_FETCH_MODE="cpan"
+ shift ;;
+ -yu|-uy)
+ check_parameter $2
+ QUILL_UPDATE="on"
+ QUILL_FETCH_MODE="raa"
shift ;;
--purge|-p) QUILL_MODE="purge"; quill_purge $2 ;;
--apprentice|-a) QUILL_MODE="apprentice" ;;
@@ -90,7 +95,6 @@ while [[ -n $1 ]]; do
fi
shift
done
-export QUILL_MODE QUILL_FMXML_MODE QUILL_CPAN_MODE QUILL_TARGET

unset -f message
. /etc/sorcery/config
@@ -101,6 +105,11 @@ do
done

quill_rc
+if [[ ${QUILL_CONFIG_VERSION/0.2.2/1} != $QUILL_OLD_CONFIG_VERSION ]]; then
+ QUILL_MODE="reconfigure"
+ error_msg "Your quill settings are too old, forcing a reconfiguration!"
+ quill_rc
+fi

# we should do some quillrc sanity checking someday
[[ ! -d $QUILL_SPELL_DIR ]] &&
@@ -132,27 +141,10 @@ fi
## Questions and stuff

quill_welcome
-if [[ "$QUILL_FMXML_MODE" == "on" ]]
-then
- # fetches SPELL_NAME, SPELL_DESC_NAME, SPELL_SRC_URL, SPELL_URL,
- # SPELL_LICENSE and both descriptions
- quill_fmxml_core $QUILL_TARGET
-
- # creates SPELL_VERSION and SPELL_SRC_FILE (to be SOURCE)
- parse_spell_source_file_info
-fi
-
-if [[ "$QUILL_CPAN_MODE" == "on" ]]
-then
- quill_cpan_core $QUILL_TARGET
-
- # creates SPELL_VERSION and SPELL_SRC_FILE (to be SOURCE)
- parse_spell_source_file_info
-fi
-
-if [[ "$QUILL_RAA_MODE" == "on" ]]
+if [[ ! -z $QUILL_FETCH_MODE ]]
then
- quill_raa_core $QUILL_TARGET
+ # fetch various spell variables
+ quill_${QUILL_FETCH_MODE}_core $QUILL_TARGET

# creates SPELL_VERSION and SPELL_SRC_FILE (to be SOURCE)
parse_spell_source_file_info
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index c2e0a4e..387dc92 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,18 @@
+2007-03-02 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * quill: simplified the various fetching modules code, now adding a
new one
+ requires only more parameter parsing and quill_help
+ added short flag for --rubyraa and the combos with -u
+ added config versioning support, on important config changes
increment
+ QUILL_CONFIG_VERSION and the user will be forced to reconfigure
+ * libbuild: accompanying changes
+ * libcore: save the config version in quillrc, not the quill version
+ updated quill_help
+ fixed quill_purge to delete everything - including secret files
+ * libfreshmeatxml: reinstated the erroneously removed name
preservation
+ simplified some blocks, reversed the order of project file fetching
+ * libperlcpan, librubyraa: added the same name preservation snippet
+ * version: 0.2.3
+
2007-03-01 Andra?? "ruskie" Levstik <ruskie AT mages.ath.cx>
* libdetails: ooppsss fi -> esac

diff --git a/var/lib/quill/modules/libbuild b/var/lib/quill/modules/libbuild
index de623bf..1e9f44e 100644
--- a/var/lib/quill/modules/libbuild
+++ b/var/lib/quill/modules/libbuild
@@ -6,7 +6,7 @@
BUILDISON=""

function query_spell_build() {
- if [[ "$QUILL_CPAN_MODE" != "on" ]]; then
+ if [[ "$QUILL_FETCH_MODE" != "cpan" ]]; then
if query "Will you be adding a custom BUILD file:" "n"
then
BUILDISON="BUILD, "
@@ -15,7 +15,7 @@ function query_spell_build() {
}

function add_build() {
- if [[ "$QUILL_CPAN_MODE" == "on" ]]; then
+ if [[ "$QUILL_FETCH_MODE" == "cpan" ]]; then
cp ${QUILL_TMP_DIR}/${SPELL_NAME}-BUILD
${QUILL_SPELL_DIR}/${SPELL_NAME}/BUILD
else
if query "Do you want the default_build function dumped into the BUILD
file" "n"
diff --git a/var/lib/quill/modules/libcore b/var/lib/quill/modules/libcore
index b22a017..dc1ae2f 100644
--- a/var/lib/quill/modules/libcore
+++ b/var/lib/quill/modules/libcore
@@ -78,7 +78,7 @@ function quill_rc() {
then
mkdir -p $QUILL_HOME_DIR
touch $QUILL_QUILLRC
- local quill_version=$QUILL_VERSION # can get overridden by the sourcing
+ local quill_config_version=$QUILL_CONFIG_VERSION # can get overridden by
the sourcing
. $QUILL_QUILLRC # get the contents if there are any (for defaults)
message "${MESSAGE_COLOR}This will (re)create ${QUILL_QUILLRC} for
you${DEFAULT_COLOR}"
query_string GURU_NAME "${QUERY_COLOR}Please enter your name for the
HISTORY entries.${DEFAULT_COLOR}" "$GURU_NAME"
@@ -98,7 +98,7 @@ function quill_rc() {
fi
message "Thank you. Now generating ${QUILL_QUILLRC}"
cat << QUA > $QUILL_QUILLRC
- QUILL_CONFIG_VERSION="$quill_version"
+ QUILL_CONFIG_VERSION="$quill_config_version"
GURU_NAME="$GURU_NAME"
GURU_EMAIL="$GURU_EMAIL"
QUILL_SPELL_DIR="$QUILL_SPELL_DIR"
@@ -257,12 +257,12 @@ function quill_purge() {
message -n "Purging ... "
if [[ $1 == "tmp" ]]
then
- [[ -d $QUILL_TMP_DIR ]] && rm -rf $QUILL_TMP_DIR/*
+ [[ -d $QUILL_TMP_DIR ]] && rm -rf $QUILL_TMP_DIR && mkdir $QUILL_TMP_DIR
elif [[ $1 == "spells" ]]
then
- [[ -d $QUILL_SPELL_DIR ]] && rm -rf $QUILL_SPELL_DIR/*
+ [[ -d $QUILL_SPELL_DIR ]] && rm -rf $QUILL_SPELL_DIR && mkdir
$QUILL_SPELL_DIR
else
- [[ -d $QUILL_TMP_DIR ]] && [[ -d $QUILL_SPELL_DIR ]] && rm -rf
$QUILL_SPELL_DIR/* $QUILL_TMP_DIR/*
+ [[ -d $QUILL_TMP_DIR ]] && [[ -d $QUILL_SPELL_DIR ]] && rm -rf
$QUILL_SPELL_DIR $QUILL_TMP_DIR && mkdir $QUILL_TMP_DIR $QUILL_SPELL_DIR
fi

rc=$?
@@ -500,7 +500,7 @@ A spell creator and updater.
OPTIONS:
--fmxml, -f <SPELL> get spell data from Freshmeat if possible
--perlcpan, -c <SPELL> get spell data from Perl-CPAN if possible
- --rubyraa <SPELL> get spell data from Ruby Application Archive
if possible
+ --rubyraa, -y <SPELL> get spell data from Ruby Application
Archive if possible
--update, -u <SPELL> update exsisting spell
--apprentice, -a apprentice mode (default)
--mage, -m mage mode (advanced)
@@ -518,7 +518,7 @@ EXAMPLES:
Update a spell; try to get some information from Perl-CPAN:
quill -c wormux -u wormux

- The same can be done with shorter forms (fu, uf, cu and uc are supported):
+ The same can be done with shorter forms (fu, uc, yu and inverses are
supported):
quill -cu wormux
"
exit ${1:-0}
diff --git a/var/lib/quill/modules/libfreshmeatxml
b/var/lib/quill/modules/libfreshmeatxml
index 9c0f121..afa7ab6 100644
--- a/var/lib/quill/modules/libfreshmeatxml
+++ b/var/lib/quill/modules/libfreshmeatxml
@@ -6,7 +6,11 @@ function quill_fmxml_grab_from_xml() {
xml_grep --text_only "${1}" "${2}"
}

-function quill_fmxml_core(){
+function quill_fmxml_core() {
+ # so it is set even if we end prematurely, useful when adding spells
+ # gets properly overwritten later on
+ SPELL_NAME="$1"
+
# if the argument looks like a url then use that, otherwise
# assume the argument is the name of the spell and construct a
# url for where we think freshmeat.net stores their xml data
@@ -20,20 +24,20 @@ function quill_fmxml_core(){
# check if we already have the xml file, if we dont, download it
FRESHMEAT_FILE="${QUILL_TMP_DIR}/${1}.xml"
FRESHMEAT_PROJECT_FILE="${QUILL_TMP_DIR}/${1}.fm"
- if [[ ! -e ${FRESHMEAT_FILE} ]]; then
- message "Attempting to retrive project XML page..."
- wget -q -Uquill -O ${FRESHMEAT_FILE} "${FRESHMEAT_XML_URL}" || \
- (error_msg "Error: unable to fetch project XML page" && return 1)
- fi
-
if [[ ! -e ${FRESHMEAT_PROJECT_FILE} ]]; then
- message "Attempting to retrive project page..."
- wget -q -Uquill -O ${FRESHMEAT_PROJECT_FILE} "${FRESHMEAT_PROJECT_URL}"
|| \
- (error_msg "Error: unable to fetch project page" && return 1)
- # for some reason the dos2unix.sed from the sedders bag didn't work here
:(
- # but this does
- cat ${FRESHMEAT_PROJECT_FILE} | tr "\r" " " >
${FRESHMEAT_PROJECT_FILE}.tmp
+ message -n "Attempting to retrive project page ... "
+ wget -q -Uquill -O ${FRESHMEAT_PROJECT_FILE} "${FRESHMEAT_PROJECT_URL}"
||
+ { error_msg "Error: unable to fetch project page" && return 1; }
+ tr "\r" " " < ${FRESHMEAT_PROJECT_FILE} > ${FRESHMEAT_PROJECT_FILE}.tmp
mv ${FRESHMEAT_PROJECT_FILE}.tmp ${FRESHMEAT_PROJECT_FILE}
+ message "Done"
+ fi
+
+ if [[ ! -e ${FRESHMEAT_FILE} ]]; then
+ message -n "Attempting to retrive project XML page ... "
+ wget -q -Uquill -O ${FRESHMEAT_FILE} "${FRESHMEAT_XML_URL}" ||
+ { error_msg "Error: unable to fetch project XML page" && return 1; }
+ message "Done"
fi

# check that the project was found - exsists
diff --git a/var/lib/quill/modules/libperlcpan
b/var/lib/quill/modules/libperlcpan
index 5df57b1..90a0b05 100644
--- a/var/lib/quill/modules/libperlcpan
+++ b/var/lib/quill/modules/libperlcpan
@@ -25,6 +25,10 @@ function quill_get_cpan_meta()

function quill_cpan_core()
{
+ # so it is set even if we end prematurely, useful when adding spells
+ # gets properly overwritten later on
+ SPELL_NAME="$1"
+
quill_get_cpan_meta $1
if zgrep -q -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz ||
zgrep -q -w -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz
diff --git a/var/lib/quill/modules/librubyraa
b/var/lib/quill/modules/librubyraa
index 89ef8ed..8cae064 100644
--- a/var/lib/quill/modules/librubyraa
+++ b/var/lib/quill/modules/librubyraa
@@ -15,7 +15,11 @@ function quill_raa_core(){
local desc
local line
local raa_project_file
- project="$(echo $1 | tr 'A-Z' 'a-z')"
+
+ # so it is set even if we end prematurely, useful when adding spells
+ # gets properly overwritten later on
+ SPELL_NAME="$1"
+ project="$(tr 'A-Z' 'a-z' <<< $1 )"
raa_project_file=${QUILL_TMP_DIR}/${project}.raa
message "Attempting to retrive project page..."
wget -q -O $raa_project_file.tmp \
diff --git a/var/lib/quill/version b/var/lib/quill/version
index 35c84da..7179039 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.2-2007-02-25
+0.2.3



  • [SM-Commit] GIT changes to master quill by Jaka Kranjc (c477568d2e93994958ed63fb00b98483e7af9984), Jaka Kranjc, 03/02/2007

Archive powered by MHonArc 2.6.24.

Top of Page