Dne 04. 06. 19 v 7:36 Sérgio Basto napsal(a):
> Hi,
> 
> in Mock version 1.4.14 [1] All mock configs are parsed and evaluated by
> Jinja2.
> 
> I'd like replace the include [2] to new style configuration . I tried
> some options , but can't find a way to replace include ... in RPMFusion
> configurations ... 
> 
> BTW if it is easy , we may deprecated include , and start using Jinja2.
> 
> Thanks, 
> 
> [1]
> https://github.com/rpm-software-management/mock/wiki/Release-Notes-1.4.14#mock-new-features
> 
> [2]
> include('/etc/mock/fedora-30-x86_64.cfg')    

I hoped for that as well. But...

I actually started to use Jinja2 in my local configs to see how it works. There 
is one huge problem:
right now, the expansion happens when you read the value from dictionary, e.g.:

config_opts["foo"] = "version is {{releasever}}"
...
self.config["foo"] # gives correctly "version is fc30"

however if you use in config:

{{ include foo.cfg }}

then you will get an error from mock, because every config is passed through 
eval() and treated as python code.

My first idea was to treat is as Jinja2 template and expand it first and only 
after expansion pass it to eval(). It will
make the include functional, but...
Then this will not work:
  config_opts["releasever"] = "fc30"
  config_opts["foo"] = "bar {{ releasever }}"

and I am runnig out of the ideas how to solve this.


-- 
Miroslav Suchy, RHCA
Red Hat, Associate Manager ABRT/Copr, #brno, #fedora-buildsys
_______________________________________________
buildsys mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]

Reply via email to