Skip to content

Commit 30ff1e7

Browse files
committed
Exclude WORKDIR from recipe stamps, allowing caching
During install of rust-bin and cargo-bin binaries are placed into ${S}, which itself builds on ${WORKDIR}. Normally ${WORKDIR} is ignored for sstate cache but it is not being ignored properly in rust-bin and cargo-bin for two different reasons: In rust-bin, a dependency is being created on the value of ${S} instead of creating a transitive dependency on ${S} -> ${WORKDIR} and then ignoring ${WORKDIR}. It's not clear why exactly this is the case, but it was confirmed by looking at the output of the stamps for the rust-bin recipe. The fix is to explicitly exclude ${WORKDIR} from the creation of ${S} with a `vardepsexclude` In cargo-bin the issue is more straight-forward: the ${S} value was being explicitly assembled in Python code, so Bitbake never sees that ${S} is formed from ${WORKDIR}. Adding explicit `vardeps` and `vardepsexcludes` in the Python section fixes this. Signed-off-by: Nick Stevens <[email protected]>
1 parent bbc889d commit 30ff1e7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

recipes-devtools/rust/cargo-bin-cross.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ python () {
3636
(cargo_url(target), cargo_md5(target), cargo_sha256(target),
3737
d.getVar("PN", True) + "-" + pv + "-" + target + ".tar.gz"))
3838
src_uri = d.getVar("SRC_URI", True).split()
39+
cargo_extract_path = cargo_url(target).split('/')[-1].replace('.tar.gz', '')
3940
d.setVar("SRC_URI", ' '.join(src_uri + [cargo_uri]))
40-
d.setVar("S", "{}/{}".format(d.getVar("WORKDIR", True), cargo_url(target).split('/')[-1].replace('.tar.gz', '')))
41+
d.setVar("S", "${{WORKDIR}}/{}".format(cargo_extract_path))
42+
d.appendVarFlag("S", "vardeps", " cargo_url")
43+
d.appendVarFlag("S", "vardepsexclude", " WORKDIR")
4144
}

recipes-devtools/rust/rust-bin-cross.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ RUST_ALL_TARGETS = "${RUST_BUILD_TARGET} ${RUST_TARGET_TARGET} ${EXTRA_RUST_TARG
2222

2323
S = "${WORKDIR}/rustc-${PV}-${RUST_BUILD_TARGET}"
2424

25+
# Relocating WORKDIR doesn't matter to installer
26+
S[vardepsexclude] += "WORKDIR"
27+
2528
SYSROOT_DIRS_NATIVE += "${prefix}"
2629
SYSROOT_DIRS_BLACKLIST += "\
2730
${prefix}/share \

0 commit comments

Comments
 (0)