[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: FTWCA storing config/ in VCS



On Mon, Jan 26, 2009 at 10:30:33PM +0200, Tzafrir Cohen wrote:
> On Fri, Jan 23, 2009 at 11:07:33AM +0100, Cyril Brulebois wrote:
> > Cyril Brulebois <cyril.brulebois@kerlabs.com> (23/01/2009):
> > > As Juergen says, escaping in various ways didn't help, but I guess at
> > > least the following bit should be reverted (though it doesn't address
> > > the problem Juergen initially mentioned):
> > > | -Local_arguments ${EXTRA_ARGUMENTS} "${@}"
> > > | +Local_arguments "${EXTRA_ARGUMENTS} ${@}"
> > 
> > That also breaks a basic:
> > | lh_config --iso-publisher='Cyril Brulebois <cyril.brulebois@kerlabs.com>'
> > 
> > Specified options get silently ignored. (And reverting the
> > above-mentioned bits helps.)
> 
> So we must let the command-line expansion expand it?
> 
> This would work for:
> 
>   --iso-publisher Cyril Brulebois <cyril.brulebois@kerlabs.com>
> 
> But porbably not for the more escaped ones:
> 
> diff --git a/helpers/lh_config b/helpers/lh_config

Too simple to be true. Hmm... I recall it did work for me, no idea how.

Here's something that seems to work. But is even uglier (sets IFS).
Any better ideas?

diff --git a/helpers/lh_config b/helpers/lh_config
index ef5b506..76cece6 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -715,15 +715,23 @@ fi
 # Reading existing configuration
 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source

+config_cfg_args() {
 if [ -x config.cfg ]
 then
-       EXTRA_ARGUMENTS="$(./config.cfg)"
+       echo "$(./config.cfg)"
 elif [ -r config.cfg ]
 then
-       EXTRA_ARGUMENTS="$(sed -e '/^$/d' -e '/^#/d' config.cfg | sed -e '$!N;s/\n/ /g')"
+       sed -e '/^$/d' -e '/^#/d' \
+               -e 's/^\([[:space:]]*--[a-z0-9-]\+\)[[:space:]]\+/\1\n/' \
+               config.cfg
 fi
+}

-Local_arguments "${EXTRA_ARGUMENTS} ${@}"
+OIFS="$IFS"
+IFS='
+'
+Local_arguments `config_cfg_args` "${@}"
+IFS="$IFS"

 if [ -n "${_CONFFILE}" ]
 then

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com
+972-50-7952406           mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com  iax:guest@local.xorcom.com/tzafrir


Reply to: