diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-12 16:31:57 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-14 12:55:47 +0100 |
commit | 53841ce521d44c0c9cca512675a12f81a491fe52 (patch) | |
tree | 98a2ca75581f4bb488e43087b6b9128017aac135 /meta/classes/packageinfo.bbclass | |
parent | 98abb113a02a4504ae969dbaf9844ab6539dcdb8 (diff) | |
download | poky-53841ce521d44c0c9cca512675a12f81a491fe52.tar.gz |
classes/conf: Add eventmasks for event handlers
Now that bitbake supports masking events for event handlers, lets use
this so event handlers are only called for events they care about. This
lets us simplify the code indentation a bit at least as well as mildly
improving the event handling performance.
(From OE-Core rev: bff73743280f9eafebe4591f7368ead91a4eb74d)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/packageinfo.bbclass')
-rw-r--r-- | meta/classes/packageinfo.bbclass | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/meta/classes/packageinfo.bbclass b/meta/classes/packageinfo.bbclass index 4709bea359..42fcd04150 100644 --- a/meta/classes/packageinfo.bbclass +++ b/meta/classes/packageinfo.bbclass | |||
@@ -1,29 +1,29 @@ | |||
1 | python packageinfo_handler () { | 1 | python packageinfo_handler () { |
2 | if isinstance(e, bb.event.RequestPackageInfo): | 2 | import oe.packagedata |
3 | import oe.packagedata | 3 | pkginfolist = [] |
4 | pkginfolist = [] | 4 | tmpdir = e.data.getVar('TMPDIR', True) |
5 | tmpdir = e.data.getVar('TMPDIR', True) | 5 | target_vendor = e.data.getVar('TARGET_VENDOR', True) |
6 | target_vendor = e.data.getVar('TARGET_VENDOR', True) | 6 | target_os = e.data.getVar('TARGET_OS', True) |
7 | target_os = e.data.getVar('TARGET_OS', True) | 7 | package_archs = e.data.getVar('PACKAGE_ARCHS', True) |
8 | package_archs = e.data.getVar('PACKAGE_ARCHS', True) | 8 | packaging = e.data.getVar('PACKAGE_CLASSES', True).split()[0].split('_')[1] |
9 | packaging = e.data.getVar('PACKAGE_CLASSES', True).split()[0].split('_')[1] | 9 | deploy_dir = e.data.getVar('DEPLOY_DIR', True) + '/' + packaging |
10 | deploy_dir = e.data.getVar('DEPLOY_DIR', True) + '/' + packaging | 10 | |
11 | 11 | for arch in package_archs.split(): | |
12 | for arch in package_archs.split(): | 12 | pkgdata_dir = tmpdir + '/pkgdata/' + arch + target_vendor + '-' + target_os + '/runtime/' |
13 | pkgdata_dir = tmpdir + '/pkgdata/' + arch + target_vendor + '-' + target_os + '/runtime/' | 13 | if os.path.exists(pkgdata_dir): |
14 | if os.path.exists(pkgdata_dir): | 14 | for root, dirs, files in os.walk(pkgdata_dir): |
15 | for root, dirs, files in os.walk(pkgdata_dir): | 15 | for pkgname in files: |
16 | for pkgname in files: | 16 | if pkgname.endswith('.packaged'): |
17 | if pkgname.endswith('.packaged'): | 17 | pkgname = pkgname[:-9] |
18 | pkgname = pkgname[:-9] | 18 | pkgdatafile = root + pkgname |
19 | pkgdatafile = root + pkgname | 19 | try: |
20 | try: | 20 | sdata = oe.packagedata.read_pkgdatafile(pkgdatafile) |
21 | sdata = oe.packagedata.read_pkgdatafile(pkgdatafile) | 21 | sdata['PKG'] = pkgname |
22 | sdata['PKG'] = pkgname | 22 | pkginfolist.append(sdata) |
23 | pkginfolist.append(sdata) | 23 | except Exception as e: |
24 | except Exception as e: | 24 | bb.warn("Failed to read pkgdata file %s: %s: %s" % (pkgdatafile, e.__class__, str(e))) |
25 | bb.warn("Failed to read pkgdata file %s: %s: %s" % (pkgdatafile, e.__class__, str(e))) | 25 | bb.event.fire(bb.event.PackageInfo(pkginfolist), e.data) |
26 | bb.event.fire(bb.event.PackageInfo(pkginfolist), e.data) | ||
27 | } | 26 | } |
28 | 27 | ||
29 | addhandler packageinfo_handler | 28 | addhandler packageinfo_handler |
29 | packageinfo_handler[eventmask] = "bb.event.RequestPackageInfo" | ||