Based on the guidance from [1], resolve build errors on styhead.
This resolves 2 issues with styhead as found with the integration at [2]
and testing of branch at [3], as referenced at [4], [5], and [6]:
```
WARNING: swupdate-image-tegra-1.0-r0 do_unpack: swupdate-image-tegra: the directory ${WORKDIR}/${PN} (/home/dan/trellis/oe4t/tegra-demo-distro/build-master/tmp/work/jetson_orin_nano_devkit_nvme-oe4t-linux/swupdate-image-tegra/1.0/swupdate-image-tegra) pointed to by the S variable doesn't exist - please set S within the recipe to point to where the source has been unpacked to
```
This warning is printed due to the setting of S based on WORKDIR
in swupdate.bbclass and the fact that the S directory is no longer
automatically created as discussed in [1]. To resolve, use the guidance
in [1] to set S and UNPACKDIR for recipes which only use file:// sources.
```
ERROR: swupdate-image-tegra-1.0-r0 do_swuimage: Error executing a python function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:do_swuimage(d)
0003:
File: '/home/dan/trellis/oe4t/tegra-demo-distro/build-master/../layers/meta-swupdate/classes-recipe/swupdate-common.bbclass', lineno: 325, function: do_swuimage
0321: list_for_cpio = ["sw-description"]
0322: workdir = d.getVar('WORKDIR')
0323: s = d.getVar('S')
0324: imgdeploydir = d.getVar('SWUDEPLOYDIR')
*** 0325: shutil.copyfile(os.path.join(workdir, "sw-description"), os.path.join(s, "sw-description"))
0326:
...
File: '/usr/lib/python3.10/shutil.py', lineno: 254, function: copyfile
0250:
0253: else:
*** 0254: with open(src, 'rb') as fsrc:
```
This error occurs due to the use of WORKDIR as the location of files instead
of UNPACKDIR. When using the guidance in [1] to set UNPACKDIR there is no
longer a need to copy from WORKDIR to UNPACKDIR since S is UNPACKDIR, so both
the workdir reference and shutil copy can be removed.
1:
https://docs.yoctoproject.org/next/migration-guides/migration-5.1.html
2:
https://github.com/OE4T/tegra-demo-distro/blob/master/layers/meta-tegrademo/dynamic-layers/meta-swupdate/README.md
3:
https://github.com/Trellis-Logic/tegra-demo-distro/tree/master%2Bswupdate-kas
4:
https://groups.google.com/g/swupdate/c/E2h_qgHvJuk
5:
https://groups.google.com/g/swupdate/c/x4jxRPbtXa0/m/QQkYqgILAQAJ
6:
https://mail.google.com/mail/u/0/#search/swupdate+/FMfcgzQVzNxnTXkCCgksdnXCHPqsJLzq
Signed-off-by: Dan Walkes <
danw...@trellis-logic.com>
---
classes-recipe/swupdate-common.bbclass | 2 --
classes-recipe/swupdate-image.bbclass | 3 ++-
classes-recipe/swupdate.bbclass | 3 ++-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
index 15b45c3..79b79c3 100644
--- a/classes-recipe/swupdate-common.bbclass
+++ b/classes-recipe/swupdate-common.bbclass
@@ -322,10 +322,8 @@ python do_swuimage () {
import shutil
list_for_cpio = ["sw-description"]
- unpackdir = d.getVar('UNPACKDIR')
s = d.getVar('S')
imgdeploydir = d.getVar('SWUDEPLOYDIR')
- shutil.copyfile(os.path.join(unpackdir, "sw-description"), os.path.join(s, "sw-description"))
if d.getVar('SWUPDATE_SIGNING'):
list_for_cpio.append('sw-description.sig')
diff --git a/classes-recipe/swupdate-image.bbclass b/classes-recipe/swupdate-image.bbclass
index 175fc4e..62ef19d 100644
--- a/classes-recipe/swupdate-image.bbclass
+++ b/classes-recipe/swupdate-image.bbclass
@@ -13,7 +13,8 @@
inherit swupdate-common
inherit image-artifact-names
-S = "${WORKDIR}/${PN}"
+S = "${WORKDIR}/sources"
+UNPACKDIR = "${S}"
SRC_URI += "file://sw-description"
SWUPDATE_IMAGES += "${IMAGE_LINK_NAME}"
diff --git a/classes-recipe/swupdate.bbclass b/classes-recipe/swupdate.bbclass
index 3656b1c..ae00085 100644
--- a/classes-recipe/swupdate.bbclass
+++ b/classes-recipe/swupdate.bbclass
@@ -36,7 +36,8 @@
inherit swupdate-common
inherit image-artifact-names
-S = "${WORKDIR}/${PN}"
+S = "${WORKDIR}/sources"
+UNPACKDIR = "${S}"
IMAGE_DEPENDS ?= ""
--
2.34.1