Skip to content
Snippets Groups Projects
Commit 065bd863 authored by Richard Purdie's avatar Richard Purdie Committed by Steve Sakoman
Browse files

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: default avatarRichard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit c9e2a8fa2f0305ef1247ec405555612326f798f8)
Signed-off-by: default avatarSteve Sakoman <steve@sakoman.com>
parent 958eaccc
No related branches found
No related tags found
No related merge requests found
...@@ -45,11 +45,18 @@ BUILDHISTORY_PUSH_REPO ?= "" ...@@ -45,11 +45,18 @@ BUILDHISTORY_PUSH_REPO ?= ""
BUILDHISTORY_TAG ?= "build" BUILDHISTORY_TAG ?= "build"
BUILDHISTORY_PATH_PREFIX_STRIP ?= "" BUILDHISTORY_PATH_PREFIX_STRIP ?= ""
SSTATEPOSTINSTFUNCS:append = " buildhistory_emit_pkghistory" # We want to avoid influencing the signatures of the task so use vardepsexclude
# We want to avoid influencing the signatures of sstate tasks - first the function itself: do_populate_sysroot[postfuncs] += "buildhistory_emit_sysroot"
sstate_install[vardepsexclude] += "buildhistory_emit_pkghistory" do_populate_sysroot_setscene[postfuncs] += "buildhistory_emit_sysroot"
# then the value added to SSTATEPOSTINSTFUNCS: do_populate_sysroot[vardepsexclude] += "buildhistory_emit_sysroot"
SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory"
do_package[postfuncs] += "buildhistory_list_pkg_files"
do_package_setscene[postfuncs] += "buildhistory_list_pkg_files"
do_package[vardepsexclude] += "buildhistory_list_pkg_files"
do_packagedata[postfuncs] += "buildhistory_emit_pkghistory"
do_packagedata_setscene[postfuncs] += "buildhistory_emit_pkghistory"
do_packagedata[vardepsexclude] += "buildhistory_emit_pkghistory"
# Similarly for our function that gets the output signatures # Similarly for our function that gets the output signatures
SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs" SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs"
...@@ -89,27 +96,15 @@ buildhistory_emit_sysroot() { ...@@ -89,27 +96,15 @@ buildhistory_emit_sysroot() {
# Write out metadata about this package for comparison when writing future packages # Write out metadata about this package for comparison when writing future packages
# #
python buildhistory_emit_pkghistory() { python buildhistory_emit_pkghistory() {
if d.getVar('BB_CURRENTTASK') in ['populate_sysroot', 'populate_sysroot_setscene']:
bb.build.exec_func("buildhistory_emit_sysroot", d)
return 0
if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
return 0
if d.getVar('BB_CURRENTTASK') in ['package', 'package_setscene']:
# Create files-in-<package-name>.txt files containing a list of files of each recipe's package
bb.build.exec_func("buildhistory_list_pkg_files", d)
return 0
if not d.getVar('BB_CURRENTTASK') in ['packagedata', 'packagedata_setscene']:
return 0
import re import re
import json import json
import shlex import shlex
import errno import errno
import shutil import shutil
if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
return 0
pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE')
oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE') oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE')
...@@ -619,6 +614,10 @@ buildhistory_list_files_no_owners() { ...@@ -619,6 +614,10 @@ buildhistory_list_files_no_owners() {
} }
buildhistory_list_pkg_files() { buildhistory_list_pkg_files() {
if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'package', '1', '0', d)}" = "0" ] ; then
return
fi
# Create individual files-in-package for each recipe's package # Create individual files-in-package for each recipe's package
pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d) pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d)
for pkgdir in $pkgdirlist; do for pkgdir in $pkgdirlist; do
......
...@@ -156,7 +156,10 @@ python () { ...@@ -156,7 +156,10 @@ python () {
d.setVar('SSTATETASKS', " ".join(unique_tasks)) d.setVar('SSTATETASKS', " ".join(unique_tasks))
for task in unique_tasks: for task in unique_tasks:
d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ") d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ")
d.appendVarFlag(task, 'postfuncs', " sstate_task_postfunc") # Generally sstate should be last, execpt for buildhistory functions
postfuncs = (d.getVarFlag(task, 'postfuncs') or "").split()
newpostfuncs = [p for p in postfuncs if "buildhistory" not in p] + ["sstate_task_postfunc"] + [p for p in postfuncs if "buildhistory" in p]
d.setVarFlag(task, 'postfuncs', " ".join(newpostfuncs))
d.setVarFlag(task, 'network', '1') d.setVarFlag(task, 'network', '1')
d.setVarFlag(task + "_setscene", 'network', '1') d.setVarFlag(task + "_setscene", 'network', '1')
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment