diff options
Diffstat (limited to 'meta/classes-global')
-rw-r--r-- | meta/classes-global/base.bbclass | 41 | ||||
-rw-r--r-- | meta/classes-global/insane.bbclass | 8 | ||||
-rw-r--r-- | meta/classes-global/sanity.bbclass | 21 | ||||
-rw-r--r-- | meta/classes-global/sstate.bbclass | 32 | ||||
-rw-r--r-- | meta/classes-global/uninative.bbclass | 2 |
5 files changed, 66 insertions, 38 deletions
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass index 8215969c7b..6be1f5c2df 100644 --- a/meta/classes-global/base.bbclass +++ b/meta/classes-global/base.bbclass | |||
@@ -19,6 +19,22 @@ PACKAGECONFIG_CONFARGS ??= "" | |||
19 | 19 | ||
20 | inherit metadata_scm | 20 | inherit metadata_scm |
21 | 21 | ||
22 | PREFERRED_TOOLCHAIN_TARGET ??= "gcc" | ||
23 | PREFERRED_TOOLCHAIN_NATIVE ??= "gcc" | ||
24 | PREFERRED_TOOLCHAIN_SDK ??= "gcc" | ||
25 | |||
26 | PREFERRED_TOOLCHAIN = "${PREFERRED_TOOLCHAIN_TARGET}" | ||
27 | PREFERRED_TOOLCHAIN:class-native = "${PREFERRED_TOOLCHAIN_NATIVE}" | ||
28 | PREFERRED_TOOLCHAIN:class-cross = "${PREFERRED_TOOLCHAIN_NATIVE}" | ||
29 | PREFERRED_TOOLCHAIN:class-crosssdk = "${PREFERRED_TOOLCHAIN_SDK}" | ||
30 | PREFERRED_TOOLCHAIN:class-nativesdk = "${PREFERRED_TOOLCHAIN_SDK}" | ||
31 | |||
32 | TOOLCHAIN ??= "${PREFERRED_TOOLCHAIN}" | ||
33 | TOOLCHAIN_NATIVE ??= "${PREFERRED_TOOLCHAIN_NATIVE}" | ||
34 | |||
35 | inherit_defer toolchain/${TOOLCHAIN_NATIVE}-native | ||
36 | inherit_defer toolchain/${TOOLCHAIN} | ||
37 | |||
22 | def lsb_distro_identifier(d): | 38 | def lsb_distro_identifier(d): |
23 | adjust = d.getVar('LSB_DISTRO_ADJUST') | 39 | adjust = d.getVar('LSB_DISTRO_ADJUST') |
24 | adjust_func = None | 40 | adjust_func = None |
@@ -139,6 +155,7 @@ do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}" | |||
139 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" | 155 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" |
140 | do_fetch[prefuncs] += "fetcher_hashes_dummyfunc" | 156 | do_fetch[prefuncs] += "fetcher_hashes_dummyfunc" |
141 | do_fetch[network] = "1" | 157 | do_fetch[network] = "1" |
158 | do_fetch[umask] = "${OE_SHARED_UMASK}" | ||
142 | python base_do_fetch() { | 159 | python base_do_fetch() { |
143 | 160 | ||
144 | src_uri = (d.getVar('SRC_URI') or "").split() | 161 | src_uri = (d.getVar('SRC_URI') or "").split() |
@@ -168,23 +185,16 @@ python base_do_unpack() { | |||
168 | 185 | ||
169 | basedir = None | 186 | basedir = None |
170 | unpackdir = d.getVar('UNPACKDIR') | 187 | unpackdir = d.getVar('UNPACKDIR') |
171 | workdir = d.getVar('WORKDIR') | 188 | if sourcedir.startswith(unpackdir): |
172 | if sourcedir.startswith(workdir) and not sourcedir.startswith(unpackdir): | 189 | basedir = sourcedir.replace(unpackdir, '').strip("/").split('/')[0] |
173 | basedir = sourcedir.replace(workdir, '').strip("/").split('/')[0] | ||
174 | if basedir: | 190 | if basedir: |
175 | bb.utils.remove(workdir + '/' + basedir, True) | 191 | d.setVar("SOURCE_BASEDIR", unpackdir + '/' + basedir) |
176 | d.setVar("SOURCE_BASEDIR", workdir + '/' + basedir) | ||
177 | 192 | ||
178 | try: | 193 | try: |
179 | fetcher = bb.fetch2.Fetch(src_uri, d) | 194 | fetcher = bb.fetch2.Fetch(src_uri, d) |
180 | fetcher.unpack(d.getVar('UNPACKDIR')) | 195 | fetcher.unpack(d.getVar('UNPACKDIR')) |
181 | except bb.fetch2.BBFetchException as e: | 196 | except bb.fetch2.BBFetchException as e: |
182 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) | 197 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) |
183 | |||
184 | if basedir and os.path.exists(unpackdir + '/' + basedir): | ||
185 | # Compatibility magic to ensure ${WORKDIR}/git and ${WORKDIR}/${BP} | ||
186 | # as often used in S work as expected. | ||
187 | shutil.move(unpackdir + '/' + basedir, workdir + '/' + basedir) | ||
188 | } | 198 | } |
189 | 199 | ||
190 | SSTATETASKS += "do_deploy_source_date_epoch" | 200 | SSTATETASKS += "do_deploy_source_date_epoch" |
@@ -267,10 +277,19 @@ def buildcfg_neededvars(d): | |||
267 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) | 277 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) |
268 | 278 | ||
269 | addhandler base_eventhandler | 279 | addhandler base_eventhandler |
270 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed" | 280 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed bb.event.RecipePreDeferredInherits" |
271 | python base_eventhandler() { | 281 | python base_eventhandler() { |
272 | import bb.runqueue | 282 | import bb.runqueue |
273 | 283 | ||
284 | if isinstance(e, bb.event.RecipePreDeferredInherits): | ||
285 | # Use this to snoop on class extensions and set these up before the deferred inherits | ||
286 | # are processed which allows overrides on conditional variables. | ||
287 | for c in ['native', 'nativesdk', 'crosssdk', 'cross']: | ||
288 | if c in e.inherits: | ||
289 | d.setVar('CLASSOVERRIDE', 'class-' + c) | ||
290 | break | ||
291 | return | ||
292 | |||
274 | if isinstance(e, bb.event.ConfigParsed): | 293 | if isinstance(e, bb.event.ConfigParsed): |
275 | if not d.getVar("NATIVELSBSTRING", False): | 294 | if not d.getVar("NATIVELSBSTRING", False): |
276 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) | 295 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) |
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index c45650291f..4ef664b3ce 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass | |||
@@ -1431,6 +1431,14 @@ Rerun configure task after fixing this.""" | |||
1431 | python do_qa_unpack() { | 1431 | python do_qa_unpack() { |
1432 | src_uri = d.getVar('SRC_URI') | 1432 | src_uri = d.getVar('SRC_URI') |
1433 | s_dir = d.getVar('S') | 1433 | s_dir = d.getVar('S') |
1434 | s_dir_orig = d.getVar('S', False) | ||
1435 | |||
1436 | if s_dir_orig == '${WORKDIR}/git' or s_dir_orig == '${UNPACKDIR}/git': | ||
1437 | bb.fatal('Recipes that set S = "${WORKDIR}/git" or S = "${UNPACKDIR}/git" should remove that assignment, as S set by bitbake.conf in oe-core now works.') | ||
1438 | |||
1439 | if '${WORKDIR}' in s_dir_orig: | ||
1440 | bb.fatal('S should be set relative to UNPACKDIR, e.g. replace WORKDIR with UNPACKDIR in "S = {}"'.format(s_dir_orig)) | ||
1441 | |||
1434 | if src_uri and not os.path.exists(s_dir): | 1442 | if src_uri and not os.path.exists(s_dir): |
1435 | bb.warn('%s: the directory %s (%s) pointed to by the S variable doesn\'t exist - please set S within the recipe to point to where the source has been unpacked to' % (d.getVar('PN'), d.getVar('S', False), s_dir)) | 1443 | bb.warn('%s: the directory %s (%s) pointed to by the S variable doesn\'t exist - please set S within the recipe to point to where the source has been unpacked to' % (d.getVar('PN'), d.getVar('S', False), s_dir)) |
1436 | } | 1444 | } |
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass index d1452967fc..1044ed9cc6 100644 --- a/meta/classes-global/sanity.bbclass +++ b/meta/classes-global/sanity.bbclass | |||
@@ -514,12 +514,9 @@ def check_userns(): | |||
514 | # built buildtools-extended-tarball) | 514 | # built buildtools-extended-tarball) |
515 | # | 515 | # |
516 | def check_gcc_version(sanity_data): | 516 | def check_gcc_version(sanity_data): |
517 | import subprocess | 517 | version = oe.utils.get_host_gcc_version(sanity_data) |
518 | 518 | if bb.utils.vercmp_string_op(version, "8.0", "<"): | |
519 | build_cc, version = oe.utils.get_host_compiler_version(sanity_data) | 519 | return "Your version of gcc is older than 8.0 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n" |
520 | if build_cc.strip() == "gcc": | ||
521 | if bb.utils.vercmp_string_op(version, "8.0", "<"): | ||
522 | return "Your version of gcc is older than 8.0 and will break builds. Please install a newer version of gcc (you could use the project's buildtools-extended-tarball or use scripts/install-buildtools).\n" | ||
523 | return None | 520 | return None |
524 | 521 | ||
525 | # Tar version 1.24 and onwards handle overwriting symlinks correctly | 522 | # Tar version 1.24 and onwards handle overwriting symlinks correctly |
@@ -609,7 +606,7 @@ def drop_v14_cross_builds(d): | |||
609 | 606 | ||
610 | def check_cpp_toolchain_flag(d, flag, error_message=None): | 607 | def check_cpp_toolchain_flag(d, flag, error_message=None): |
611 | """ | 608 | """ |
612 | Checks if the C++ toolchain support the given flag | 609 | Checks if the g++ compiler supports the given flag |
613 | """ | 610 | """ |
614 | import shlex | 611 | import shlex |
615 | import subprocess | 612 | import subprocess |
@@ -622,7 +619,7 @@ def check_cpp_toolchain_flag(d, flag, error_message=None): | |||
622 | } | 619 | } |
623 | """ | 620 | """ |
624 | 621 | ||
625 | cmd = shlex.split(d.getVar("BUILD_CXX")) + ["-x", "c++","-", "-o", "/dev/null", flag] | 622 | cmd = ["g++", "-x", "c++","-", "-o", "/dev/null", flag] |
626 | try: | 623 | try: |
627 | subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True) | 624 | subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True) |
628 | return None | 625 | return None |
@@ -700,11 +697,11 @@ def check_sanity_version_change(status, d): | |||
700 | if not check_app_exists("${MAKE}", d): | 697 | if not check_app_exists("${MAKE}", d): |
701 | missing = missing + "GNU make," | 698 | missing = missing + "GNU make," |
702 | 699 | ||
703 | if not check_app_exists('${BUILD_CC}', d): | 700 | if not check_app_exists('gcc', d): |
704 | missing = missing + "C Compiler (%s)," % d.getVar("BUILD_CC") | 701 | missing = missing + "C Compiler (gcc)," |
705 | 702 | ||
706 | if not check_app_exists('${BUILD_CXX}', d): | 703 | if not check_app_exists('g++', d): |
707 | missing = missing + "C++ Compiler (%s)," % d.getVar("BUILD_CXX") | 704 | missing = missing + "C++ Compiler (g++)," |
708 | 705 | ||
709 | required_utilities = d.getVar('SANITY_REQUIRED_UTILITIES') | 706 | required_utilities = d.getVar('SANITY_REQUIRED_UTILITIES') |
710 | 707 | ||
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index 1d7b033b80..53bc2e3940 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass | |||
@@ -726,7 +726,6 @@ def pstaging_fetch(sstatefetch, d): | |||
726 | localdata = bb.data.createCopy(d) | 726 | localdata = bb.data.createCopy(d) |
727 | 727 | ||
728 | dldir = localdata.expand("${SSTATE_DIR}") | 728 | dldir = localdata.expand("${SSTATE_DIR}") |
729 | bb.utils.mkdirhier(dldir) | ||
730 | 729 | ||
731 | localdata.delVar('MIRRORS') | 730 | localdata.delVar('MIRRORS') |
732 | localdata.setVar('FILESPATH', dldir) | 731 | localdata.setVar('FILESPATH', dldir) |
@@ -746,16 +745,19 @@ def pstaging_fetch(sstatefetch, d): | |||
746 | if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False): | 745 | if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False): |
747 | uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)] | 746 | uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)] |
748 | 747 | ||
749 | for srcuri in uris: | 748 | with bb.utils.umask(bb.utils.to_filemode(d.getVar("OE_SHARED_UMASK"))): |
750 | localdata.delVar('SRC_URI') | 749 | bb.utils.mkdirhier(dldir) |
751 | localdata.setVar('SRC_URI', srcuri) | ||
752 | try: | ||
753 | fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False) | ||
754 | fetcher.checkstatus() | ||
755 | fetcher.download() | ||
756 | 750 | ||
757 | except bb.fetch2.BBFetchException: | 751 | for srcuri in uris: |
758 | pass | 752 | localdata.delVar('SRC_URI') |
753 | localdata.setVar('SRC_URI', srcuri) | ||
754 | try: | ||
755 | fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False) | ||
756 | fetcher.checkstatus() | ||
757 | fetcher.download() | ||
758 | |||
759 | except bb.fetch2.BBFetchException: | ||
760 | pass | ||
759 | 761 | ||
760 | def sstate_setscene(d): | 762 | def sstate_setscene(d): |
761 | shared_state = sstate_state_fromvars(d) | 763 | shared_state = sstate_state_fromvars(d) |
@@ -774,9 +776,10 @@ sstate_task_prefunc[dirs] = "${WORKDIR}" | |||
774 | python sstate_task_postfunc () { | 776 | python sstate_task_postfunc () { |
775 | shared_state = sstate_state_fromvars(d) | 777 | shared_state = sstate_state_fromvars(d) |
776 | 778 | ||
777 | omask = os.umask(0o002) | 779 | shared_umask = bb.utils.to_filemode(d.getVar("OE_SHARED_UMASK")) |
778 | if omask != 0o002: | 780 | omask = os.umask(shared_umask) |
779 | bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask) | 781 | if omask != shared_umask: |
782 | bb.note("Using umask %0o (not %0o) for sstate packaging" % (shared_umask, omask)) | ||
780 | sstate_package(shared_state, d) | 783 | sstate_package(shared_state, d) |
781 | os.umask(omask) | 784 | os.umask(omask) |
782 | 785 | ||
@@ -841,7 +844,8 @@ python sstate_create_and_sign_package () { | |||
841 | 844 | ||
842 | # Create the required sstate directory if it is not present. | 845 | # Create the required sstate directory if it is not present. |
843 | if not sstate_pkg.parent.is_dir(): | 846 | if not sstate_pkg.parent.is_dir(): |
844 | with bb.utils.umask(0o002): | 847 | shared_umask = bb.utils.to_filemode(d.getVar("OE_SHARED_UMASK")) |
848 | with bb.utils.umask(shared_umask): | ||
845 | bb.utils.mkdirhier(str(sstate_pkg.parent)) | 849 | bb.utils.mkdirhier(str(sstate_pkg.parent)) |
846 | 850 | ||
847 | if sign_pkg: | 851 | if sign_pkg: |
diff --git a/meta/classes-global/uninative.bbclass b/meta/classes-global/uninative.bbclass index 75e0c19704..c246a1ecd6 100644 --- a/meta/classes-global/uninative.bbclass +++ b/meta/classes-global/uninative.bbclass | |||
@@ -142,7 +142,7 @@ def enable_uninative(d): | |||
142 | loader = d.getVar("UNINATIVE_LOADER") | 142 | loader = d.getVar("UNINATIVE_LOADER") |
143 | if os.path.exists(loader): | 143 | if os.path.exists(loader): |
144 | bb.debug(2, "Enabling uninative") | 144 | bb.debug(2, "Enabling uninative") |
145 | d.setVar("NATIVELSBSTRING", "universal%s" % oe.utils.host_gcc_version(d)) | 145 | d.setVar("NATIVELSBSTRING", "universal") |
146 | d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp") | 146 | d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp") |
147 | d.appendVarFlag("SSTATEPOSTUNPACKFUNCS", "vardepvalueexclude", "| uninative_changeinterp") | 147 | d.appendVarFlag("SSTATEPOSTUNPACKFUNCS", "vardepvalueexclude", "| uninative_changeinterp") |
148 | d.appendVar("BUILD_LDFLAGS", " -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=${UNINATIVE_LOADER} -pthread") | 148 | d.appendVar("BUILD_LDFLAGS", " -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=${UNINATIVE_LOADER} -pthread") |