From: Michael Arndt <michael@rndt.dev>
To: openembedded-core@lists.openembedded.org
Cc: Michael Arndt <michael@rndt.dev>
Subject: [PATCH] sstate: Add fallback when hardlink fails
Date: Wed, 15 Apr 2026 10:58:24 +0200 [thread overview]
Message-ID: <20260415085824.1730569-1-michael@rndt.dev> (raw)
Previously the sstate didn't work on file systems that don't support hardlinks.
For example when using WebDAV to share the sstate. This change avoids the
problem by adding a fallback in case the hardlink fails.
Signed-off-by: Michael Arndt <michael@rndt.dev>
---
meta/classes-global/sstate.bbclass | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index 88449d19c7..2b18cafb60 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -795,6 +795,14 @@ python sstate_create_and_sign_package () {
except:
pass
+ # Create hardlink with fallback to rename. Useful for file systems that
+ # don't support hardlinks.
+ def hardlink(src, dst):
+ try:
+ os.link(src, dst)
+ except:
+ src.rename(dst)
+
def update_file(src, dst, force=False):
if dst.is_symlink() and not dst.exists():
force=True
@@ -804,7 +812,7 @@ python sstate_create_and_sign_package () {
if force:
src.rename(dst)
else:
- os.link(src, dst)
+ hardlink(src, dst)
return True
except:
pass
@@ -862,7 +870,7 @@ python sstate_create_and_sign_package () {
with NamedTemporaryFile(prefix=sstate_pkg.name, dir=sstate_pkg.parent) as tmp_pkg_fd:
tmp_pkg = tmp_pkg_fd.name
sstate_archive_package(tmp_pkg, d)
- update_file(tmp_pkg, sstate_pkg)
+ update_file(Path(tmp_pkg), sstate_pkg)
# update_file() may have renamed tmp_pkg, which must exist when the
# NamedTemporaryFile() context handler ends.
touch(Path(tmp_pkg))
next reply other threads:[~2026-04-15 8:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 8:58 Michael Arndt [this message]
2026-04-15 9:29 ` [OE-core] [PATCH] sstate: Add fallback when hardlink fails Richard Purdie
2026-04-15 11:52 ` Michael Arndt
2026-04-15 13:07 ` Richard Purdie
2026-04-15 14:43 ` Michael Arndt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260415085824.1730569-1-michael@rndt.dev \
--to=michael@rndt.dev \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox