From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6667861012102774784 X-Received: by 2002:a17:906:16c6:: with SMTP id t6mr5070700ejd.6.1552482998153; Wed, 13 Mar 2019 06:16:38 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a50:f5a3:: with SMTP id u32ls504516edm.2.gmail; Wed, 13 Mar 2019 06:16:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiEl1aae8xLA6SS645+vmqXckwrXF518b3xDRzRavm4Pr3rQJ29NgqeQcn+B5mN3gLHq5G X-Received: by 2002:a50:addd:: with SMTP id b29mr1271527edd.11.1552482997777; Wed, 13 Mar 2019 06:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552482997; cv=none; d=google.com; s=arc-20160816; b=fz2Gy2tzXOonc5WkSNazQLWl+yUQwoFnqg+2m8i+GkrOVWePwL60rtNONaH7dqtDYV +ygwny76wxezb/9t2XtlXaZgo6B0kyRqCdMu033E44p80Bot7M9+XRVyH4kM2d56JBEL iGjfgeyykvYAGtyBmbKPQwP46JLE9xG6aPPwJbvfoVkRjLWlsCVRFVGaT5We9+ywoBAH j9HkA2j3Idyysncq8Asa2TMUixzaM8Kmig11HtCRyhop7lXfBWUOgyJKn17Oq/ho2+SR K7sp1FAkfjpVjboV+h0k9UlozneHyANbSFOp6mDBygMVwVrr4Zku+ZdwBQFqR/FKswo5 6x+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=Xh0VIa0GmzJlMKi1itXHHKAb4JPqxJ6GdFtj/1aW45E=; b=nk70ieya4h7kRmIS4gQ1j7PuwgaSTCS7vJoAWvcQL7CfmkbTvfZB5kBwktK56IKfRA lCQj34BFhwt+1SSrW9DVLAyv+pPKUaP88a+/wSQs7QRAawDWg5ZNPhqykmQ0I7WM2aVX 8b17c97BQyz4jnwCOzBv/V17rPjIU5caLTgDuHmIgJoG/i3vRX7Csb0RATZnwRTKDloN s5kAD270nW0Rn2yoTPZ3fiUIbEzffcCIw8+kuJS+MmTG0SfQ36U8tuz8Gq+PECkH/CyO 3s52O0FCQC6MjkE5ZFl50LqAhp7EPObPm0hfJzcy0gq0pwTZBtRFA+fzCmUXWM4I3Uns 7bQA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id q1si48334edd.5.2019.03.13.06.16.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 06:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id x2DDGbWI030270 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Mar 2019 14:16:37 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.68.217]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x2DDGaW2006564; Wed, 13 Mar 2019 14:16:36 +0100 Date: Wed, 13 Mar 2019 14:16:36 +0100 From: Henning Schild To: Cedric Hombourger Cc: "[ext] claudius.heine.ext@siemens.com" , , Claudius Heine Subject: Re: [PATCH] wic-img: switch over to use the template.bbclass mechanism Message-ID: <20190313141636.7ba20187@md1za8fc.ad001.siemens.net> In-Reply-To: <20190313130557.22878-1-claudius.heine.ext@siemens.com> References: <20190313130557.22878-1-claudius.heine.ext@siemens.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: puDtib4POrKv Cedric you might want to test that on more than just the example we have inside Isar. Henning Am Wed, 13 Mar 2019 14:05:57 +0100 schrieb "[ext] claudius.heine.ext@siemens.com" : > From: Claudius Heine > > 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 > --- > 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[^{}@\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