Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ build/cache
# attached component tree, so the next attach can refuse to clobber local edits.
*.attach.sha256
*.attach.pf
*.attach.series

**/doxy/**
**/generated/**
Expand Down
5 changes: 5 additions & 0 deletions build/meta-so3/recipes-so3/so3/so3_6.3.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ OVERRIDES:append = ":so3"

IB_TARGET = "${IB_SO3_PATH}"

# The build leaves its arch marker, the usr-so3 CMake directory and the rendered
# ITS/ITB in this tree. Upstream SO3 has no directory of either name.

IB_UPDIFF_EXCLUDE = ".ib_last_arch build images"

# Infrabase does not embed the SO3 sources. Same revision as the AVZ recipe:
# both are the same kernel tree, and move together.

Expand Down
1 change: 1 addition & 0 deletions build/meta-usr/classes/usr.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ inherit rootfs
# updiff turns every CMake-generated file into a patch. Neither the linux nor
# the so3 usr tree ships a directory of that name. .ib_last_arch is the arch
# marker do_build writes, .ib_last_toolchain the one usr-so3 writes.

IB_UPDIFF_EXCLUDE:append = " build .ib_last_arch .ib_last_toolchain"

# Deployment of user space components
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
LVGL_URI:append = "\
file://0001-CMakeLists.txt.patch \
file://0063-CMakeLists.txt.patch \
file://0008-CMakeLists.txt.patch \
file://0005-LICENSE.patch \
Expand Down

This file was deleted.

52 changes: 39 additions & 13 deletions build/meta-usr/recipes-usr/lvgl/usr-so3_1.0.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,29 @@ python do_handle_fetch_git() {
# bitbake owns WORKDIR; we only purge the fetched lvgl tree.
python do_clean:append() {
import os, shutil, subprocess
if 'lvgl' not in (d.getVar('OVERRIDES') or '').split(':'):

# The tree holds the lvgl series if it was attached with it, whatever the
# overrides say now. Any other tree is left alone: a clean keeps local edits.

series = {os.path.basename(u) for u in (d.getVar('LVGL_PATCHES') or '').split()}
if 'lvgl' not in (d.getVar('OVERRIDES') or '').split(':') \
and not series & (ib_attached_series(d) or set()):
return

target = d.getVar('IB_TARGET')
s = d.getVar('S')
ib_dir = d.getVar('IB_DIR')

# Everything the :lvgl override creates in the committed-but-build-mutated
# usr/ tree (lib/slv, lib/lvgl, lib/lv_conf.h, the lvgl_*.elf sources and
# fillfb.c). do_attach_infrabase mirrors the patched ${S} back into
# IB_TARGET, so these end up in BOTH; remove from both so the next :lvgl
# build re-applies the creation patches onto a clean base instead of
# failing with "already exists" (idempotent :lvgl rebuilds).
# Everything the :lvgl override creates or replaces. do_attach_infrabase
# mirrors the patched ${S} back into IB_TARGET, so these end up in BOTH.

created = [
'lib/lvgl', 'lib/slv', 'lib/lv_conf.h', 'src/lib',
'src/fillfb.c', 'src/lvgl_demo.c', 'src/lvgl_perf.c',
'src/lvgl_benchmark.c', 'src/lvgl_widgets.c',
]
cmakelists = ['lib/CMakeLists.txt', 'src/CMakeLists.txt']

for base in (target, s):
if not base:
continue
Expand All @@ -101,11 +106,32 @@ python do_clean:append() {
except OSError:
pass

# The lvgl CMakeLists blocks are added by the :lvgl patches to the tracked
# lib/CMakeLists.txt and src/CMakeLists.txt; restore them to the committed
# lvgl-free base (git index) so the tree fully matches the base again.
if ib_dir and os.path.isdir(os.path.join(ib_dir, '.git')):
for rel in ('lib/CMakeLists.txt', 'src/CMakeLists.txt'):
# usr/ belongs to the so3 recipe, so its ${S} is the lvgl-free base, some of
# these files included. Without a fetched so3, usr/ is under git.

usr = None
try:
with open(os.path.dirname(target) + '.attach.pf') as f:
pf = f.read().strip()
usr = os.path.join(d.getVar('TMPDIR'), 'work', pf, pf.rsplit('-', 1)[0], 'usr')
except OSError:
pass

if usr and os.path.isdir(usr):
for rel in created + cmakelists:
src = os.path.join(usr, rel)
dst = os.path.join(target, rel)
if os.path.isdir(src):
shutil.copytree(src, dst, symlinks=True)
elif os.path.isfile(src):
shutil.copyfile(src, dst)
elif ib_dir and os.path.isdir(os.path.join(ib_dir, '.git')):
for rel in cmakelists:
subprocess.run(['git', '-C', ib_dir, 'checkout', '--',
os.path.join(target, rel)], check=False)
}

try:
os.remove(target + '.attach.series')
except OSError:
pass
}
35 changes: 35 additions & 0 deletions build/meta/classes/base.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ do_unpack[postfuncs] = "do_handle_fetch_git"

# Default to the safe behaviour; set IB_FORCE_ATTACH=1 (env or local.conf)
# to override the dirty-tree guards below.

IB_FORCE_ATTACH ??= "0"

# Edits in ${IB_TARGET} that the patch set does not hold.
Expand All @@ -430,6 +431,7 @@ IB_FORCE_ATTACH ??= "0"
# artefacts and refuse a perfectly clean tree. Filtered here as well as
# pruned at attach time, so manifests recorded before that fix stop
# blocking too.

def ib_unfolded_edits(d):
import os
import re
Expand Down Expand Up @@ -475,6 +477,7 @@ def ib_guard_unfolded_edits(d, action, consequence):
# do_updiff) would never re-run do_patch/do_attach_infrabase. Each file is also
# registered as a parse dependency, so editing one invalidates the parse cache
# and the digest is recomputed. Call it from anonymous python.

def ib_patchset_digest(d):
import hashlib

Expand All @@ -497,6 +500,7 @@ def ib_patchset_digest(d):
# patch, a SRCREV rolled back) finds its old stamp still there, BitBake deems the
# task current, and the tree is silently left at the newer content. Add it to
# the task's prefuncs; the stamp for the current key is written after the task.

python ib_drop_stale_stamps() {
import glob

Expand All @@ -519,6 +523,7 @@ do_attach_infrabase[prefuncs] += "ib_attach_guard"
# Opt out with IB_CLEAN_GUARD = "0" in a recipe whose own build rewrites
# attached files (see usr.bbclass), where the manifest cannot tell an edit
# from a build step.

IB_CLEAN_GUARD ??= "1"

python ib_clean_guard() {
Expand All @@ -530,6 +535,36 @@ python ib_clean_guard() {
}
do_clean[prefuncs] += "ib_clean_guard"

# The patches SRC_URI applies depend on the overrides, and the stamps do not:
# changing an override leaves the tree as it was built. The series that built
# the tree is therefore recorded in ${IB_TARGET}.attach.series for do_updiff.

def ib_series_names(d):
names = set()
for uri in (d.getVar('SRC_URI') or '').split():
if uri.startswith('file://'):
name = os.path.basename(uri[len('file://'):].split(';')[0])
if name.endswith(('.patch', '.diff')):
names.add(name)
return names

def ib_attached_series(d):
try:
with open(d.getVar('IB_TARGET') + '.attach.series') as f:
return set(f.read().split())
except OSError:
return None

def ib_record_attached_series(d, names):
with open(d.getVar('IB_TARGET') + '.attach.series', 'w') as f:
f.writelines(n + '\n' for n in sorted(names))

python ib_attach_series() {
if d.getVar('IB_TARGET'):
ib_record_attached_series(d, ib_series_names(d))
}
do_attach_infrabase[postfuncs] += "ib_attach_series"

do_attach_infrabase () {
ib_manifest="${IB_TARGET}.attach.sha256"

Expand Down
Loading
Loading