@@ -433,6 +433,8 @@ def create_diff_gz(d, src_orig, src, ar_outdir):
if not os.path.isdir(src) or not os.path.isdir(src_orig):
return
+ bb.note('Creating diff gz...')
+
# The diff --exclude can't exclude the file with path, so we copy
# the patched source, and remove the files that we'd like to
# exclude.
@@ -489,7 +491,9 @@ python do_unpack_and_patch() {
if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1':
src = d.getVar('S').rstrip('/')
src_orig = '%s.orig' % src
- oe.path.copytree(src, src_orig)
+ # A recipe without sources may have no S
+ if os.path.isdir(src):
+ oe.path.copytree(src, src_orig)
if bb.data.inherits_class('dos2unix', d):
bb.build.exec_func('do_convert_crlf_to_lf', d)
@@ -500,7 +504,6 @@ python do_unpack_and_patch() {
# Create the patches
if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1':
- bb.note('Creating diff gz...')
create_diff_gz(d, src_orig, src, ar_outdir)
bb.utils.remove(src_orig, recurse=True)
}
With ARCHIVER_MODE[diff] = "1", do_unpack_and_patch copies S to S.orig unconditionally, so a recipe without sources whose S is never created, such as systemd-serialgetty or perf, fails: ERROR: systemd-serialgetty-1.0-r0 do_unpack_and_patch: Error executing a python function in exec_func_python() autogenerated: ... tar: .../systemd-serialgetty/1.0/archiver-work//sources/systemd-serialgetty-1.0: Cannot open: No such file or directory do_unpack no longer creates such an S since commit b84eec5c4cbf ("base: Switch UNPACKDIR to a subdir of WORKDIR") changed its cleandirs from S to UNPACKDIR; perf fills S from the kernel only in do_configure. Skip the copy when S doesn't exist; create_diff_gz() already returns early when either directory is missing. A recipe with sources whose S is missing is still reported by do_qa_unpack after its own do_unpack. Print the "Creating diff gz..." note only when a diff is created. Tested with ARCHIVER_MODE[src] = "original" and ARCHIVER_MODE[diff] = "1": do_unpack_and_patch of systemd-serialgetty now succeeds on master and wrynose, as does that of perf on wrynose, and zlib still gets its diff.gz on master. AI-Generated: Uses Claude Code (Claude Opus 5.5) Signed-off-by: Niko Mauno <niko.mauno@vaisala.com> --- meta/classes/archiver.bbclass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)