Skip to Content.
Sympa Menu

sm-commit - Re: [SM-Commit] GIT changes to master quill by Andraž Levstik (6d34e003e896df7662198a002b9353665582a91e)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <lynx AT mages.ath.cx>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: Re: [SM-Commit] GIT changes to master quill by Andraž Levstik (6d34e003e896df7662198a002b9353665582a91e)
  • Date: Tue, 25 Jul 2006 15:32:54 +0200

> @@ -66,6 +67,7 @@ while [ -n "$1" ]; do
> --apprentice|-a) export QUILL_MODE="apprentice"; shift 1 ;;
> --mage|-m) export QUILL_MODE="mage"; shift 1 ;;
> --wizard|-w) export QUILL_MODE="wizard"; shift 1 ;;
> +--reconfigure|-r) export QUILL_MODE="reconfigure"; shift 1 ;;
> --help|-h) quill_help ;;
> *) message "${PROBLEM_COLOR}Invalid parameter
> $1$DEFAULT_COLOR" quill_help ;;
> @@ -94,136 +96,138 @@ #---
forgot to add it to quill_help.

> #---
> ## @Synopsis used to edit spell files
> #---
> function quill_edit() {
> - message "Now invoking $EDITOR to edit spell files."
> + message "Now invoking ${EDITOR:-nano} to edit spell files."
> cd ${QUILL_SPELL_DIR}/${SPELL_NAME}
> for SPELL_FILE in .
> do
> - $EDITOR ${SPELL_FILE}
> + ${EDITOR:-nano} ${SPELL_FILE}
> done
> message "All modifications complete."
> }
> @@ -126,7 +126,7 @@ function quill_final_put_in_grimoire() {
We should modify/bullet-proof such env vars somewhere central in the
beggining, so later use in the code can be simpler. Anyway, EDITOR has such a
fallback in its profile.d script already, do you think this is necessary?

>- cp -r
${SPELL_NAME} /var/lib/sorcery/codex/${QUILL_GRIM_NAME}/${QUILL_SECT_NAME}/
>+ cp -r ${SPELL_NAME} ${QUILL_GRIM_NAME}/${QUILL_SECT_NAME}/
So much for clear variable names - QUILL_GRIM_NAME appears to have the path
to
the grim, not just the name. We should fix it sometime.

> @@ -6,12 +6,14 @@ function query_spell_dependencies() {
> message "${QUERY_COLOR}Please enter the dependencies(non optional) \
> of the spell if any:${DEFAULT_COLOR}"
> read "SPELL_DEPENDENCIES"
> + SPELL_DEPENDENCIES="$(echo $SPELL_DEPENDENCIES | sed -e 's,\W,,g' -e
> 's/./& /g')" }
>
> function query_spell_optional_dependencies() {
> message "${QUERY_COLOR}Please enter the optional dependencies of the \
> spell if any:${DEFAULT_COLOR}"
> read -a "SPELL_OPTIONAL_DEPENDENCIES"
> + SPELL_OPTIONAL_DEPENDENCIES="$(echo $SPELL_DEPENDENCIES | sed -e
> 's,\W,,g' -e 's/./& /g')" }
Uhm, did you actually try this? It is not the same case as with inputing
single characters.

navaden@lynxlynx delme $ message "${QUERY_COLOR}Please enter the
dependencies(non optional) of the spell if any:${DEFAULT_COLOR}"
Please enter the dependencies(non optional) of the spell if any:
navaden@lynxlynx delme $ read "SPELL_DEPENDENCIES"
gcc g++ expat
navaden@lynxlynx delme $ echo "$SPELL_DEPENDENCIES"
gcc g++ expat
navaden@lynxlynx delme $ SPELL_DEPENDENCIES="$(echo $SPELL_DEPENDENCIES |
sed -e 's,\W,,g' -e 's/./& /g')"
navaden@lynxlynx delme $ echo "$SPELL_DEPENDENCIES"
g c c g e x p a t

We can't just strip out non alphanumerical chars either, since they can be
part of spell names (++):
navaden@lynxlynx delme $ echo $SPELL_DEPENDENCIES | sed -e 's,\W, ,g'
gcc g expat

So I think it is simplest to leave it be and maybe add commas (not likely to
be in a spell name).
SPELL_DEPENDENCIES=$(tr ',' ' ' <<< "$SPELL_DEPENDENCIES")

> +function add_pre_build()
> +{
> + touch PRE_BUILD
> + chmod +x PRE_BUILD
> + if query "Do you want the default_pre_build function dumped into the
> PRE_BUILD file" "n" + then
> + (declare -f real_default_pre_build | tail -n -2 | head -n 1 | sed
> "s:&&:\&\&\n:g") > PRE_BUILD
more efficient:
declare -f real_default_pre_build | sed -n "4 s:^\s*\([^&]*\)&& \(.*\)$:\1
\&\&\n\2 \&\&:p" > PRE_BUILD
It's not tampering with the environment, so I see no reason to subshell it.
An
addition is to add && to the last line too (should be in the echo aswell).
Also made it remove leading whitespace.

navaden@lynxlynx delme $ (declare -f real_default_pre_build | tail -n -2 |
head -n 1 | sed "s:&&:\&\&\n:g")
mk_source_dir $SOURCE_DIRECTORY &&
unpack_file
VS
navaden@lynxlynx delme $ declare -f real_default_pre_build | sed -n "4
s:^\s*\([^&]*\)&& \(.*\)$:\1 \&\&\n\2 \&\&:p"
mk_source_dir $SOURCE_DIRECTORY &&
unpack_file &&

> + else
> + echo "default_pre_build" > PRE_BUILD
> + fi
> + ${EDITOR:-nano} PRE_BUILD
> +}


Unrelated, but I also opt to move query_spell_pre_build to the mage level.
Adding patches is pretty common, more so than PREPARE or CONFLICTS probably.

--
We cannot command nature except by obeying her. --Sir Francis Bacon

Attachment: pgpbW0Tl3xqbY.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page