From: michael.opdenacker@bootlin.com
To: docs@lists.yoctoproject.org
Cc: Michael Opdenacker <michael.opdenacker@bootlin.com>,
Yoann CONGAL <yoann.congal@smile.fr>,
Randy MacLeod <randy.macleod@windriver.com>,
Josef Holzmayr <jester@theyoctojester.info>
Subject: [kirkstone][PATCH] dev-manual: common-tasks: mention faster "find" command to trim sstate cache
Date: Fri, 8 Sep 2023 09:40:12 +0200 [thread overview]
Message-ID: <20230908074012.274727-1-michael.opdenacker@bootlin.com> (raw)
From: Michael Opdenacker <michael.opdenacker@bootlin.com>
[YOCTO #15182]
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Reported-by: Yoann CONGAL <yoann.congal@smile.fr>
Reported-by: Randy MacLeod <randy.macleod@windriver.com>
Reported-by: Josef Holzmayr <jester@theyoctojester.info>
---
documentation/dev-manual/common-tasks.rst | 37 +++++++++++++++++------
1 file changed, 27 insertions(+), 10 deletions(-)
diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index 6a527f0ef8..a2404e5f4e 100644
--- a/documentation/dev-manual/common-tasks.rst
+++ b/documentation/dev-manual/common-tasks.rst
@@ -6511,25 +6511,42 @@ building a recipe once the recipe is built. For more information on
Yocto Project Reference Manual.
Purging Duplicate Shared State Cache Files
--------------------------------------------
+------------------------------------------
After multiple build iterations, the Shared State (sstate) cache can contain
-duplicate cache files for a given package, while only the most recent one
-is likely to be reusable. The following command purges all but the
-newest sstate cache file for each package::
+duplicate cache files for a given package, consuming a substantial amount of
+disk space. However, only the most recent cache files are likeky to be reusable.
- sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache
+The following command is a quick way to purge all the cache files which
+haven't been used for a least a specified number of days::
-This command will ask you to confirm the deletions it identifies.
+ find build/sstate-cache -type f -mtime +$DAYS -delete
+
+The above command relies on the fact that BitBake touches the sstate cache
+files as it accesses them, when it has write access to the cache.
+
+You could use ``-atime`` instead of ``-mtime`` if the partition isn't mounted
+with the ``noatime`` option for a read only cache.
-Note::
+For more advanced needs, OpenEmbedded-Core also offers a more elaborate
+command. It has the ability to purge all but the newest cache files on each
+architecture, and also to remove files that it considers unreachable by
+exploring a set of build configurations. However, this command
+requires a full build environment to be available and doesn't work well
+covering multiple releases. It won't work either on limited environments
+such as BSD based NAS::
- The duplicated sstate cache files of one package must have the same
- architecture, which means that sstate cache files with multiple
- architectures are not considered as duplicate.
+ sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache
+This command will ask you to confirm the deletions it identifies.
Run ``sstate-cache-management.sh`` for more details about this script.
+.. note::
+
+ As this command is much more cautious and selective, removing only cache files,
+ it will execute much slower than the simple ``find`` command described above.
+ Therefore, it may not be your best option to trim huge cache directories.
+
Working with Packages
=====================
--
2.34.1
reply other threads:[~2023-09-08 7:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230908074012.274727-1-michael.opdenacker@bootlin.com \
--to=michael.opdenacker@bootlin.com \
--cc=docs@lists.yoctoproject.org \
--cc=jester@theyoctojester.info \
--cc=randy.macleod@windriver.com \
--cc=yoann.congal@smile.fr \
/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