
If you have complex recipes that write multiple files to the downloads folder, output packages to a different folder than the RECIPE_CACHE_DIR, or some other variation, you should adapt the script accordingly. Please note this is very crudely written to suit our needs. The script autopkg-cache-clean.sh is available here.

The script will keep a specified number of packages in the root of each directory in the RECIPE_CACHE_DIR, defaulting to the 2 most recent, and a specified number of files in the downloads folder within each cache directory, again defaulting to the 2 most recent. Prompted by a full system drive on one of my AutoPkg runners, I’ve finally got around to writing a rough-and-ready script to do the cleanup. Additionally, we would rather keep the latest downloads so that comparisons with previous runs can be done to prevent re-download.

In our setup, we cannot do that as we require the latest packages and recipe receipts to be kept in the Cache for further use by other recipes. Much of the cruft is older downloads and any packages generated.ĭepending on your setup, you may be able to just delete the entire Cache folder periodically, or even after every run. The longer you use AutoPkg without cleaning up the Cache folder, the more cruft you’re going to get.
