Browse Source

cache: define cache paths and GBUILD_CACHE_ENABLED only if caching is enabled

Cory Fields 5 years ago
2 changed files with 11 additions and 5 deletions
  1. 5
  2. 6

+ 5
- 2
bin/gbuild View File

@@ -109,8 +109,11 @@ def build_one_configuration(suite, arch, build_desc, reference_datetime)
script.puts "umask 002"
script.puts "export OUTDIR=$HOME/out"
script.puts "GBUILD_BITS=#{bits}"
script.puts "GBUILD_PACKAGE_CACHE=$HOME/cache/#{build_desc["name"]}"
script.puts "GBUILD_COMMON_CACHE=$HOME/cache/common"
if build_desc["enable_cache"]
script.puts "GBUILD_CACHE_ENABLED=1"
script.puts "GBUILD_PACKAGE_CACHE=$HOME/cache/#{build_desc["name"]}"
script.puts "GBUILD_COMMON_CACHE=$HOME/cache/common"
script.puts "MAKEOPTS=(-j#{@options[:num_procs]})"
(ref_date, ref_time) = reference_datetime.split
script.puts "REFERENCE_DATETIME='#{reference_datetime}'"

+ 6
- 3
doc/CACHE View File

@@ -5,14 +5,17 @@ is enabled in the build descriptor.
Common cache:
All descriptors share this cache. It can be useful for storing fetched sources,
sharing build assets between descriptors, etc.
To add or update files, copy them to ~/cache/common from the build script.

Per-descriptor cache
Files installed to this cache can only be seen by this descriptor. Use this to
store assets created as part of the build process, to avoid having to rebuild
them in future builds.
To add or update files, copy them to ~/cache/$NAME from the build script, where
$NAME is the value of the descriptor's "name" key.

If caching is enabled, GBUILD_CACHE_ENABLED will be set to 1 in the build
script. In addition, GBUILD_PACKAGE_CACHE and GBUILD_COMMON_CACHE will be set
to their respective paths. GBUILD_PACKAGE_CACHE contains the descriptor's
"name" key as a means of separating caches. To add or update the cached files,
copy them to these paths.

Before each build, all files and folders in the cache directories will be
transferred to the VM. After each successful build, the caches will be