public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Hombourger, Cedric" <Cedric_Hombourger@mentor.com>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	"isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: RE: [PATCH] wic-img: handle variables in .wks files
Date: Fri, 8 Feb 2019 11:32:16 +0000	[thread overview]
Message-ID: <30bd3ad747cb4bca8a6b8a4483dd2c54@svr-ies-mbx-02.mgc.mentorg.com> (raw)
In-Reply-To: <c1d51a02-5a99-4383-5b47-4ad5292fb48a@siemens.com>

Hi Jan,

JFYI - it does not seem to work out of the box with Isar (despite the variables that I wanted expanded being present in the .env file we are passing to wic via --vars)
The magic is done by the image_types_wic class, see below for specifics

Will import this code in Isar so we are better aligned and post a v2

Cedric

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)
}

python () {
    if d.getVar('USING_WIC'):
        wks_file_u = d.getVar('WKS_FULL_PATH', False)
        wks_file = d.expand(wks_file_u)
        base, ext = os.path.splitext(wks_file)
        if ext == '.in' and os.path.exists(wks_file):
            wks_out_file = os.path.join(d.getVar('WORKDIR'), os.path.basename(base))
            d.setVar('WKS_FULL_PATH', wks_out_file)
            d.setVar('WKS_TEMPLATE_PATH', wks_file_u)
            d.setVar('WKS_FILE_CHECKSUM', '${WKS_TEMPLATE_PATH}:True')
           
            <snip> magic continues</snip>

            bb.build.addtask('do_write_wks_template', 'do_image_wic', None, d)

-----Original Message-----
From: Jan Kiszka [mailto:jan.kiszka@siemens.com] 
Sent: Friday, February 8, 2019 8:53 AM
To: Hombourger, Cedric <Cedric_Hombourger@mentor.com>; isar-users@googlegroups.com
Subject: Re: [PATCH] wic-img: handle variables in .wks files

On 08.02.19 08:48, [ext] Jan Kiszka wrote:
> On 08.02.19 08:44, Hombourger, Cedric wrote:
>> I will double check but WICVARS are for variables you wish to export 
>> to wic plugins This interface is for variables we would to make 
>> available inside .wks files
> 
> There is no WKSVARS in OE, while you can use variables, see e.g. 
> scripts/lib/wic/canned-wks/directdisk.wks.
> 

Sorry, I meant scripts/lib/wic/canned-wks/efi-bootdisk.wks.in.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

  parent reply	other threads:[~2019-02-08 11:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  7:02 Cedric Hombourger
2019-02-08  7:42 ` Jan Kiszka
2019-02-08  7:44   ` Hombourger, Cedric
2019-02-08  7:48     ` Jan Kiszka
2019-02-08  7:53       ` Jan Kiszka
2019-02-08  7:55         ` Hombourger, Cedric
2019-02-08 11:32         ` Hombourger, Cedric [this message]
2019-02-08 13:50         ` Hombourger, Cedric
2019-02-08 19:13           ` [PATCH v2] wic-img: import support for .wks.in files from oe-core Cedric Hombourger
2019-02-15 17:43             ` Maxim Yu. Osipov
2019-02-08 14:28 ` [PATCH] wic-img: handle variables in .wks files Henning Schild
2019-02-08 14:31   ` Hombourger, Cedric
2019-02-08 14:31   ` Jan Kiszka
2019-02-08 16:27     ` Henning Schild

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=30bd3ad747cb4bca8a6b8a4483dd2c54@svr-ies-mbx-02.mgc.mentorg.com \
    --to=cedric_hombourger@mentor.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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