RFC: dynamic generation of mock config from template?

Clark Williams williams at redhat.com
Wed Jul 29 15:49:27 UTC 2015


The other day someone suggested that mock should dynamically create
configs from a set of templates, so that we wouldn't have to keep
delivering and deleting a series of config files each time a new Fedora
release goes out. Not sure who it was since I can't find the discussion
in my IRC logs, but might have been dgilmore. Nirik? Don't know...

Anyway, I started thinking about it and it seems doable. Right now
configs are named with three fields:

	<distro>-<release>-<arch>.cfg

We could come up with templates for distro-arch that would be used to
generate a config. The idea is someone invokes mock with this command
line:

	$ mock -r fedora-73-x86_64 --init

We go look in /etc/mock and find no fedora-73-x86_64.cfg, so we go
grab /etc/mock/template/fedora-x86_64 and substitute in '73' for the
release number, then write /etc/mock/fedora-73-x86_64.cfg. Then we
continue on our way, at least until the build fails due to non-existant
repositories (presuming that we're not talking about the year 2035
here). 

Obviously you could fat-finger the release number and generate a bogus
config file. Worse you might want to be using F22 but mis-type '21' and
use a wrong, but existent config. Also, I don't really like the idea of
dynamically creating files in /etc, so we might need to move the
created configs off to a /var/mock/configs directory or something like
that. 

The upside though is that we could stop having to add and delete
configs when new Fedora releases come out. 

What do you guys think?

Clark


More information about the buildsys mailing list