Skip to content

Commit

Permalink
rac: fix some compilation problems
Browse files Browse the repository at this point in the history
A following compilation error was observed:
|   duplicate key `olpc-cjson` in table `patch.https://github.com/toradex/tough`

that is due to a sed syntax trying to append a 'olpc-cjson' line to
${CARGO_HOME}/config, but it has to delete it before hand, otherwise,
there is a risk when do_compile runs, it will append multiple
'olpc-cjson' lines to ${CARGO_HOME}/config.

also a following compilation error was observed:
|   Unable to update https://github.com/toradex/tough?branch=rac#28c2deb2

that is due to OE's cargo running in offline mode, it can not fetch any
sources through internet, so we should not use 'rac' branch as
SRCREV_tough, it has to match the exact commit hash of tough dependency
in torizon-rac's Cargo.lock file.

Also let's move the code modifying ${CARGO_HOME}/config to
do_configure, as a postfuncs, which makes more sense.

Fix: torizon/meta-toradex-torizon#28

Signed-off-by: Ming Liu <[email protected]>
  • Loading branch information
MingliuYan committed Feb 26, 2024
1 parent 00dc9fa commit e8853bf
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions recipes-sota/rac/rac_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,27 @@ SRC_URI += " \
SRCREV_FORMAT .= "russh"
SRCREV_russh = "0.37.0-beta.1"
SRCREV_FORMAT .= "tough"
SRCREV_tough = "rac"
SRCREV_tough = "28c2deb20a654426f09129bcd0938ad92de02f33"

# There is a postfunc that runs after do_configure. This fixing logic needs to run after this postfunc.
# It is because of this ordering this is do_compile:prepend instead of do_configure:append.
do_compile:prepend() {
cargo_add_rac_patch_paths() {
# Need to fix config file due to the tough and russh repo having a virtual manifest.
# Which is not supported by the cargo bbclasses currently,
# see: https://github.com/openembedded/openembedded-core/commit/684a8af41c5bb70db68e75f72bdc4c9b09630810
sed -i 's|tough =.*|tough = { path = "${WORKDIR}/tough/tough" }|g' ${CARGO_HOME}/config
sed -i '/olpc-cjson =.*/d' ${CARGO_HOME}/config
sed -i '/^tough =.*/a olpc-cjson = { path = "${WORKDIR}/tough/olpc-cjson" }' ${CARGO_HOME}/config

sed -i 's|russh =.*|russh = { path = "${WORKDIR}/russh/russh" }|g' ${CARGO_HOME}/config
sed -i '/^russh =.*/a \
russh-keys = { path = "${WORKDIR}/russh/russh-keys" } \
russh-cryptovec = { path = "${WORKDIR}/russh/cryptovec" }' ${CARGO_HOME}/config

sed -i '/russh-keys =.*/d' ${CARGO_HOME}/config
sed -i '/russh-cryptovec =.*/d' ${CARGO_HOME}/config
sed -i '/^russh =.*/a russh-cryptovec = { path = "${WORKDIR}/russh/cryptovec" }' ${CARGO_HOME}/config
sed -i '/^russh =.*/a russh-keys = { path = "${WORKDIR}/russh/russh-keys" }' ${CARGO_HOME}/config
}

do_configure[postfuncs] += "cargo_add_rac_patch_paths"

do_install:append() {
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/remote-access.service ${D}${systemd_unitdir}/system/remote-access.service
Expand Down

0 comments on commit e8853bf

Please sign in to comment.