From 43717d09a0230b4dd4c52de6e979c3a1579c42d1 Mon Sep 17 00:00:00 2001 From: Joseph Nobes Date: Wed, 3 Sep 2025 17:14:31 +0100 Subject: [PATCH 1/6] Upgrade setuptools-scm to version 8.0.4 to install via pyproject.toml Installing projects with pyproject.toml can be completed using python poetry, utilising the native setuptools-scm. This succcessfully installs the odin-sequencer from the jupyter-rppc branch, currently without the rpc addition. --- .../project-spec/meta-user/conf/layer.conf | 2 +- .../odin-sequencer_0.%.bbappend | 6 ++++ .../odin-sequencer/odin-sequencer_0.2.0.bb | 3 +- ...0001-respect-GIT_CEILING_DIRECTORIES.patch | 36 +++++++++++++++++++ .../python/python3-setuptools-scm_8.0.4.bb | 32 +++++++++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend create mode 100644 os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm/0001-respect-GIT_CEILING_DIRECTORIES.patch create mode 100644 os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm_8.0.4.bb diff --git a/os/petalinux-custom/project-spec/meta-user/conf/layer.conf b/os/petalinux-custom/project-spec/meta-user/conf/layer.conf index 32e4e814..93322668 100644 --- a/os/petalinux-custom/project-spec/meta-user/conf/layer.conf +++ b/os/petalinux-custom/project-spec/meta-user/conf/layer.conf @@ -11,5 +11,5 @@ BBFILE_PRIORITY_meta-loki-bsp-legacy = "8" LAYERSERIES_COMPAT_meta-loki-bsp-legacy = "langdale" OE_TERMINAL = "screen" -SIGGEN_UNLOCKED_RECIPES += " dropbear tzdata" +SIGGEN_UNLOCKED_RECIPES += " dropbear tzdata python3-setuptools-scm-native" IMAGE_INSTALL:append = " libgpiod-tools nfs-utils git ntp ntpdate ntpq sntp tzdata parted u-boot-tools python-loki-adapter loki-user loki-config loki-update python3-zoneinfo" diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend new file mode 100644 index 00000000..588b117b --- /dev/null +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend @@ -0,0 +1,6 @@ +GIT_HASH = "5331bf846669c1f4b88c5dd35e9911835cc40f99" +SRCREV = "${GIT_HASH}" + +SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=jupyter_rpc" + +DEPENDS += " ${PYTHON_PN}-setuptools-scm-native" diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb index 86793678..f21fdf86 100644 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb @@ -24,7 +24,8 @@ LICENSE = "Apachev2" # Get this value by running md5sum on the license file LIC_FILES_CHKSUM = "file://LICENSE;md5=2bd339c7a9cf03feeeee2f768a4eb0ce" -inherit setuptools3 +#inherit setuptools3 +inherit python_poetry_core do_configure:prepend() { bbdebug 2 "Current working directory (pwd):" ${pwd} diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm/0001-respect-GIT_CEILING_DIRECTORIES.patch b/os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm/0001-respect-GIT_CEILING_DIRECTORIES.patch new file mode 100644 index 00000000..7d2808cc --- /dev/null +++ b/os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm/0001-respect-GIT_CEILING_DIRECTORIES.patch @@ -0,0 +1,36 @@ +From a1cc419a118560d63e1ab8838c256a3622185750 Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier +Date: Thu, 13 Feb 2025 15:44:40 +0100 +Subject: [PATCH] respect GIT_CEILING_DIRECTORIES + +Fix for https://github.com/pypa/setuptools-scm/issues/1103 + +When searching for the root-directory of the git repository e.g. with git rev-parse --show-toplevel, +git stops the search when reaching $GIT_CEILING_DIRECTORIES. By ignoring this variable, the function +_git_toplevel can go above the real git repository (e.g. when packaging a tarball without .git repository), +and then runs "git archive" on an unrelated git repository. + +Upstream-Status: Pending + +Signed-off-by: Ross Burton +Signed-off-by: Etienne Cordonnier +--- + src/setuptools_scm/_run_cmd.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/setuptools_scm/_run_cmd.py b/src/setuptools_scm/_run_cmd.py +index f2a8285..7e13d9f 100644 +--- a/src/setuptools_scm/_run_cmd.py ++++ b/src/setuptools_scm/_run_cmd.py +@@ -98,7 +98,7 @@ def no_git_env(env: Mapping[str, str]) -> dict[str, str]: + k: v + for k, v in env.items() + if not k.startswith("GIT_") +- or k in ("GIT_EXEC_PATH", "GIT_SSH", "GIT_SSH_COMMAND") ++ or k in ("GIT_CEILING_DIRECTORIES", "GIT_EXEC_PATH", "GIT_SSH", "GIT_SSH_COMMAND") + } + + +-- +2.43.0 + diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm_8.0.4.bb b/os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm_8.0.4.bb new file mode 100644 index 00000000..d5f8358a --- /dev/null +++ b/os/petalinux-custom/project-spec/meta-user/recipes-devtools/python/python3-setuptools-scm_8.0.4.bb @@ -0,0 +1,32 @@ +SUMMARY = "the blessed package to manage your versions by scm tags" +HOMEPAGE = "https://pypi.org/project/setuptools-scm/" +DESCRIPTION = "setuptools_scm handles managing your Python package \ +versions in SCM metadata instead of declaring them as the version \ +argument or in a SCM managed file." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=838c366f69b72c5df05c96dff79b35f2" + +SRC_URI += "file://0001-respect-GIT_CEILING_DIRECTORIES.patch" +SRC_URI[sha256sum] = "b5f43ff6800669595193fd09891564ee9d1d7dcb196cab4b2506d53a2e1c95c7" + +inherit pypi python_setuptools_build_meta + +UPSTREAM_CHECK_REGEX = "scm-(?P.*)\.tar" + +DEPENDS += "python3-tomli-native python3-packaging-native python3-typing-extensions-native" + +RDEPENDS:${PN} = "\ + python3-packaging \ + python3-pip \ + python3-pyparsing \ + python3-setuptools \ + python3-tomli \ + python3-typing-extensions \ +" + +RDEPENDS:${PN}:append:class-target = " \ + python3-debugger \ + python3-json \ +" + +BBCLASSEXTEND = "native nativesdk" From 317d87fd80a8aa1541684c100e639dfc3bb2e4c2 Mon Sep 17 00:00:00 2001 From: Joseph Nobes Date: Thu, 4 Sep 2025 10:45:58 +0100 Subject: [PATCH 2/6] Add recipe for odin-control-rpc The rpc is an additional package also installed via pyproject.toml. This can be installed as an additional recipe pointing to the same repo. Currently this installs the module fine, but the dependencies specified in the pyproject seem to be ignored; pydantic and backports were ignored. --- .../odin-sequencer/odin-sequencer-rpc.bb | 25 +++++++++++++++++++ .../odin-sequencer_0.%.bbappend | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb new file mode 100644 index 00000000..210e273c --- /dev/null +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb @@ -0,0 +1,25 @@ +SUMMARY = "Recipe to build odin-sequencer rpc package alongside odin-sequencer" + +# Ideally this should be tightly coupled to the odin-sequencer version, as they pull the same repo. +RDEPENDS:${PN} += "odin-sequencer" + +GIT_TAG = "0.2.0" +GIT_HASH = "5331bf846669c1f4b88c5dd35e9911835cc40f99" + +PV = "${GIT_TAG}+git${SRCPV}" +SRCREV = "${GIT_HASH}" + +# This should be EXACTLY the same as odin-sequencer +SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=jupyter_rpc" + +DEPENDS += " ${PYTHON_PN}-setuptools-scm-native" + +LICENSE = "Apachev2" +# The license is at the top level of the repo, not the setup path +LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=2bd339c7a9cf03feeeee2f768a4eb0ce" + +# Build using scm pyproject.toml via poetry +inherit python_poetry_core + +# This installs the rpc package in the same repo as odin-sequencer in its own directory +S = "${WORKDIR}/git/rpc" diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend index 588b117b..a7710547 100644 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend @@ -1,5 +1,4 @@ GIT_HASH = "5331bf846669c1f4b88c5dd35e9911835cc40f99" -SRCREV = "${GIT_HASH}" SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=jupyter_rpc" From 7b142958fddf8ad8236dda81f762b2e27697bf00 Mon Sep 17 00:00:00 2001 From: Joseph Nobes Date: Thu, 4 Sep 2025 16:55:14 +0100 Subject: [PATCH 3/6] Add specific dependencies for odin-sequencer RPC --- .../recipes-apps/odin-sequencer/odin-sequencer-rpc.bb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb index 210e273c..dc908b2d 100644 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb @@ -3,6 +3,11 @@ SUMMARY = "Recipe to build odin-sequencer rpc package alongside odin-sequencer" # Ideally this should be tightly coupled to the odin-sequencer version, as they pull the same repo. RDEPENDS:${PN} += "odin-sequencer" +# Manuall specify the python dependencies, since these seem not to be brought in from the TOML +RDEPENDS:${PN} += " python3-pyzmq" +RDEPENDS:${PN} += " python3-pydantic (>= 2.0.0)" +RDEPENDS:${PN} += " python3-backports-strenum (< 2.0.0)" + GIT_TAG = "0.2.0" GIT_HASH = "5331bf846669c1f4b88c5dd35e9911835cc40f99" From 96db96a382cd0a8ac8c985fdc27854ccb6f34a31 Mon Sep 17 00:00:00 2001 From: Joseph Nobes Date: Mon, 8 Sep 2025 11:51:24 +0100 Subject: [PATCH 4/6] Build odin-sequencer-rpc without pydantic support Issues with pydantic>2 support have been avoided by removing the requirement from odin-sequencer. This now installs using poetry (a must since setuptools3 in this version does not support pyproject.toml, and there is no setup.py in this project. The RPC recipe is included automatically with RRECOMMENDS, which can be overridden if desired. --- .../recipes-apps/odin-sequencer/odin-sequencer-rpc.bb | 7 ++++--- .../odin-sequencer/odin-sequencer_0.%.bbappend | 5 ----- .../recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb | 8 +++++--- 3 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb index dc908b2d..d6586e03 100644 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb @@ -5,11 +5,11 @@ RDEPENDS:${PN} += "odin-sequencer" # Manuall specify the python dependencies, since these seem not to be brought in from the TOML RDEPENDS:${PN} += " python3-pyzmq" -RDEPENDS:${PN} += " python3-pydantic (>= 2.0.0)" -RDEPENDS:${PN} += " python3-backports-strenum (< 2.0.0)" +#RDEPENDS:${PN} += " python3-pydantic (>= 2.0.0)" +#RDEPENDS:${PN} += " python3-backports-strenum (< 2.0.0)" GIT_TAG = "0.2.0" -GIT_HASH = "5331bf846669c1f4b88c5dd35e9911835cc40f99" +GIT_HASH = "6ff07b46fb4bb1d182a0460e4c9478328292f329" PV = "${GIT_TAG}+git${SRCPV}" SRCREV = "${GIT_HASH}" @@ -25,6 +25,7 @@ LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=2bd339c7a9cf03feeeee2f768a # Build using scm pyproject.toml via poetry inherit python_poetry_core +#inherit setuptools3 # This installs the rpc package in the same repo as odin-sequencer in its own directory S = "${WORKDIR}/git/rpc" diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend deleted file mode 100644 index a7710547..00000000 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -GIT_HASH = "5331bf846669c1f4b88c5dd35e9911835cc40f99" - -SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=jupyter_rpc" - -DEPENDS += " ${PYTHON_PN}-setuptools-scm-native" diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb index f21fdf86..4cbcf97f 100644 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb @@ -4,10 +4,13 @@ SUMMARY = "This is a recipe to build odin-sequencer on PetaLinux" RDEPENDS:${PN} += "odin-control" RDEPENDS:${PN} += "python3-inotify" +DEPENDS += " ${PYTHON_PN}-setuptools-scm-native" +RRECOMMENDS:${PN} = " odin-sequencer-rpc" + # To build to a tag, update the tag here as well as the commit hash below. # You can fetch the git hash with git ls-remote https://github.com/ refs/tags/ GIT_TAG = "0.2.0" -GIT_HASH = "d413771e5b8422d41a0af3c3e9253427e10223e3" +GIT_HASH = "6ff07b46fb4bb1d182a0460e4c9478328292f329" PV = "${GIT_TAG}+git${SRCPV}" @@ -16,8 +19,7 @@ PV = "${GIT_TAG}+git${SRCPV}" # SRCREV must now be the git hash of the target tag since Yocto does not like hanging references. SRCREV = "${GIT_HASH}" -SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=master \ - file://odin-sequencer-remove-inotify-setuptools.patch" +SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=jupyter_rpc" # This has to be in the format expected in Yocto's license list... LICENSE = "Apachev2" From 7c43dbcf80e6b8164e84b67822197d25f3336ac9 Mon Sep 17 00:00:00 2001 From: Joseph Nobes Date: Thu, 11 Dec 2025 13:39:28 +0000 Subject: [PATCH 5/6] Update hash to point to new version --- .../recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb index 4cbcf97f..50f16f7d 100644 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb +++ b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer_0.2.0.bb @@ -5,12 +5,13 @@ RDEPENDS:${PN} += "odin-control" RDEPENDS:${PN} += "python3-inotify" DEPENDS += " ${PYTHON_PN}-setuptools-scm-native" -RRECOMMENDS:${PN} = " odin-sequencer-rpc" +#RRECOMMENDS:${PN} = " odin-sequencer-rpc" # To build to a tag, update the tag here as well as the commit hash below. # You can fetch the git hash with git ls-remote https://github.com/ refs/tags/ +# If you're not building to a tag, you must still put some version here, in doubt the last tag or 0.0.0 GIT_TAG = "0.2.0" -GIT_HASH = "6ff07b46fb4bb1d182a0460e4c9478328292f329" +GIT_HASH = "e0b1b08ea8b4ad306b60c5c9ab837609527bf571" PV = "${GIT_TAG}+git${SRCPV}" From 217d46d5c107b9c41b3cbb0ac8ecd54e416f9ac0 Mon Sep 17 00:00:00 2001 From: Joseph Nobes Date: Thu, 11 Dec 2025 15:35:05 +0000 Subject: [PATCH 6/6] Removed the additional RPC recipe, updated commit This will now build to the latest version working on the jupyter dev branch, now simply anticipating a change of tag to 0.3.0, and branch to main after the PR has been made. --- .../odin-sequencer/odin-sequencer-rpc.bb | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb diff --git a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb b/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb deleted file mode 100644 index d6586e03..00000000 --- a/os/petalinux-custom/project-spec/meta-user/recipes-apps/odin-sequencer/odin-sequencer-rpc.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "Recipe to build odin-sequencer rpc package alongside odin-sequencer" - -# Ideally this should be tightly coupled to the odin-sequencer version, as they pull the same repo. -RDEPENDS:${PN} += "odin-sequencer" - -# Manuall specify the python dependencies, since these seem not to be brought in from the TOML -RDEPENDS:${PN} += " python3-pyzmq" -#RDEPENDS:${PN} += " python3-pydantic (>= 2.0.0)" -#RDEPENDS:${PN} += " python3-backports-strenum (< 2.0.0)" - -GIT_TAG = "0.2.0" -GIT_HASH = "6ff07b46fb4bb1d182a0460e4c9478328292f329" - -PV = "${GIT_TAG}+git${SRCPV}" -SRCREV = "${GIT_HASH}" - -# This should be EXACTLY the same as odin-sequencer -SRC_URI = "git://github.com/stfc-aeg/odin-sequencer.git;protocol=http;branch=jupyter_rpc" - -DEPENDS += " ${PYTHON_PN}-setuptools-scm-native" - -LICENSE = "Apachev2" -# The license is at the top level of the repo, not the setup path -LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=2bd339c7a9cf03feeeee2f768a4eb0ce" - -# Build using scm pyproject.toml via poetry -inherit python_poetry_core -#inherit setuptools3 - -# This installs the rpc package in the same repo as odin-sequencer in its own directory -S = "${WORKDIR}/git/rpc"