sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
Re: [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (b68ea0568937e4b937c6f3c5631fe48ecddfcee2)
- From: Jaka Kranjc <smgl AT lynxlynx.info>
- To: sm-commit AT lists.ibiblio.org
- Subject: Re: [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (b68ea0568937e4b937c6f3c5631fe48ecddfcee2)
- Date: Mon, 9 Jun 2008 16:22:31 +0200
Nice job! I always like to see progress saved in a public place. ;) This way
I
can also help you by reviewing it.
On Monday 09 of June 2008 03:43:19 Justin Boffemmyer wrote:
> diff --git a/src/cauldron b/src/cauldron
> index 36cd66b..7dcb8e9 100755
> --- a/src/cauldron
> +++ b/src/cauldron
> -. /etc/cauldron/config
> +if [[ -e /etc/cauldron/local/config ]]
> +then
> + . /etc/cauldron/local/config
> +else
> + . /etc/cauldron/config
> +fi
> +
> . /var/lib/cauldron/libcauldron
Why not do it like sorcery and source the local config only if it is there,
but source the default one always. This way if you want to use a local
config, you don't have to redefine all the variables from the default one,
but just the changes.
>------ +function enchant_back() {
> + # if the forward history is empty, then we can't go forward
> + [[ $(wc -l ${ENCHANT_BACK}) -eq 0 ]] && return $EERR_BACK
wc -l somefile returns: ### somefile
You can use this trick to get just the number: wc -l < somefile
> + # if the max history size has been reached, then we drop the oldest item
> + [[ $(wc -l ${ENCHANT_FORWARD}) -ge $ENCHANT_HISTORY ]] &&
> + tail -n +2 ${ENCHANT_FORWARD} > ${ENCHANT_FORWARD}
This won't work, bash will clear ${ENCHANT_FORWARD} and then try to read from
it. You can use this instead: sed -i '1d' ${ENCHANT_FORWARD}
> + # copy the current status to the forward history, so we can go forward
> to + # where we are after we jump back
> + cat < ${ENCHANT_STATUS} >> ${ENCHANT_FORWARD}
> + # set the current step to be the one we are jumping to
> + tail -n 1 ${ENCHANT_BACK} > ${ENCHANT_STATUS}
> + # remove the step we jumped to from the back history
> + head -n -1 ${ENCHANT_BACK} > ${ENCHANT_BACK}
sed -i '$d' ${ENCHANT_BACK}
These two happen more than once.
>------ +function cauldron_download_sorcery() {
> + local BRANCH=$1
> + local SPOOL=$2
> + local SORCERY="sorcery-$BRANCH.tar.bz2"
> +
> + # run in a subshell as an easy way of not messing with the working
> directory + (
> + cd ${SPOOL}
> + wget http://download.sourcemage.org/sorcery/${SORCERY}
> + )
> +}
The way you call this function it needs to remove the tarball if it already
exists or it will get clobbered and the old one will be used.
>------ +function cauldron_checkerror() {
> + local type=$1
> + local error=
> +
> + if [[ $? -gt 0 ]]
> + then
> + error=$type
> + else
> + error="${${type:0:1}ERR_OK}"
These need another evaluation, now the result would be a string. You
> + return $error
can simply fix it here: return ${!error}
LP
Attachment:
signature.asc
Description: This is a digitally signed message part.
-
[SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (b68ea0568937e4b937c6f3c5631fe48ecddfcee2),
Justin Boffemmyer, 06/08/2008
- Re: [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (b68ea0568937e4b937c6f3c5631fe48ecddfcee2), Jaka Kranjc, 06/09/2008
Archive powered by MHonArc 2.6.24.