From: Claudius Heine <claudius.heine.ext@siemens.com>
To: Henning Schild <henning.schild@siemens.com>,
Cedric Hombourger <Cedric_Hombourger@mentor.com>
Cc: isar-users@googlegroups.com, Claudius Heine <ch@denx.de>
Subject: Re: [PATCH] wic-img: switch over to use the template.bbclass mechanism
Date: Wed, 13 Mar 2019 14:18:55 +0100 [thread overview]
Message-ID: <90b49582-5ecd-1dac-2979-05bbd900f1de@siemens.com> (raw)
In-Reply-To: <20190313141636.7ba20187@md1za8fc.ad001.siemens.net>
On 13/03/2019 14.16, Henning Schild wrote:
> Cedric you might want to test that on more than just the example we
> have inside Isar.
Regarding testing. I tested this patch locally with the
'multiconfig:de0-nano-soc-stretch:isar-image-base' target, but since the
isar-build.org seems to be currently down, I could not test it there.
Claudius
>
> Henning
>
> Am Wed, 13 Mar 2019 14:05:57 +0100
> schrieb "[ext] claudius.heine.ext@siemens.com"
> <claudius.heine.ext@siemens.com>:
>
>> From: Claudius Heine <ch@denx.de>
>>
>> We don't need to have two template mechanism implemented in Isar. This
>> patch switches the very specific one in wic-img to use the generic one
>> from template.bbclass.
>>
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>> meta/classes/wic-img.bbclass | 40
>> +++++++++++++----------------------- 1 file changed, 14
>> insertions(+), 26 deletions(-)
>>
>> diff --git a/meta/classes/wic-img.bbclass
>> b/meta/classes/wic-img.bbclass index 5a451a0..09d9f2e 100644
>> --- a/meta/classes/wic-img.bbclass
>> +++ b/meta/classes/wic-img.bbclass
>> @@ -6,29 +6,14 @@
>>
>> WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' %
>> os.path.exists('${WKS_FULL_PATH}')}"
>> -python do_write_wks_template () {
>> - """Write out expanded template contents to WKS_FULL_PATH."""
>> - import re
>> -
>> - template_body = d.getVar('_WKS_TEMPLATE')
>> -
>> - # Remove any remnant variable references left behind by the
>> expansion
>> - # due to undefined variables
>> - expand_var_regexp = re.compile(r"\${[^{}@\n\t :]+}")
>> - while True:
>> - new_body = re.sub(expand_var_regexp, '', template_body)
>> - if new_body == template_body:
>> - break
>> - else:
>> - template_body = new_body
>> -
>> - wks_file = d.getVar('WKS_FULL_PATH')
>> - with open(wks_file, 'w') as f:
>> - f.write(template_body)
>> +do_copy_wks_template[file-checksums] += "${WKS_FILE_CHECKSUM}"
>> +do_copy_wks_template () {
>> + cp -f '${WKS_TEMPLATE_PATH}' '${WORKDIR}/${WKS_TEMPLATE_FILE}'
>> }
>>
>> python () {
>> import itertools
>> + import re
>>
>> wks_full_path = None
>>
>> @@ -70,22 +55,25 @@ python () {
>> d.setVar('WKS_TEMPLATE_PATH', wks_file_u)
>> d.setVar('WKS_FILE_CHECKSUM', '${WKS_TEMPLATE_PATH}:True')
>>
>> + wks_template_file = os.path.basename(base) + '.tmpl'
>> + d.setVar('WKS_TEMPLATE_FILE', wks_template_file)
>> + d.appendVar('TEMPLATE_FILES',
>> " {}".format(wks_template_file)) +
>> # We need to re-parse each time the file changes, and bitbake
>> # needs to be told about that explicitly.
>> bb.parse.mark_dependency(d, wks_file)
>>
>> + expand_var_regexp =
>> re.compile(r"\${(?P<name>[^{}@\n\t :]+)}") +
>> try:
>> with open(wks_file, 'r') as f:
>> - body = f.read()
>> + d.appendVar("TEMPLATE_VARS", " {}".format(
>> + " ".join(expand_var_regexp.findall(f.read()))))
>> except (IOError, OSError) as exc:
>> pass
>> else:
>> - # Previously, I used expandWithRefs to get the
>> dependency list
>> - # and add it to WICVARS, but there's no point re-parsing
>> the
>> - # file in process_wks_template as well, so just put it in
>> - # a variable and let the metadata deal with the deps.
>> - d.setVar('_WKS_TEMPLATE', body)
>> - bb.build.addtask('do_write_wks_template',
>> 'do_wic_image', None, d)
>> + bb.build.addtask('do_copy_wks_template',
>> 'do_transform_template do_wic_image', None, d)
>> + bb.build.addtask('do_transform_template',
>> 'do_wic_image', None, d) }
>>
>> inherit buildchroot
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de
next prev parent reply other threads:[~2019-03-13 13:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-13 13:05 claudius.heine.ext
2019-03-13 13:16 ` Henning Schild
2019-03-13 13:18 ` Claudius Heine [this message]
2019-03-25 16:35 ` Maxim Yu. Osipov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90b49582-5ecd-1dac-2979-05bbd900f1de@siemens.com \
--to=claudius.heine.ext@siemens.com \
--cc=Cedric_Hombourger@mentor.com \
--cc=ch@denx.de \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox