diff options
Diffstat (limited to 'meta/classes-global')
-rw-r--r-- | meta/classes-global/license.bbclass | 10 | ||||
-rw-r--r-- | meta/classes-global/package_rpm.bbclass | 19 | ||||
-rw-r--r-- | meta/classes-global/sanity.bbclass | 26 | ||||
-rw-r--r-- | meta/classes-global/sstate.bbclass | 16 |
4 files changed, 48 insertions, 23 deletions
diff --git a/meta/classes-global/license.bbclass b/meta/classes-global/license.bbclass index b2e0d3faba..d7c5d08a77 100644 --- a/meta/classes-global/license.bbclass +++ b/meta/classes-global/license.bbclass | |||
@@ -18,8 +18,14 @@ LICENSE_CREATE_PACKAGE ??= "0" | |||
18 | LICENSE_PACKAGE_SUFFIX ??= "-lic" | 18 | LICENSE_PACKAGE_SUFFIX ??= "-lic" |
19 | LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/" | 19 | LICENSE_FILES_DIRECTORY ??= "${datadir}/licenses/" |
20 | 20 | ||
21 | LICENSE_DEPLOY_PATHCOMPONENT = "${SSTATE_PKGARCH}" | ||
22 | LICENSE_DEPLOY_PATHCOMPONENT:class-cross = "native" | ||
23 | LICENSE_DEPLOY_PATHCOMPONENT:class-native = "native" | ||
24 | # Ensure the *value* of SSTATE_PKGARCH is captured as it is used in the output paths | ||
25 | LICENSE_DEPLOY_PATHCOMPONENT[vardepvalue] += "${LICENSE_DEPLOY_PATHCOMPONENT}" | ||
26 | |||
21 | addtask populate_lic after do_patch before do_build | 27 | addtask populate_lic after do_patch before do_build |
22 | do_populate_lic[dirs] = "${LICSSTATEDIR}/${PN}" | 28 | do_populate_lic[dirs] = "${LICSSTATEDIR}/${LICENSE_DEPLOY_PATHCOMPONENT}/${PN}" |
23 | do_populate_lic[cleandirs] = "${LICSSTATEDIR}" | 29 | do_populate_lic[cleandirs] = "${LICSSTATEDIR}" |
24 | 30 | ||
25 | python do_populate_lic() { | 31 | python do_populate_lic() { |
@@ -29,7 +35,7 @@ python do_populate_lic() { | |||
29 | lic_files_paths = find_license_files(d) | 35 | lic_files_paths = find_license_files(d) |
30 | 36 | ||
31 | # The base directory we wrangle licenses to | 37 | # The base directory we wrangle licenses to |
32 | destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('SSTATE_PKGARCH'), d.getVar('PN')) | 38 | destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('LICENSE_DEPLOY_PATHCOMPONENT'), d.getVar('PN')) |
33 | copy_license_files(lic_files_paths, destdir) | 39 | copy_license_files(lic_files_paths, destdir) |
34 | info = get_recipe_info(d) | 40 | info = get_recipe_info(d) |
35 | with open(os.path.join(destdir, "recipeinfo"), "w") as f: | 41 | with open(os.path.join(destdir, "recipeinfo"), "w") as f: |
diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass index 2e3e4e8c79..4a700ec124 100644 --- a/meta/classes-global/package_rpm.bbclass +++ b/meta/classes-global/package_rpm.bbclass | |||
@@ -10,7 +10,7 @@ IMAGE_PKGTYPE ?= "rpm" | |||
10 | 10 | ||
11 | RPM = "rpm" | 11 | RPM = "rpm" |
12 | RPMBUILD = "rpmbuild" | 12 | RPMBUILD = "rpmbuild" |
13 | RPMBUILD_COMPMODE ?= "${@'w19T%d.zstdio' % int(d.getVar('ZSTD_THREADS'))}" | 13 | RPMBUILD_COMPMODE ?= "${@'w3T%d.zstdio' % int(d.getVar('ZSTD_THREADS'))}" |
14 | 14 | ||
15 | PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms" | 15 | PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms" |
16 | 16 | ||
@@ -205,14 +205,22 @@ python write_specfile () { | |||
205 | try: | 205 | try: |
206 | owner = pwd.getpwuid(stat_f.st_uid).pw_name | 206 | owner = pwd.getpwuid(stat_f.st_uid).pw_name |
207 | except Exception as e: | 207 | except Exception as e: |
208 | bb.error("Content of /etc/passwd in sysroot:\n{}".format( | 208 | filename = d.getVar('RECIPE_SYSROOT') + '/etc/passwd' |
209 | open(d.getVar("RECIPE_SYSROOT") +"/etc/passwd").read())) | 209 | if os.path.exists(filename): |
210 | bb.error("Content of /etc/passwd in sysroot:\n{}".format( | ||
211 | open(filename).read())) | ||
212 | else: | ||
213 | bb.error("File {} doesn't exist in sysroot!".format(filename)) | ||
210 | raise e | 214 | raise e |
211 | try: | 215 | try: |
212 | group = grp.getgrgid(stat_f.st_gid).gr_name | 216 | group = grp.getgrgid(stat_f.st_gid).gr_name |
213 | except Exception as e: | 217 | except Exception as e: |
214 | bb.error("Content of /etc/group in sysroot:\n{}".format( | 218 | filename = d.getVar("RECIPE_SYSROOT") +"/etc/group" |
215 | open(d.getVar("RECIPE_SYSROOT") +"/etc/group").read())) | 219 | if os.path.exists(filename): |
220 | bb.error("Content of /etc/group in sysroot:\n{}".format( | ||
221 | open(filename).read())) | ||
222 | else: | ||
223 | bb.error("File {} doesn't exists in sysroot!".format(filename)) | ||
216 | raise e | 224 | raise e |
217 | return "%attr({:o},{},{}) ".format(mode, owner, group) | 225 | return "%attr({:o},{},{}) ".format(mode, owner, group) |
218 | 226 | ||
@@ -705,6 +713,7 @@ python do_package_rpm () { | |||
705 | cmd = cmd + " --define '_use_internal_dependency_generator 0'" | 713 | cmd = cmd + " --define '_use_internal_dependency_generator 0'" |
706 | cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'" | 714 | cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'" |
707 | cmd = cmd + " --define '_build_id_links none'" | 715 | cmd = cmd + " --define '_build_id_links none'" |
716 | cmd = cmd + " --define '_smp_ncpus_max 4'" | ||
708 | cmd = cmd + " --define '_source_payload %s'" % rpmbuild_compmode | 717 | cmd = cmd + " --define '_source_payload %s'" % rpmbuild_compmode |
709 | cmd = cmd + " --define '_binary_payload %s'" % rpmbuild_compmode | 718 | cmd = cmd + " --define '_binary_payload %s'" % rpmbuild_compmode |
710 | cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'" | 719 | cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'" |
diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass index 1d242f0f0a..a0b2508e11 100644 --- a/meta/classes-global/sanity.bbclass +++ b/meta/classes-global/sanity.bbclass | |||
@@ -475,6 +475,31 @@ def check_wsl(d): | |||
475 | bb.warn("You are running bitbake under WSLv2, this works properly but you should optimize your VHDX file eventually to avoid running out of storage space") | 475 | bb.warn("You are running bitbake under WSLv2, this works properly but you should optimize your VHDX file eventually to avoid running out of storage space") |
476 | return None | 476 | return None |
477 | 477 | ||
478 | def check_userns(): | ||
479 | """ | ||
480 | Check that user namespaces are functional, as they're used for network isolation. | ||
481 | """ | ||
482 | |||
483 | # There is a known failure case with AppAmrmor where the unshare() call | ||
484 | # succeeds (at which point the uid is nobody) but writing to the uid_map | ||
485 | # fails (so the uid isn't reset back to the user's uid). We can detect this. | ||
486 | parentuid = os.getuid() | ||
487 | if not bb.utils.is_local_uid(parentuid): | ||
488 | return None | ||
489 | pid = os.fork() | ||
490 | if not pid: | ||
491 | try: | ||
492 | bb.utils.disable_network() | ||
493 | except: | ||
494 | pass | ||
495 | os._exit(parentuid != os.getuid()) | ||
496 | |||
497 | ret = os.waitpid(pid, 0)[1] | ||
498 | if ret: | ||
499 | bb.fatal("User namespaces are not usable by BitBake, possibly due to AppArmor.\n" | ||
500 | "See https://discourse.ubuntu.com/t/ubuntu-24-04-lts-noble-numbat-release-notes/39890#unprivileged-user-namespace-restrictions for more information.") | ||
501 | |||
502 | |||
478 | # Require at least gcc version 8.0 | 503 | # Require at least gcc version 8.0 |
479 | # | 504 | # |
480 | # This can be fixed on CentOS-7 with devtoolset-6+ | 505 | # This can be fixed on CentOS-7 with devtoolset-6+ |
@@ -641,6 +666,7 @@ def check_sanity_version_change(status, d): | |||
641 | status.addresult(check_git_version(d)) | 666 | status.addresult(check_git_version(d)) |
642 | status.addresult(check_perl_modules(d)) | 667 | status.addresult(check_perl_modules(d)) |
643 | status.addresult(check_wsl(d)) | 668 | status.addresult(check_wsl(d)) |
669 | status.addresult(check_userns()) | ||
644 | 670 | ||
645 | missing = "" | 671 | missing = "" |
646 | 672 | ||
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index 93df5fa9e6..567797305f 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass | |||
@@ -648,15 +648,6 @@ def sstate_package(ss, d): | |||
648 | 648 | ||
649 | tmpdir = d.getVar('TMPDIR') | 649 | tmpdir = d.getVar('TMPDIR') |
650 | 650 | ||
651 | fixtime = False | ||
652 | if ss['task'] == "package": | ||
653 | fixtime = True | ||
654 | |||
655 | def fixtimestamp(root, path): | ||
656 | f = os.path.join(root, path) | ||
657 | if os.lstat(f).st_mtime > sde: | ||
658 | os.utime(f, (sde, sde), follow_symlinks=False) | ||
659 | |||
660 | sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task']) | 651 | sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task']) |
661 | sde = int(d.getVar("SOURCE_DATE_EPOCH") or time.time()) | 652 | sde = int(d.getVar("SOURCE_DATE_EPOCH") or time.time()) |
662 | d.setVar("SSTATE_CURRTASK", ss['task']) | 653 | d.setVar("SSTATE_CURRTASK", ss['task']) |
@@ -671,8 +662,6 @@ def sstate_package(ss, d): | |||
671 | # to sstate tasks but there aren't many of these so better just avoid them entirely. | 662 | # to sstate tasks but there aren't many of these so better just avoid them entirely. |
672 | for walkroot, dirs, files in os.walk(state[1]): | 663 | for walkroot, dirs, files in os.walk(state[1]): |
673 | for file in files + dirs: | 664 | for file in files + dirs: |
674 | if fixtime: | ||
675 | fixtimestamp(walkroot, file) | ||
676 | srcpath = os.path.join(walkroot, file) | 665 | srcpath = os.path.join(walkroot, file) |
677 | if not os.path.islink(srcpath): | 666 | if not os.path.islink(srcpath): |
678 | continue | 667 | continue |
@@ -694,11 +683,6 @@ def sstate_package(ss, d): | |||
694 | bb.utils.mkdirhier(plain) | 683 | bb.utils.mkdirhier(plain) |
695 | bb.utils.mkdirhier(pdir) | 684 | bb.utils.mkdirhier(pdir) |
696 | bb.utils.rename(plain, pdir) | 685 | bb.utils.rename(plain, pdir) |
697 | if fixtime: | ||
698 | fixtimestamp(pdir, "") | ||
699 | for walkroot, dirs, files in os.walk(pdir): | ||
700 | for file in files + dirs: | ||
701 | fixtimestamp(walkroot, file) | ||
702 | 686 | ||
703 | d.setVar('SSTATE_BUILDDIR', sstatebuild) | 687 | d.setVar('SSTATE_BUILDDIR', sstatebuild) |
704 | d.setVar('SSTATE_INSTDIR', sstatebuild) | 688 | d.setVar('SSTATE_INSTDIR', sstatebuild) |