Local cache configuration is unclear and error prone

Summary

When setting a cache quota for the local cache, the quota doesn't take into account the sources' size.

I don't know what are the size of my sources and that means I need to remove them periodically to ensure I don't get an error with the cache.

Steps to reproduce

  • Create a cache
  • add {cache: {quota: 1MB}}
  • Create an element that has a source that will exceed this size, but has no output artifacts
  • bst build
  • bst build

What is the current bug behavior?

BuildStream fails initializing the cache, because it doesn't have enough space

Error instantiating artifact cache: Your system does not have enough available space to support the cache quota specified. You have specified a quota of 95% total disk space.

  • The filesystem containing /home/bschubert/.cache/buildstream/artifacts only has: 49.2% of total disk space available.

What is the expected correct behavior?

I would expect the size to be the total size of the cache, not just the artifacts. I would also expect dangling sources to be removed when cleaning up the cache.

Relevant logs and/or screenshots

Possible fixes

Other relevant information

  • BuildStream version affected: /milestone %BuildStream_v1.x