[SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (b68ea0568937e4b937c6f3c5631fe48ecddfcee2)

Jaka Kranjc smgl at lynxlynx.info
Mon Jun 9 10:22:31 EDT 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: This is a digitally signed message part.
Url : http://lists.ibiblio.org/pipermail/sm-commit/attachments/20080609/11e8405e/attachment.bin 


More information about the SM-Commit mailing list