summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-09-19 11:01:27 +0100
committerSteve Sakoman <steve@sakoman.com>2024-09-27 05:57:35 -0700
commit065bd86349ffbe6c66487a3dd9dc4c9a1e7e3306 (patch)
treeb95b8fbb1914285ade7e73fae4783d73e4ad28af /meta/classes
parent958eaccc88604d4159d8c0f6be9c18fb872b87f2 (diff)
downloadpoky-065bd86349ffbe6c66487a3dd9dc4c9a1e7e3306.tar.gz
buildhistory: Simplify intercept call sites and drop SSTATEPOSTINSTFUNC usage
We planned to drop SSTATEPOSTINSTFUNC some time ago with the introduction of postfuncs. Finally get around to doing that which should make the buildhistory code a little more readable. Unfortunately ordering the buildhistory function calls after the sstate ones is difficult without coding that into the sstate class. This patch does that to ensure everything functions as expected until we can find a better way. This is still likely preferable than the generic sstate postfuncs support since the function flow is much more readable. (From OE-Core rev: 78ca086441b21dedd9c471a3d3200c24fd9ec8d2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit c9e2a8fa2f0305ef1247ec405555612326f798f8) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildhistory.bbclass39
-rw-r--r--meta/classes/sstate.bbclass5
2 files changed, 23 insertions, 21 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 8adb44eba5..83993f5752 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -45,11 +45,18 @@ BUILDHISTORY_PUSH_REPO ?= ""
45BUILDHISTORY_TAG ?= "build" 45BUILDHISTORY_TAG ?= "build"
46BUILDHISTORY_PATH_PREFIX_STRIP ?= "" 46BUILDHISTORY_PATH_PREFIX_STRIP ?= ""
47 47
48SSTATEPOSTINSTFUNCS:append = " buildhistory_emit_pkghistory" 48# We want to avoid influencing the signatures of the task so use vardepsexclude
49# We want to avoid influencing the signatures of sstate tasks - first the function itself: 49do_populate_sysroot[postfuncs] += "buildhistory_emit_sysroot"
50sstate_install[vardepsexclude] += "buildhistory_emit_pkghistory" 50do_populate_sysroot_setscene[postfuncs] += "buildhistory_emit_sysroot"
51# then the value added to SSTATEPOSTINSTFUNCS: 51do_populate_sysroot[vardepsexclude] += "buildhistory_emit_sysroot"
52SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory" 52
53do_package[postfuncs] += "buildhistory_list_pkg_files"
54do_package_setscene[postfuncs] += "buildhistory_list_pkg_files"
55do_package[vardepsexclude] += "buildhistory_list_pkg_files"
56
57do_packagedata[postfuncs] += "buildhistory_emit_pkghistory"
58do_packagedata_setscene[postfuncs] += "buildhistory_emit_pkghistory"
59do_packagedata[vardepsexclude] += "buildhistory_emit_pkghistory"
53 60
54# Similarly for our function that gets the output signatures 61# Similarly for our function that gets the output signatures
55SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs" 62SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs"
@@ -89,27 +96,15 @@ buildhistory_emit_sysroot() {
89# Write out metadata about this package for comparison when writing future packages 96# Write out metadata about this package for comparison when writing future packages
90# 97#
91python buildhistory_emit_pkghistory() { 98python buildhistory_emit_pkghistory() {
92 if d.getVar('BB_CURRENTTASK') in ['populate_sysroot', 'populate_sysroot_setscene']:
93 bb.build.exec_func("buildhistory_emit_sysroot", d)
94 return 0
95
96 if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
97 return 0
98
99 if d.getVar('BB_CURRENTTASK') in ['package', 'package_setscene']:
100 # Create files-in-<package-name>.txt files containing a list of files of each recipe's package
101 bb.build.exec_func("buildhistory_list_pkg_files", d)
102 return 0
103
104 if not d.getVar('BB_CURRENTTASK') in ['packagedata', 'packagedata_setscene']:
105 return 0
106
107 import re 99 import re
108 import json 100 import json
109 import shlex 101 import shlex
110 import errno 102 import errno
111 import shutil 103 import shutil
112 104
105 if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
106 return 0
107
113 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') 108 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE')
114 oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE') 109 oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE')
115 110
@@ -619,6 +614,10 @@ buildhistory_list_files_no_owners() {
619} 614}
620 615
621buildhistory_list_pkg_files() { 616buildhistory_list_pkg_files() {
617 if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'package', '1', '0', d)}" = "0" ] ; then
618 return
619 fi
620
622 # Create individual files-in-package for each recipe's package 621 # Create individual files-in-package for each recipe's package
623 pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d) 622 pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d)
624 for pkgdir in $pkgdirlist; do 623 for pkgdir in $pkgdirlist; do
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index dd6cf12920..91d42665c1 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -156,7 +156,10 @@ python () {
156 d.setVar('SSTATETASKS', " ".join(unique_tasks)) 156 d.setVar('SSTATETASKS', " ".join(unique_tasks))
157 for task in unique_tasks: 157 for task in unique_tasks:
158 d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ") 158 d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ")
159 d.appendVarFlag(task, 'postfuncs', " sstate_task_postfunc") 159 # Generally sstate should be last, execpt for buildhistory functions
160 postfuncs = (d.getVarFlag(task, 'postfuncs') or "").split()
161 newpostfuncs = [p for p in postfuncs if "buildhistory" not in p] + ["sstate_task_postfunc"] + [p for p in postfuncs if "buildhistory" in p]
162 d.setVarFlag(task, 'postfuncs', " ".join(newpostfuncs))
160 d.setVarFlag(task, 'network', '1') 163 d.setVarFlag(task, 'network', '1')
161 d.setVarFlag(task + "_setscene", 'network', '1') 164 d.setVarFlag(task + "_setscene", 'network', '1')
162} 165}