All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about the setVar method
@ 2013-04-25 13:08 Kuhl, Brian
  2013-04-25 16:00 ` Mark Hatle
  0 siblings, 1 reply; 2+ messages in thread
From: Kuhl, Brian @ 2013-04-25 13:08 UTC (permalink / raw)
  To: bitbake-devel@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]

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



[-- Attachment #2: Type: text/html, Size: 9767 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-25 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-25 13:08 Question about the setVar method Kuhl, Brian
2013-04-25 16:00 ` Mark Hatle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.