diff options
-rw-r--r-- | meta/classes/base.bbclass | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index d8711ad97f..5efa6c2128 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -12,7 +12,7 @@ def base_path_join(a, *p): | |||
12 | 12 | ||
13 | # for MD5/SHA handling | 13 | # for MD5/SHA handling |
14 | def base_chk_load_parser(config_path): | 14 | def base_chk_load_parser(config_path): |
15 | import ConfigParser, os, bb | 15 | import ConfigParser |
16 | parser = ConfigParser.ConfigParser() | 16 | parser = ConfigParser.ConfigParser() |
17 | if not len(parser.read(config_path)) == 1: | 17 | if not len(parser.read(config_path)) == 1: |
18 | bb.note("Can not open the '%s' ini file" % config_path) | 18 | bb.note("Can not open the '%s' ini file" % config_path) |
@@ -21,7 +21,6 @@ def base_chk_load_parser(config_path): | |||
21 | return parser | 21 | return parser |
22 | 22 | ||
23 | def base_chk_file(parser, pn, pv, src_uri, localpath, data): | 23 | def base_chk_file(parser, pn, pv, src_uri, localpath, data): |
24 | import os, bb | ||
25 | no_checksum = False | 24 | no_checksum = False |
26 | # Try PN-PV-SRC_URI first and then try PN-SRC_URI | 25 | # Try PN-PV-SRC_URI first and then try PN-SRC_URI |
27 | # we rely on the get method to create errors | 26 | # we rely on the get method to create errors |
@@ -85,7 +84,6 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): | |||
85 | 84 | ||
86 | 85 | ||
87 | def base_dep_prepend(d): | 86 | def base_dep_prepend(d): |
88 | import bb | ||
89 | # | 87 | # |
90 | # Ideally this will check a flag so we will operate properly in | 88 | # Ideally this will check a flag so we will operate properly in |
91 | # the case where host == build == target, for now we don't work in | 89 | # the case where host == build == target, for now we don't work in |
@@ -115,7 +113,6 @@ def base_dep_prepend(d): | |||
115 | return deps | 113 | return deps |
116 | 114 | ||
117 | def base_read_file(filename): | 115 | def base_read_file(filename): |
118 | import bb | ||
119 | try: | 116 | try: |
120 | f = file( filename, "r" ) | 117 | f = file( filename, "r" ) |
121 | except IOError, reason: | 118 | except IOError, reason: |
@@ -125,21 +122,18 @@ def base_read_file(filename): | |||
125 | return None | 122 | return None |
126 | 123 | ||
127 | def base_conditional(variable, checkvalue, truevalue, falsevalue, d): | 124 | def base_conditional(variable, checkvalue, truevalue, falsevalue, d): |
128 | import bb | ||
129 | if bb.data.getVar(variable,d,1) == checkvalue: | 125 | if bb.data.getVar(variable,d,1) == checkvalue: |
130 | return truevalue | 126 | return truevalue |
131 | else: | 127 | else: |
132 | return falsevalue | 128 | return falsevalue |
133 | 129 | ||
134 | def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): | 130 | def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): |
135 | import bb | ||
136 | if float(bb.data.getVar(variable,d,1)) <= float(checkvalue): | 131 | if float(bb.data.getVar(variable,d,1)) <= float(checkvalue): |
137 | return truevalue | 132 | return truevalue |
138 | else: | 133 | else: |
139 | return falsevalue | 134 | return falsevalue |
140 | 135 | ||
141 | def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): | 136 | def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): |
142 | import bb | ||
143 | result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue) | 137 | result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue) |
144 | if result <= 0: | 138 | if result <= 0: |
145 | return truevalue | 139 | return truevalue |
@@ -147,7 +141,6 @@ def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): | |||
147 | return falsevalue | 141 | return falsevalue |
148 | 142 | ||
149 | def base_contains(variable, checkvalues, truevalue, falsevalue, d): | 143 | def base_contains(variable, checkvalues, truevalue, falsevalue, d): |
150 | import bb | ||
151 | matches = 0 | 144 | matches = 0 |
152 | if type(checkvalues).__name__ == "str": | 145 | if type(checkvalues).__name__ == "str": |
153 | checkvalues = [checkvalues] | 146 | checkvalues = [checkvalues] |
@@ -159,7 +152,6 @@ def base_contains(variable, checkvalues, truevalue, falsevalue, d): | |||
159 | return falsevalue | 152 | return falsevalue |
160 | 153 | ||
161 | def base_both_contain(variable1, variable2, checkvalue, d): | 154 | def base_both_contain(variable1, variable2, checkvalue, d): |
162 | import bb | ||
163 | if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1: | 155 | if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1: |
164 | return checkvalue | 156 | return checkvalue |
165 | else: | 157 | else: |
@@ -176,7 +168,6 @@ def base_prune_suffix(var, suffixes, d): | |||
176 | return var | 168 | return var |
177 | 169 | ||
178 | def base_set_filespath(path, d): | 170 | def base_set_filespath(path, d): |
179 | import os, bb | ||
180 | filespath = [] | 171 | filespath = [] |
181 | # The ":" ensures we have an 'empty' override | 172 | # The ":" ensures we have an 'empty' override |
182 | overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":" | 173 | overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":" |
@@ -399,7 +390,6 @@ oe_libinstall() { | |||
399 | } | 390 | } |
400 | 391 | ||
401 | def package_stagefile(file, d): | 392 | def package_stagefile(file, d): |
402 | import bb, os | ||
403 | 393 | ||
404 | if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1": | 394 | if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1": |
405 | destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1)) | 395 | destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1)) |
@@ -475,7 +465,6 @@ python base_do_clean() { | |||
475 | } | 465 | } |
476 | 466 | ||
477 | addtask rebuild after do_${BB_DEFAULT_TASK} | 467 | addtask rebuild after do_${BB_DEFAULT_TASK} |
478 | addtask rebuild | ||
479 | do_rebuild[dirs] = "${TOPDIR}" | 468 | do_rebuild[dirs] = "${TOPDIR}" |
480 | do_rebuild[nostamp] = "1" | 469 | do_rebuild[nostamp] = "1" |
481 | python base_do_rebuild() { | 470 | python base_do_rebuild() { |
@@ -634,7 +623,7 @@ def subprocess_setup(): | |||
634 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | 623 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
635 | 624 | ||
636 | def oe_unpack_file(file, data, url = None): | 625 | def oe_unpack_file(file, data, url = None): |
637 | import bb, os, subprocess | 626 | import subprocess |
638 | if not url: | 627 | if not url: |
639 | url = "file://%s" % file | 628 | url = "file://%s" % file |
640 | dots = file.split(".") | 629 | dots = file.split(".") |
@@ -709,7 +698,7 @@ def oe_unpack_file(file, data, url = None): | |||
709 | addtask unpack after do_fetch | 698 | addtask unpack after do_fetch |
710 | do_unpack[dirs] = "${WORKDIR}" | 699 | do_unpack[dirs] = "${WORKDIR}" |
711 | python base_do_unpack() { | 700 | python base_do_unpack() { |
712 | import re, os | 701 | import re |
713 | 702 | ||
714 | localdata = bb.data.createCopy(d) | 703 | localdata = bb.data.createCopy(d) |
715 | bb.data.update_data(localdata) | 704 | bb.data.update_data(localdata) |
@@ -730,7 +719,6 @@ python base_do_unpack() { | |||
730 | } | 719 | } |
731 | 720 | ||
732 | def base_get_scmbasepath(d): | 721 | def base_get_scmbasepath(d): |
733 | import bb | ||
734 | path_to_bbfiles = bb.data.getVar( 'BBFILES', d, 1 ).split() | 722 | path_to_bbfiles = bb.data.getVar( 'BBFILES', d, 1 ).split() |
735 | return path_to_bbfiles[0][:path_to_bbfiles[0].rindex( "packages" )] | 723 | return path_to_bbfiles[0][:path_to_bbfiles[0].rindex( "packages" )] |
736 | 724 | ||
@@ -765,7 +753,6 @@ def base_get_metadata_svn_revision(d): | |||
765 | return revision | 753 | return revision |
766 | 754 | ||
767 | def base_get_metadata_git_branch(d): | 755 | def base_get_metadata_git_branch(d): |
768 | import os | ||
769 | branch = os.popen('cd %s; git branch | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read() | 756 | branch = os.popen('cd %s; git branch | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read() |
770 | 757 | ||
771 | if len(branch) != 0: | 758 | if len(branch) != 0: |
@@ -773,7 +760,6 @@ def base_get_metadata_git_branch(d): | |||
773 | return "<unknown>" | 760 | return "<unknown>" |
774 | 761 | ||
775 | def base_get_metadata_git_revision(d): | 762 | def base_get_metadata_git_revision(d): |
776 | import os | ||
777 | rev = os.popen("cd %s; git log -n 1 --pretty=oneline --" % base_get_scmbasepath(d)).read().split(" ")[0] | 763 | rev = os.popen("cd %s; git log -n 1 --pretty=oneline --" % base_get_scmbasepath(d)).read().split(" ")[0] |
778 | if len(rev) != 0: | 764 | if len(rev) != 0: |
779 | return rev | 765 | return rev |
@@ -808,8 +794,6 @@ METADATA_REVISION ?= "${@base_detect_revision(d)}" | |||
808 | GIT_CONFIG = "${STAGING_DIR_NATIVE}/usr/etc/gitconfig" | 794 | GIT_CONFIG = "${STAGING_DIR_NATIVE}/usr/etc/gitconfig" |
809 | 795 | ||
810 | def generate_git_config(e): | 796 | def generate_git_config(e): |
811 | import bb | ||
812 | import os | ||
813 | from bb import data | 797 | from bb import data |
814 | 798 | ||
815 | if data.getVar('GIT_CORE_CONFIG', e.data, True): | 799 | if data.getVar('GIT_CORE_CONFIG', e.data, True): |
@@ -832,7 +816,6 @@ addhandler base_eventhandler | |||
832 | python base_eventhandler() { | 816 | python base_eventhandler() { |
833 | from bb import note, error, data | 817 | from bb import note, error, data |
834 | from bb.event import Handled, NotHandled, getName | 818 | from bb.event import Handled, NotHandled, getName |
835 | import os | ||
836 | 819 | ||
837 | messages = {} | 820 | messages = {} |
838 | messages["Completed"] = "completed" | 821 | messages["Completed"] = "completed" |
@@ -979,7 +962,6 @@ sysroot_stage_all() { | |||
979 | } | 962 | } |
980 | 963 | ||
981 | def is_legacy_staging(d): | 964 | def is_legacy_staging(d): |
982 | import bb | ||
983 | stagefunc = bb.data.getVar('do_stage', d, True) | 965 | stagefunc = bb.data.getVar('do_stage', d, True) |
984 | legacy = True | 966 | legacy = True |
985 | if stagefunc is None: | 967 | if stagefunc is None: |
@@ -1092,7 +1074,7 @@ DISTRO[unexport] = "1" | |||
1092 | 1074 | ||
1093 | 1075 | ||
1094 | def base_after_parse(d): | 1076 | def base_after_parse(d): |
1095 | import bb, os, exceptions | 1077 | import exceptions |
1096 | 1078 | ||
1097 | source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0) | 1079 | source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0) |
1098 | if not source_mirror_fetch: | 1080 | if not source_mirror_fetch: |
@@ -1199,7 +1181,7 @@ def base_after_parse(d): | |||
1199 | python () { | 1181 | python () { |
1200 | base_after_parse(d) | 1182 | base_after_parse(d) |
1201 | if is_legacy_staging(d): | 1183 | if is_legacy_staging(d): |
1202 | bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) | 1184 | bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) |
1203 | } | 1185 | } |
1204 | 1186 | ||
1205 | def check_app_exists(app, d): | 1187 | def check_app_exists(app, d): |