Patchwork [v3,1/2] ccache: change default cache directory path to match config setting

login
register
mail settings
Submitter Danomi Manchego
Date May 1, 2014, 2:05 a.m.
Message ID <1398909907-1847-1-git-send-email-danomimanchego123@gmail.com>
Download mbox | patch
Permalink /patch/344390/
State Accepted
Headers show

Comments

Danomi Manchego - May 1, 2014, 2:05 a.m.
Commit 433290761fceb476b095548eec10adf72405e050 changed the hard-coded
ccache directory location to use BR_CACHE_DIR (then BUILDROOT_CACHE_DIR),
which is exported by Makefile based on the BR2_CCACHE_DIR config option.
This allowed the cache location to be changed on-the-fly by setting a
"make" command line variable, but left the default location of ccache's
normal default at "$HOME/.ccache".  Since this location does not match the
default for BR2_CCACHE_DIR, it is basically almost never correct, so
direct invocation of ccache outside of the buildroot Makefile, such as for
increasing the cache size, becomes cumbersome.

This patch changes the last-ditch cache location from "$HOME/.ccache" to
the BR_CCACHE_DIR value defined when host-ccache is configured.  Note that
the ability to later override the cache location by using a BR_CACHE_DIR
command line variable is left intact.

Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>

---

Changes v2 -> v3:
* n/a

Changes v1 -> v2:
* Refresh against latest, rather than building on top of unrelated WIP patch.
* Update patch commit log wording.
---
 package/ccache/ccache.mk |    3 +++
 1 file changed, 3 insertions(+)
Thomas De Schampheleire - May 1, 2014, 5:52 a.m.
Danomi Manchego <danomimanchego123@gmail.com> schreef:
>Commit 433290761fceb476b095548eec10adf72405e050 changed the hard-coded
>ccache directory location to use BR_CACHE_DIR (then BUILDROOT_CACHE_DIR),
>which is exported by Makefile based on the BR2_CCACHE_DIR config option.
>This allowed the cache location to be changed on-the-fly by setting a
>"make" command line variable, but left the default location of ccache's
>normal default at "$HOME/.ccache".  Since this location does not match the
>default for BR2_CCACHE_DIR, it is basically almost never correct, so
>direct invocation of ccache outside of the buildroot Makefile, such as for
>increasing the cache size, becomes cumbersome.
>
>This patch changes the last-ditch cache location from "$HOME/.ccache" to
>the BR_CCACHE_DIR value defined when host-ccache is configured.  Note that
>the ability to later override the cache location by using a BR_CACHE_DIR
>command line variable is left intact.
>
>Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>

You  should have pasted my review and test tags here...

Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Tested-by : Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Danomi Manchego - May 1, 2014, 1:40 p.m.
Thomas,

On Thu, May 1, 2014 at 1:52 AM, Thomas De Schampheleire
<patrickdepinguin@gmail.com> wrote:
> You  should have pasted my review and test tags here...
>
> Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> Tested-by : Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Such tags survive the rev process?  In this case, this patch didn't
change from v2 to v3, but in general, I thought it might be
disingenuous to claim those fields on rev X, when they were granted on
rev X-n ...
Thomas De Schampheleire - May 1, 2014, 2:01 p.m.
Danomi Manchego <danomimanchego123@gmail.com> schreef:
>Thomas,
>
>On Thu, May 1, 2014 at 1:52 AM, Thomas De Schampheleire
><patrickdepinguin@gmail.com> wrote:
>> You  should have pasted my review and test tags here...
>>
>> Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>> Tested-by : Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>
>Such tags survive the rev process?  In this case, this patch didn't
>change from v2 to v3, but in general, I thought it might be
>disingenuous to claim those fields on rev X, when they were granted on
>rev X-n ...

They only survive on unchanged revisions, which was the case on this first patch. Indeed for changed revisions, like the second patch, any tag should not be copy pasted as the content is different.

Best regards,
Thomas
Thomas Petazzoni - June 14, 2014, 5:58 p.m.
Dear Danomi Manchego,

On Wed, 30 Apr 2014 22:05:06 -0400, Danomi Manchego wrote:
> Commit 433290761fceb476b095548eec10adf72405e050 changed the hard-coded
> ccache directory location to use BR_CACHE_DIR (then BUILDROOT_CACHE_DIR),
> which is exported by Makefile based on the BR2_CCACHE_DIR config option.
> This allowed the cache location to be changed on-the-fly by setting a
> "make" command line variable, but left the default location of ccache's
> normal default at "$HOME/.ccache".  Since this location does not match the
> default for BR2_CCACHE_DIR, it is basically almost never correct, so
> direct invocation of ccache outside of the buildroot Makefile, such as for
> increasing the cache size, becomes cumbersome.
> 
> This patch changes the last-ditch cache location from "$HOME/.ccache" to
> the BR_CCACHE_DIR value defined when host-ccache is configured.  Note that
> the ability to later override the cache location by using a BR_CACHE_DIR
> command line variable is left intact.
> 
> Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>

Applied, thanks!

Thomas

Patch

diff --git a/package/ccache/ccache.mk b/package/ccache/ccache.mk
index 650290d..df92c5e 100644
--- a/package/ccache/ccache.mk
+++ b/package/ccache/ccache.mk
@@ -30,9 +30,12 @@  HOST_CCACHE_CONF_OPT += ccache_cv_zlib_1_2_3=no
 #    the compiler, because in the context of Buildroot, that completely
 #    defeats the purpose of ccache. Of course, that leaves the user
 #    responsible for purging its cache when the compiler changes.
+#  - Change hard-coded last-ditch default to match path in .config, to avoid
+#    the need to specify BR_CACHE_DIR when invoking ccache directly.
 define HOST_CCACHE_PATCH_CONFIGURATION
 	sed -i 's,getenv("CCACHE_DIR"),getenv("BR_CACHE_DIR"),' $(@D)/ccache.c
 	sed -i 's,getenv("CCACHE_COMPILERCHECK"),"none",' $(@D)/ccache.c
+	sed -i 's,"%s/.ccache","$(BR_CACHE_DIR)",' $(@D)/ccache.c
 endef
 
 HOST_CCACHE_POST_CONFIGURE_HOOKS += \