diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-07-18 13:08:48 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-07-19 12:24:50 +0100 |
| commit | 73cf0335c463758379765fa5f26a4484afaca8a0 (patch) | |
| tree | eed499207c71f925dfad21d1c4e58cbb1ec22d53 /meta/classes | |
| parent | 7b2c67874e03bc378c6def5cf1558238134e1b61 (diff) | |
| download | poky-73cf0335c463758379765fa5f26a4484afaca8a0.tar.gz | |
Remove a number of unneeded import os/bb calls
The bb and os modules are always imported so having these extra import calls
are a waste of space/execution time. They also set a bad example for people
copy and pasting code so clean them up.
(From OE-Core rev: 7d674820958be3a7051ea619effe1a6061d9cbe2)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/archiver.bbclass | 3 | ||||
| -rw-r--r-- | meta/classes/base.bbclass | 10 | ||||
| -rw-r--r-- | meta/classes/bugzilla.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 3 | ||||
| -rw-r--r-- | meta/classes/copyleft_compliance.bbclass | 1 | ||||
| -rw-r--r-- | meta/classes/distrodata.bbclass | 3 | ||||
| -rw-r--r-- | meta/classes/imagetest-qemu.bbclass | 1 | ||||
| -rw-r--r-- | meta/classes/kernel-yocto.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/libc-package.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/license.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/package.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/package_rpm.bbclass | 3 | ||||
| -rw-r--r-- | meta/classes/qemu.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/recipe_sanity.bbclass | 5 | ||||
| -rw-r--r-- | meta/classes/sanity.bbclass | 7 | ||||
| -rw-r--r-- | meta/classes/tinderclient.bbclass | 98 |
16 files changed, 54 insertions, 92 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 2b5404f1da..8e97e447c9 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass | |||
| @@ -76,7 +76,6 @@ def tar_filter(d): | |||
| 76 | def get_bb_inc(d): | 76 | def get_bb_inc(d): |
| 77 | '''create a directory "script-logs" including .bb and .inc file in ${WORKDIR}''' | 77 | '''create a directory "script-logs" including .bb and .inc file in ${WORKDIR}''' |
| 78 | import re | 78 | import re |
| 79 | import os | ||
| 80 | import shutil | 79 | import shutil |
| 81 | 80 | ||
| 82 | bbinc = [] | 81 | bbinc = [] |
| @@ -154,7 +153,6 @@ def get_series(d): | |||
| 154 | 153 | ||
| 155 | def get_applying_patches(d): | 154 | def get_applying_patches(d): |
| 156 | """only copy applying patches to a pointed directory which will be archived to tarball""" | 155 | """only copy applying patches to a pointed directory which will be archived to tarball""" |
| 157 | import os | ||
| 158 | import shutil | 156 | import shutil |
| 159 | 157 | ||
| 160 | 158 | ||
| @@ -174,7 +172,6 @@ def get_applying_patches(d): | |||
| 174 | 172 | ||
| 175 | def not_tarball(d): | 173 | def not_tarball(d): |
| 176 | '''packages including key words 'work-shared','native', 'task-' will be passed''' | 174 | '''packages including key words 'work-shared','native', 'task-' will be passed''' |
| 177 | import os | ||
| 178 | 175 | ||
| 179 | workdir = d.getVar('WORKDIR',True) | 176 | workdir = d.getVar('WORKDIR',True) |
| 180 | s = d.getVar('S',True) | 177 | s = d.getVar('S',True) |
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index f3587bcbef..1f7602394e 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
| @@ -14,7 +14,7 @@ OE_IMPORTS += "os sys time oe.path oe.utils oe.data oe.packagegroup oe.sstatesig | |||
| 14 | OE_IMPORTS[type] = "list" | 14 | OE_IMPORTS[type] = "list" |
| 15 | 15 | ||
| 16 | def oe_import(d): | 16 | def oe_import(d): |
| 17 | import os, sys | 17 | import sys |
| 18 | 18 | ||
| 19 | bbpath = d.getVar("BBPATH", True).split(":") | 19 | bbpath = d.getVar("BBPATH", True).split(":") |
| 20 | sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath] | 20 | sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath] |
| @@ -117,11 +117,9 @@ GIT_CONFIG_PATH = "${STAGING_DIR_NATIVE}/etc" | |||
| 117 | GIT_CONFIG = "${GIT_CONFIG_PATH}/gitconfig" | 117 | GIT_CONFIG = "${GIT_CONFIG_PATH}/gitconfig" |
| 118 | 118 | ||
| 119 | def generate_git_config(e): | 119 | def generate_git_config(e): |
| 120 | from bb import data | 120 | if e.data.getVar('GIT_CORE_CONFIG', True): |
| 121 | |||
| 122 | if data.getVar('GIT_CORE_CONFIG', e.data, True): | ||
| 123 | gitconfig_path = e.data.getVar('GIT_CONFIG', True) | 121 | gitconfig_path = e.data.getVar('GIT_CONFIG', True) |
| 124 | proxy_command = " gitProxy = %s\n" % data.getVar('OE_GIT_PROXY_COMMAND', e.data, True) | 122 | proxy_command = " gitProxy = %s\n" % e.data.getVar('OE_GIT_PROXY_COMMAND', True) |
| 125 | 123 | ||
| 126 | bb.mkdirhier(e.data.expand("${GIT_CONFIG_PATH}")) | 124 | bb.mkdirhier(e.data.expand("${GIT_CONFIG_PATH}")) |
| 127 | if (os.path.exists(gitconfig_path)): | 125 | if (os.path.exists(gitconfig_path)): |
| @@ -129,7 +127,7 @@ def generate_git_config(e): | |||
| 129 | 127 | ||
| 130 | f = open(gitconfig_path, 'w') | 128 | f = open(gitconfig_path, 'w') |
| 131 | f.write("[core]\n") | 129 | f.write("[core]\n") |
| 132 | ignore_hosts = data.getVar('GIT_PROXY_IGNORE', e.data, True).split() | 130 | ignore_hosts = e.data.getVar('GIT_PROXY_IGNORE', True).split() |
| 133 | for ignore_host in ignore_hosts: | 131 | for ignore_host in ignore_hosts: |
| 134 | f.write(" gitProxy = none for %s\n" % ignore_host) | 132 | f.write(" gitProxy = none for %s\n" % ignore_host) |
| 135 | f.write(proxy_command) | 133 | f.write(proxy_command) |
diff --git a/meta/classes/bugzilla.bbclass b/meta/classes/bugzilla.bbclass index 4028d261c8..6806dcd682 100644 --- a/meta/classes/bugzilla.bbclass +++ b/meta/classes/bugzilla.bbclass | |||
| @@ -72,7 +72,7 @@ def bugzilla_add_comment(debug_file, server, args, bug_number, text): | |||
| 72 | 72 | ||
| 73 | addhandler bugzilla_eventhandler | 73 | addhandler bugzilla_eventhandler |
| 74 | python bugzilla_eventhandler() { | 74 | python bugzilla_eventhandler() { |
| 75 | import bb, os, glob | 75 | import glob |
| 76 | import xmlrpclib, httplib | 76 | import xmlrpclib, httplib |
| 77 | 77 | ||
| 78 | class ProxiedTransport(xmlrpclib.Transport): | 78 | class ProxiedTransport(xmlrpclib.Transport): |
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index d2d19ff9cd..916aae6bad 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
| @@ -414,9 +414,6 @@ buildhistory_commit() { | |||
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | python buildhistory_eventhandler() { | 416 | python buildhistory_eventhandler() { |
| 417 | import bb.build | ||
| 418 | import bb.event | ||
| 419 | |||
| 420 | if isinstance(e, bb.event.BuildCompleted): | 417 | if isinstance(e, bb.event.BuildCompleted): |
| 421 | if e.data.getVar('BUILDHISTORY_FEATURES', True).strip(): | 418 | if e.data.getVar('BUILDHISTORY_FEATURES', True).strip(): |
| 422 | if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1": | 419 | if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1": |
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass index 3ca7337b55..c59cb7ad91 100644 --- a/meta/classes/copyleft_compliance.bbclass +++ b/meta/classes/copyleft_compliance.bbclass | |||
| @@ -58,7 +58,6 @@ def copyleft_should_include(d): | |||
| 58 | 58 | ||
| 59 | python do_prepare_copyleft_sources () { | 59 | python do_prepare_copyleft_sources () { |
| 60 | """Populate a tree of the recipe sources and emit patch series files""" | 60 | """Populate a tree of the recipe sources and emit patch series files""" |
| 61 | import os.path | ||
| 62 | import shutil | 61 | import shutil |
| 63 | 62 | ||
| 64 | p = d.getVar('P', True) | 63 | p = d.getVar('P', True) |
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index 7b212c9452..f196df5f56 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass | |||
| @@ -654,7 +654,6 @@ do_distro_check[nostamp] = "1" | |||
| 654 | python do_distro_check() { | 654 | python do_distro_check() { |
| 655 | """checks if the package is present in other public Linux distros""" | 655 | """checks if the package is present in other public Linux distros""" |
| 656 | import oe.distro_check as dc | 656 | import oe.distro_check as dc |
| 657 | import bb | ||
| 658 | import shutil | 657 | import shutil |
| 659 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('nativesdk',d): | 658 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('nativesdk',d): |
| 660 | return | 659 | return |
| @@ -704,8 +703,6 @@ python checklicense_eventhandler() { | |||
| 704 | addtask checklicense | 703 | addtask checklicense |
| 705 | do_checklicense[nostamp] = "1" | 704 | do_checklicense[nostamp] = "1" |
| 706 | python do_checklicense() { | 705 | python do_checklicense() { |
| 707 | import os | ||
| 708 | import bb | ||
| 709 | import shutil | 706 | import shutil |
| 710 | logpath = d.getVar('LOG_DIR', True) | 707 | logpath = d.getVar('LOG_DIR', True) |
| 711 | bb.utils.mkdirhier(logpath) | 708 | bb.utils.mkdirhier(logpath) |
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass index f51eeba98c..7ece8868a1 100644 --- a/meta/classes/imagetest-qemu.bbclass +++ b/meta/classes/imagetest-qemu.bbclass | |||
| @@ -26,7 +26,6 @@ do_qemuimagetest_standalone[depends] += "qemu-native:do_populate_sysroot" | |||
| 26 | def qemuimagetest_main(d): | 26 | def qemuimagetest_main(d): |
| 27 | import sys | 27 | import sys |
| 28 | import re | 28 | import re |
| 29 | import os | ||
| 30 | import shutil | 29 | import shutil |
| 31 | import subprocess | 30 | import subprocess |
| 32 | 31 | ||
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index ab59fc8f13..d914b11bef 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass | |||
| @@ -188,7 +188,7 @@ do_kernel_configme() { | |||
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | python do_kernel_configcheck() { | 190 | python do_kernel_configcheck() { |
| 191 | import bb, re, string, sys, commands | 191 | import re, string, sys, commands |
| 192 | 192 | ||
| 193 | bb.plain("NOTE: validating kernel configuration") | 193 | bb.plain("NOTE: validating kernel configuration") |
| 194 | 194 | ||
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index e3214a68a2..70490efc77 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass | |||
| @@ -118,7 +118,7 @@ do_collect_bins_from_locale_tree() { | |||
| 118 | inherit qemu | 118 | inherit qemu |
| 119 | 119 | ||
| 120 | python package_do_split_gconvs () { | 120 | python package_do_split_gconvs () { |
| 121 | import os, re | 121 | import re |
| 122 | if (d.getVar('PACKAGE_NO_GCONV', True) == '1'): | 122 | if (d.getVar('PACKAGE_NO_GCONV', True) == '1'): |
| 123 | bb.note("package requested not splitting gconvs") | 123 | bb.note("package requested not splitting gconvs") |
| 124 | return | 124 | return |
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass index 03e413b3b8..a2721ab0af 100644 --- a/meta/classes/license.bbclass +++ b/meta/classes/license.bbclass | |||
| @@ -143,8 +143,6 @@ python do_populate_lic() { | |||
| 143 | """ | 143 | """ |
| 144 | Populate LICENSE_DIRECTORY with licenses. | 144 | Populate LICENSE_DIRECTORY with licenses. |
| 145 | """ | 145 | """ |
| 146 | import os | ||
| 147 | import bb | ||
| 148 | import shutil | 146 | import shutil |
| 149 | import oe.license | 147 | import oe.license |
| 150 | 148 | ||
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index a51e955325..fc834242da 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
| @@ -444,7 +444,7 @@ python perform_packagecopy () { | |||
| 444 | # seeding this list with reasonable defaults, then load from | 444 | # seeding this list with reasonable defaults, then load from |
| 445 | # the fs-perms.txt files | 445 | # the fs-perms.txt files |
| 446 | python fixup_perms () { | 446 | python fixup_perms () { |
| 447 | import os, pwd, grp | 447 | import pwd, grp |
| 448 | 448 | ||
| 449 | # init using a string with the same format as a line as documented in | 449 | # init using a string with the same format as a line as documented in |
| 450 | # the fs-perms.txt file | 450 | # the fs-perms.txt file |
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index b20df0f243..d213e40dee 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
| @@ -637,7 +637,6 @@ python write_specfile () { | |||
| 637 | array.append("%s: %s" % (tag, dep)) | 637 | array.append("%s: %s" % (tag, dep)) |
| 638 | 638 | ||
| 639 | def walk_files(walkpath, target, conffiles): | 639 | def walk_files(walkpath, target, conffiles): |
| 640 | import os | ||
| 641 | for rootpath, dirs, files in os.walk(walkpath): | 640 | for rootpath, dirs, files in os.walk(walkpath): |
| 642 | path = rootpath.replace(walkpath, "") | 641 | path = rootpath.replace(walkpath, "") |
| 643 | for dir in dirs: | 642 | for dir in dirs: |
| @@ -996,8 +995,6 @@ python write_specfile () { | |||
| 996 | } | 995 | } |
| 997 | 996 | ||
| 998 | python do_package_rpm () { | 997 | python do_package_rpm () { |
| 999 | import os | ||
| 1000 | |||
| 1001 | def creat_srpm_dir(d): | 998 | def creat_srpm_dir(d): |
| 1002 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': | 999 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': |
| 1003 | clean_licenses = get_licenses(d) | 1000 | clean_licenses = get_licenses(d) |
diff --git a/meta/classes/qemu.bbclass b/meta/classes/qemu.bbclass index 0e75ac4e38..68896ce5fb 100644 --- a/meta/classes/qemu.bbclass +++ b/meta/classes/qemu.bbclass | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | def qemu_target_binary(data): | 6 | def qemu_target_binary(data): |
| 7 | import bb | ||
| 8 | |||
| 9 | target_arch = data.getVar("TARGET_ARCH", True) | 7 | target_arch = data.getVar("TARGET_ARCH", True) |
| 10 | if target_arch in ("i486", "i586", "i686"): | 8 | if target_arch in ("i486", "i586", "i686"): |
| 11 | target_arch = "i386" | 9 | target_arch = "i386" |
diff --git a/meta/classes/recipe_sanity.bbclass b/meta/classes/recipe_sanity.bbclass index 61e07bf043..63e9e7ff23 100644 --- a/meta/classes/recipe_sanity.bbclass +++ b/meta/classes/recipe_sanity.bbclass | |||
| @@ -55,7 +55,6 @@ def can_use_autotools_base(cfgdata, d): | |||
| 55 | if cfg.find(i) != -1: | 55 | if cfg.find(i) != -1: |
| 56 | return False | 56 | return False |
| 57 | 57 | ||
| 58 | import os | ||
| 59 | for clsfile in d.getVar("__inherit_cache", 0): | 58 | for clsfile in d.getVar("__inherit_cache", 0): |
| 60 | (base, _) = os.path.splitext(os.path.basename(clsfile)) | 59 | (base, _) = os.path.splitext(os.path.basename(clsfile)) |
| 61 | if cfg.find("%s_do_configure" % base) != -1: | 60 | if cfg.find("%s_do_configure" % base) != -1: |
| @@ -146,9 +145,7 @@ do_recipe_sanity_all () { | |||
| 146 | addtask recipe_sanity_all after do_recipe_sanity | 145 | addtask recipe_sanity_all after do_recipe_sanity |
| 147 | 146 | ||
| 148 | python recipe_sanity_eh () { | 147 | python recipe_sanity_eh () { |
| 149 | from bb.event import getName | 148 | if bb.event.getName(e) != "ConfigParsed": |
| 150 | |||
| 151 | if getName(e) != "ConfigParsed": | ||
| 152 | return | 149 | return |
| 153 | 150 | ||
| 154 | d = e.data | 151 | d = e.data |
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index 630e0e3d6e..6ef5450ef8 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass | |||
| @@ -254,8 +254,6 @@ def check_supported_distro(sanity_data): | |||
| 254 | 254 | ||
| 255 | # Checks we should only make if MACHINE is set correctly | 255 | # Checks we should only make if MACHINE is set correctly |
| 256 | def check_sanity_validmachine(sanity_data): | 256 | def check_sanity_validmachine(sanity_data): |
| 257 | from bb import data | ||
| 258 | |||
| 259 | messages = "" | 257 | messages = "" |
| 260 | 258 | ||
| 261 | # Check TUNE_ARCH is set | 259 | # Check TUNE_ARCH is set |
| @@ -291,7 +289,6 @@ def check_sanity_validmachine(sanity_data): | |||
| 291 | 289 | ||
| 292 | 290 | ||
| 293 | def check_sanity(sanity_data): | 291 | def check_sanity(sanity_data): |
| 294 | from bb import note, error, data, __version__ | ||
| 295 | import subprocess | 292 | import subprocess |
| 296 | 293 | ||
| 297 | try: | 294 | try: |
| @@ -319,8 +316,8 @@ def check_sanity(sanity_data): | |||
| 319 | if sys.hexversion < 0x020600F0: | 316 | if sys.hexversion < 0x020600F0: |
| 320 | messages = messages + 'The system requires at least Python 2.6 to run. Please update your Python interpreter.\n' | 317 | messages = messages + 'The system requires at least Python 2.6 to run. Please update your Python interpreter.\n' |
| 321 | 318 | ||
| 322 | if (LooseVersion(__version__) < LooseVersion(minversion)): | 319 | if (LooseVersion(bb.__version__) < LooseVersion(minversion)): |
| 323 | messages = messages + 'Bitbake version %s is required and version %s was found\n' % (minversion, __version__) | 320 | messages = messages + 'Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__) |
| 324 | 321 | ||
| 325 | # Check that the MACHINE is valid, if it is set | 322 | # Check that the MACHINE is valid, if it is set |
| 326 | if sanity_data.getVar('MACHINE', True): | 323 | if sanity_data.getVar('MACHINE', True): |
diff --git a/meta/classes/tinderclient.bbclass b/meta/classes/tinderclient.bbclass index 1027c7cef4..e57bc48c3b 100644 --- a/meta/classes/tinderclient.bbclass +++ b/meta/classes/tinderclient.bbclass | |||
| @@ -55,22 +55,22 @@ def tinder_format_http_post(d,status,log): | |||
| 55 | 55 | ||
| 56 | # the variables we will need to send on this form post | 56 | # the variables we will need to send on this form post |
| 57 | variables = { | 57 | variables = { |
| 58 | "tree" : data.getVar('TINDER_TREE', d, True), | 58 | "tree" : d.getVar('TINDER_TREE', True), |
| 59 | "machine_name" : data.getVar('TINDER_MACHINE', d, True), | 59 | "machine_name" : d.getVar('TINDER_MACHINE', True), |
| 60 | "os" : os.uname()[0], | 60 | "os" : os.uname()[0], |
| 61 | "os_version" : os.uname()[2], | 61 | "os_version" : os.uname()[2], |
| 62 | "compiler" : "gcc", | 62 | "compiler" : "gcc", |
| 63 | "clobber" : data.getVar('TINDER_CLOBBER', d, True) or "0", | 63 | "clobber" : d.getVar('TINDER_CLOBBER', True) or "0", |
| 64 | "srcdate" : data.getVar('SRCDATE', d, True), | 64 | "srcdate" : d.getVar('SRCDATE', True), |
| 65 | "PN" : data.getVar('PN', d, True), | 65 | "PN" : d.getVar('PN', True), |
| 66 | "PV" : data.getVar('PV', d, True), | 66 | "PV" : d.getVar('PV', True), |
| 67 | "PR" : data.getVar('PR', d, True), | 67 | "PR" : d.getVar('PR', True), |
| 68 | "FILE" : data.getVar('FILE', d, True) or "N/A", | 68 | "FILE" : d.getVar('FILE', True) or "N/A", |
| 69 | "TARGETARCH" : data.getVar('TARGET_ARCH', d, True), | 69 | "TARGETARCH" : d.getVar('TARGET_ARCH', True), |
| 70 | "TARGETFPU" : data.getVar('TARGET_FPU', d, True) or "Unknown", | 70 | "TARGETFPU" : d.getVar('TARGET_FPU', True) or "Unknown", |
| 71 | "TARGETOS" : data.getVar('TARGET_OS', d, True) or "Unknown", | 71 | "TARGETOS" : d.getVar('TARGET_OS', True) or "Unknown", |
| 72 | "MACHINE" : data.getVar('MACHINE', d, True) or "Unknown", | 72 | "MACHINE" : d.getVar('MACHINE', True) or "Unknown", |
| 73 | "DISTRO" : data.getVar('DISTRO', d, True) or "Unknown", | 73 | "DISTRO" : d.getVar('DISTRO', True) or "Unknown", |
| 74 | "zecke-rocks" : "sure", | 74 | "zecke-rocks" : "sure", |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -82,7 +82,7 @@ def tinder_format_http_post(d,status,log): | |||
| 82 | # we only need on build_status.pl but sending it | 82 | # we only need on build_status.pl but sending it |
| 83 | # always does not hurt | 83 | # always does not hurt |
| 84 | try: | 84 | try: |
| 85 | f = file(data.getVar('TMPDIR',d,True)+'/tinder-machine.id', 'r') | 85 | f = file(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r') |
| 86 | id = f.read() | 86 | id = f.read() |
| 87 | variables['machine_id'] = id | 87 | variables['machine_id'] = id |
| 88 | except: | 88 | except: |
| @@ -103,12 +103,11 @@ def tinder_build_start(d): | |||
| 103 | by posting our name and tree to the build_start.pl script | 103 | by posting our name and tree to the build_start.pl script |
| 104 | on the server. | 104 | on the server. |
| 105 | """ | 105 | """ |
| 106 | from bb import data | ||
| 107 | 106 | ||
| 108 | # get the body and type | 107 | # get the body and type |
| 109 | content_type, body = tinder_format_http_post(d,None,None) | 108 | content_type, body = tinder_format_http_post(d,None,None) |
| 110 | server = data.getVar('TINDER_HOST', d, True ) | 109 | server = d.getVar('TINDER_HOST', True ) |
| 111 | url = data.getVar('TINDER_URL', d, True ) | 110 | url = d.getVar('TINDER_URL', True ) |
| 112 | 111 | ||
| 113 | selector = url + "/xml/build_start.pl" | 112 | selector = url + "/xml/build_start.pl" |
| 114 | 113 | ||
| @@ -128,7 +127,7 @@ def tinder_build_start(d): | |||
| 128 | 127 | ||
| 129 | # now we will need to save the machine number | 128 | # now we will need to save the machine number |
| 130 | # we will override any previous numbers | 129 | # we will override any previous numbers |
| 131 | f = file(data.getVar('TMPDIR', d, True)+"/tinder-machine.id", 'w') | 130 | f = file(d.getVar('TMPDIR', True)+"/tinder-machine.id", 'w') |
| 132 | f.write(report) | 131 | f.write(report) |
| 133 | 132 | ||
| 134 | 133 | ||
| @@ -136,12 +135,10 @@ def tinder_send_http(d, status, _log): | |||
| 136 | """ | 135 | """ |
| 137 | Send this log as build status | 136 | Send this log as build status |
| 138 | """ | 137 | """ |
| 139 | from bb import data | ||
| 140 | |||
| 141 | 138 | ||
| 142 | # get the body and type | 139 | # get the body and type |
| 143 | server = data.getVar('TINDER_HOST', d, True ) | 140 | server = d.getVar('TINDER_HOST', True) |
| 144 | url = data.getVar('TINDER_URL', d, True ) | 141 | url = d.getVar('TINDER_URL', True) |
| 145 | 142 | ||
| 146 | selector = url + "/xml/build_status.pl" | 143 | selector = url + "/xml/build_status.pl" |
| 147 | 144 | ||
| @@ -162,22 +159,20 @@ def tinder_print_info(d): | |||
| 162 | we use. | 159 | we use. |
| 163 | """ | 160 | """ |
| 164 | 161 | ||
| 165 | from bb import data | ||
| 166 | # get the local vars | 162 | # get the local vars |
| 167 | |||
| 168 | time = tinder_time_string() | 163 | time = tinder_time_string() |
| 169 | ops = os.uname()[0] | 164 | ops = os.uname()[0] |
| 170 | version = os.uname()[2] | 165 | version = os.uname()[2] |
| 171 | url = data.getVar( 'TINDER_URL' , d, True ) | 166 | url = d.getVar( 'TINDER_URL' , True ) |
| 172 | tree = data.getVar( 'TINDER_TREE', d, True ) | 167 | tree = d.getVar( 'TINDER_TREE', True ) |
| 173 | branch = data.getVar( 'TINDER_BRANCH', d, True ) | 168 | branch = d.getVar( 'TINDER_BRANCH', True ) |
| 174 | srcdate = data.getVar( 'SRCDATE', d, True ) | 169 | srcdate = d.getVar( 'SRCDATE', True ) |
| 175 | machine = data.getVar( 'MACHINE', d, True ) | 170 | machine = d.getVar( 'MACHINE', True ) |
| 176 | distro = data.getVar( 'DISTRO', d, True ) | 171 | distro = d.getVar( 'DISTRO', True ) |
| 177 | bbfiles = data.getVar( 'BBFILES', d, True ) | 172 | bbfiles = d.getVar( 'BBFILES', True ) |
| 178 | tarch = data.getVar( 'TARGET_ARCH', d, True ) | 173 | tarch = d.getVar( 'TARGET_ARCH', True ) |
| 179 | fpu = data.getVar( 'TARGET_FPU', d, True ) | 174 | fpu = d.getVar( 'TARGET_FPU', True ) |
| 180 | oerev = data.getVar( 'OE_REVISION', d, True ) or "unknown" | 175 | oerev = d.getVar( 'OE_REVISION', True ) or "unknown" |
| 181 | 176 | ||
| 182 | # there is a bug with tipple quoted strings | 177 | # there is a bug with tipple quoted strings |
| 183 | # i will work around but will fix the original | 178 | # i will work around but will fix the original |
| @@ -212,8 +207,6 @@ def tinder_print_env(): | |||
| 212 | """ | 207 | """ |
| 213 | Print the environment variables of this build | 208 | Print the environment variables of this build |
| 214 | """ | 209 | """ |
| 215 | from bb import data | ||
| 216 | |||
| 217 | time_start = tinder_time_string() | 210 | time_start = tinder_time_string() |
| 218 | time_end = tinder_time_string() | 211 | time_end = tinder_time_string() |
| 219 | 212 | ||
| @@ -272,12 +265,10 @@ def tinder_do_tinder_report(event): | |||
| 272 | BuildCompleted Event. In this case we have to look up the status and | 265 | BuildCompleted Event. In this case we have to look up the status and |
| 273 | send it instead of 100/success. | 266 | send it instead of 100/success. |
| 274 | """ | 267 | """ |
| 275 | from bb.event import getName | ||
| 276 | from bb import data, mkdirhier, build | ||
| 277 | import glob | 268 | import glob |
| 278 | 269 | ||
| 279 | # variables | 270 | # variables |
| 280 | name = getName(event) | 271 | name = bb.event.getName(event) |
| 281 | log = "" | 272 | log = "" |
| 282 | status = 1 | 273 | status = 1 |
| 283 | # Check what we need to do Build* shows we start or are done | 274 | # Check what we need to do Build* shows we start or are done |
| @@ -287,7 +278,7 @@ def tinder_do_tinder_report(event): | |||
| 287 | 278 | ||
| 288 | try: | 279 | try: |
| 289 | # truncate the tinder log file | 280 | # truncate the tinder log file |
| 290 | f = file(data.getVar('TINDER_LOG', event.data, True), 'w') | 281 | f = file(event.data.getVar('TINDER_LOG', True), 'w') |
| 291 | f.write("") | 282 | f.write("") |
| 292 | f.close() | 283 | f.close() |
| 293 | except: | 284 | except: |
| @@ -296,7 +287,7 @@ def tinder_do_tinder_report(event): | |||
| 296 | try: | 287 | try: |
| 297 | # write a status to the file. This is needed for the -k option | 288 | # write a status to the file. This is needed for the -k option |
| 298 | # of BitBake | 289 | # of BitBake |
| 299 | g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') | 290 | g = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w') |
| 300 | g.write("") | 291 | g.write("") |
| 301 | g.close() | 292 | g.close() |
| 302 | except IOError: | 293 | except IOError: |
| @@ -305,10 +296,10 @@ def tinder_do_tinder_report(event): | |||
| 305 | # Append the Task-Log (compile,configure...) to the log file | 296 | # Append the Task-Log (compile,configure...) to the log file |
| 306 | # we will send to the server | 297 | # we will send to the server |
| 307 | if name == "TaskSucceeded" or name == "TaskFailed": | 298 | if name == "TaskSucceeded" or name == "TaskFailed": |
| 308 | log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task)) | 299 | log_file = glob.glob("%s/log.%s.*" % (event.data.getVar('T', True), event.task)) |
| 309 | 300 | ||
| 310 | if len(log_file) != 0: | 301 | if len(log_file) != 0: |
| 311 | to_file = data.getVar('TINDER_LOG', event.data, True) | 302 | to_file = event.data.getVar('TINDER_LOG', True) |
| 312 | log += "".join(open(log_file[0], 'r').readlines()) | 303 | log += "".join(open(log_file[0], 'r').readlines()) |
| 313 | 304 | ||
| 314 | # set the right 'HEADER'/Summary for the TinderBox | 305 | # set the right 'HEADER'/Summary for the TinderBox |
| @@ -319,23 +310,23 @@ def tinder_do_tinder_report(event): | |||
| 319 | elif name == "TaskFailed": | 310 | elif name == "TaskFailed": |
| 320 | log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task | 311 | log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task |
| 321 | elif name == "PkgStarted": | 312 | elif name == "PkgStarted": |
| 322 | log += "---> TINDERBOX Package %s started\n" % data.getVar('PF', event.data, True) | 313 | log += "---> TINDERBOX Package %s started\n" % event.data.getVar('PF', True) |
| 323 | elif name == "PkgSucceeded": | 314 | elif name == "PkgSucceeded": |
| 324 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('PF', event.data, True) | 315 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % event.data.getVar('PF', True) |
| 325 | elif name == "PkgFailed": | 316 | elif name == "PkgFailed": |
| 326 | if not data.getVar('TINDER_AUTOBUILD', event.data, True) == "0": | 317 | if not event.data.getVar('TINDER_AUTOBUILD', True) == "0": |
| 327 | build.exec_task('do_clean', event.data) | 318 | build.exec_task('do_clean', event.data) |
| 328 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('PF', event.data, True) | 319 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % event.data.getVar('PF', True) |
| 329 | status = 200 | 320 | status = 200 |
| 330 | # remember the failure for the -k case | 321 | # remember the failure for the -k case |
| 331 | h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') | 322 | h = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w') |
| 332 | h.write("200") | 323 | h.write("200") |
| 333 | elif name == "BuildCompleted": | 324 | elif name == "BuildCompleted": |
| 334 | log += "Build Completed\n" | 325 | log += "Build Completed\n" |
| 335 | status = 100 | 326 | status = 100 |
| 336 | # Check if we have a old status... | 327 | # Check if we have a old status... |
| 337 | try: | 328 | try: |
| 338 | h = file(data.getVar('TMPDIR',event.data,True)+'/tinder-status', 'r') | 329 | h = file(event.data.getVar('TMPDIR',True)+'/tinder-status', 'r') |
| 339 | status = int(h.read()) | 330 | status = int(h.read()) |
| 340 | except: | 331 | except: |
| 341 | pass | 332 | pass |
| @@ -351,7 +342,7 @@ def tinder_do_tinder_report(event): | |||
| 351 | log += "Error:Was Runtime: %d\n" % event.isRuntime() | 342 | log += "Error:Was Runtime: %d\n" % event.isRuntime() |
| 352 | status = 200 | 343 | status = 200 |
| 353 | # remember the failure for the -k case | 344 | # remember the failure for the -k case |
| 354 | h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') | 345 | h = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w') |
| 355 | h.write("200") | 346 | h.write("200") |
| 356 | 347 | ||
| 357 | # now post the log | 348 | # now post the log |
| @@ -366,13 +357,10 @@ def tinder_do_tinder_report(event): | |||
| 366 | # we want to be an event handler | 357 | # we want to be an event handler |
| 367 | addhandler tinderclient_eventhandler | 358 | addhandler tinderclient_eventhandler |
| 368 | python tinderclient_eventhandler() { | 359 | python tinderclient_eventhandler() { |
| 369 | from bb import note, error, data | 360 | if e.data is None or bb.event.getName(e) == "MsgNote": |
| 370 | from bb.event import getName | ||
| 371 | |||
| 372 | if e.data is None or getName(e) == "MsgNote": | ||
| 373 | return | 361 | return |
| 374 | 362 | ||
| 375 | do_tinder_report = data.getVar('TINDER_REPORT', e.data, True) | 363 | do_tinder_report = e.data.getVar('TINDER_REPORT', True) |
| 376 | if do_tinder_report and do_tinder_report == "1": | 364 | if do_tinder_report and do_tinder_report == "1": |
| 377 | tinder_do_tinder_report(e) | 365 | tinder_do_tinder_report(e) |
| 378 | 366 | ||
