From b1e59cf0a1489074b2a5adf8db8b346dacf66c15 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 11 Nov 2014 01:20:32 -0500 Subject: [PATCH] cache: define cache paths and GBUILD_CACHE_ENABLED only if caching is enabled --- bin/gbuild | 7 +++++-- doc/CACHE | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/gbuild b/bin/gbuild index f4858c2..5b3cb8d 100755 --- a/bin/gbuild +++ b/bin/gbuild @@ -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" + end script.puts "MAKEOPTS=(-j#{@options[:num_procs]})" (ref_date, ref_time) = reference_datetime.split script.puts "REFERENCE_DATETIME='#{reference_datetime}'" diff --git a/doc/CACHE b/doc/CACHE index ea320fa..9df1b59 100644 --- a/doc/CACHE +++ b/doc/CACHE @@ -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