[bitbake-devel] Question about the setVar method
Kuhl, Brian
brian.kuhl at windriver.com
Thu Apr 25 13:08:31 UTC 2013
I'm working on a new bitbake class which includes the following function which works as desired except the
d.setVar( dict[cmd],retlist[0])
function does not appear to have global scope, and its effects are not seen outside the function.
How do I give this operation global scope?
python rpm_spec_do_postpatch() {
import subprocess
dict = {'DESCRIPTION':'DESCRIPTION',
'LICENSE':'LICENSE',
'SUMMARY':'SUMMARY',
'URL':'HOMEPAGE' }
harvest_spec = d.getVar('HARVEST_SPEC', True)
if harvest_spec :
pn = d.getVar('PN', True)
workdir = d.getVar('WORKDIR', True)
src_spec = d.getVar('SRCSPEC', True)
rpm_args = d.getVar('RPM_ARGS',True)
spec_path = os.path.join( workdir,src_spec )
prefix = "rpm -q %s --specfile %s --qf '%%{" % (rpm_args,spec_path)
postfix = "}<:>' "
for cmd in dict:
cmd_str = prefix + cmd + postfix
retstr = subprocess.check_output(cmd_str, shell=True)
retlist = retstr.split('<:>')
if retlist[0]:
d.setVar( dict[cmd],retlist[0])
bb.data.update_data(d)
bb.note ("rpm_spec_do_postpatch HARVEST_SPEC setting %s in %s to: %s \n" %( (dict[cmd]),pn,retlist[0]))
}
Brian Kuhl
Wind River
kuhlenough @ skype
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20130425/a3f1a54a/attachment-0001.html>
More information about the bitbake-devel
mailing list