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:22 +0100 |
commit | bff73743280f9eafebe4591f7368ead91a4eb74d (patch) | |
tree | 59ebd0fa20f3e0345951c097ea69d6a485249190 /meta/classes/distrodata.bbclass | |
parent | 8b90f1becd40a7f857d2fbe30eaffe218a976419 (diff) | |
download | openembedded-core-bff73743280f9eafebe4591f7368ead91a4eb74d.tar.gz openembedded-core-bff73743280f9eafebe4591f7368ead91a4eb74d.tar.bz2 openembedded-core-bff73743280f9eafebe4591f7368ead91a4eb74d.zip |
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-rw-r--r-- | meta/classes/distrodata.bbclass | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index cedacc214c..3ff62684aa 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass @@ -1,15 +1,14 @@ include conf/distro/include/package_regex.inc addhandler distro_eventhandler +distro_eventhandler[eventmask] = "bb.event.BuildStarted" python distro_eventhandler() { - - if bb.event.getName(e) == "BuildStarted": - import oe.distro_check as dc - logfile = dc.create_log_file(e.data, "distrodata.csv") - lf = bb.utils.lockfile("%s.lock" % logfile) - f = open(logfile, "a") - f.write("Package,Description,Owner,License,VerMatch,Version,Upsteam,Reason,Recipe Status,Distro 1,Distro 2,Distro 3\n") - f.close() - bb.utils.unlockfile(lf) + import oe.distro_check as dc + logfile = dc.create_log_file(e.data, "distrodata.csv") + lf = bb.utils.lockfile("%s.lock" % logfile) + f = open(logfile, "a") + f.write("Package,Description,Owner,License,VerMatch,Version,Upsteam,Reason,Recipe Status,Distro 1,Distro 2,Distro 3\n") + f.close() + bb.utils.unlockfile(lf) return } @@ -197,6 +196,7 @@ do_distrodataall() { } addhandler checkpkg_eventhandler + checkpkg_eventhandler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted" python checkpkg_eventhandler() { def parse_csv_file(filename): package_dict = {} @@ -793,11 +793,11 @@ do_checkpkgall() { } addhandler distro_check_eventhandler +distro_check_eventhandler bb.event.BuildStarted python distro_check_eventhandler() { - if bb.event.getName(e) == "BuildStarted": - """initialize log files.""" - import oe.distro_check as dc - result_file = dc.create_log_file(e.data, "distrocheck.csv") + """initialize log files.""" + import oe.distro_check as dc + result_file = dc.create_log_file(e.data, "distrocheck.csv") return } @@ -839,16 +839,16 @@ do_distro_checkall() { #then we can search those recipes which license text isn't exsit in common-licenses directory # addhandler checklicense_eventhandler +checklicense_eventhandler[eventmask] = "bb.event.BuildStarted" python checklicense_eventhandler() { - if bb.event.getName(e) == "BuildStarted": - """initialize log files.""" - import oe.distro_check as dc - logfile = dc.create_log_file(e.data, "missinglicense.csv") - lf = bb.utils.lockfile("%s.lock" % logfile) - f = open(logfile, "a") - f.write("Package\tLicense\tMissingLicense\n") - f.close() - bb.utils.unlockfile(lf) + """initialize log files.""" + import oe.distro_check as dc + logfile = dc.create_log_file(e.data, "missinglicense.csv") + lf = bb.utils.lockfile("%s.lock" % logfile) + f = open(logfile, "a") + f.write("Package\tLicense\tMissingLicense\n") + f.close() + bb.utils.unlockfile(lf) return } |