Re: FTWCA storing config/ in VCS, reloaded
On Fri, Jan 30, 2009 at 09:45:28PM +0100, Daniel Baumann wrote:
> Hi,
>
> and this time it's even working :)
>
> Let's repeat...
>
> If you are using a version control system to store your live-helper
> config directory, you should not store the generated files config/* in
> it, but only save which arguments you passed to lh_config and your own
> files that you put into the config/*/* directories.
>
> If you would store them in the vcs, you would have troubles over time,
> as the format of the generated config files may change. If you use the
> (almost) stable interface to generate the config, the lh_config tool,
> you can avoid that completely and always have a working and up2date
> config without manually updating/touching it.
>
> In order to ease this, lh_config from ive-helper in git (which gets
> uploaded to unstable this weekend) does check for a scripts/config.sh
> file. If present, it executes it instead. Same applies to
> scripts/clean.sh for lh_clean.
scripts/ ?
/me already has utils/ in the SVN.
config.sh implies that it is a shell script. I don't see why it should
be. See below.
>
> ...and the workflow would be:
>
> 1. create a git repository
>
> 2. add a .gitignore file, example at
> http://git.debian.org/?p=debian-live/config-daniel.git;a=blob;f=.gitignore;
>
> 3. add a scripts/config.sh with your complex lh_config call/options,
> example at
> http://git.debian.org/?p=debian-live/config-daniel.git;a=blob;f=scripts/config.sh;
>
> 4. commit that
>
> 5. when you actually build your live system, you checkout your
> repository in your build directory
>
> 6. run lh_config (any additional argument is optional and will be
> appended to the lh_config call in scripts/config.sh).
>
> 7. lh_build
>
> I think this is almost sane. Cluebats, as usual, are welcome.
The major thing missing from there is comments:
1. Document the options I use
2. Easily rem-out options
Also, the previous test:
CUSTOM_ISO_PUBLISHER="Special image by Tzafrir <tzafrir>"
if [ "$CUSTOM_ISO_PUBLISHER" != '' ]; then
CUSTOM_ISO_IMAGE_PARAM=# ????
fi
Whereas with perl (or any other decent language) this is a non-issue.
Something along the lines of:
#!/usr/bin/perl -w
my @options = ();
if ( -r 'config.cfg' ) {
open(CFG,'config.cfg') or die;
while (<CFG>) {
chomp;
s/\s*#/#/;
next if (/^(#|$)/); Spaces and comments
my ($name, $value) = split /\s+/, $_, 2;
push @options,("--$name", $value);
}
}
system('lh_config', @options);
config.cfg is a file with e.g.:
iso-publisher Special image by Tzafrir <tzafrir>
--
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: