Re: [ccache] Configuration file plan

2011-04-27 Thread Joel Rosdahl
On 2011-04-06 23:25, Owen Mann wrote:
 Question: for an NFS-mounted cache, wouldn't different users'
 CCACHE_MAX values conflict? It seems to me it's better as a
 one-time or per-cache setting. I can definitely see how it would have
 value in a single-user setup, though.

One of my reasons for wanting to introduce a configuration file is to
improve the multi-user case so that it's easier to make all users use
the same settings (umask, compression, hardlink, nlevels, max_size,
etc.), so I haven't considered having a per-user configuration file --
ccachedir/ccache.conf is per-cache.

-- Joel
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Configuration file plan

2011-04-27 Thread Joel Rosdahl
On 2011-04-07 02:30, Martin Pool wrote:
 I would think about not putting ccache.conf inside .ccache, because
 that directory might often be excluded from backups or in some other
 way treated as disposable.  Aside from that it sounds really good.

I'd prefer the configuration to be tied to the cache, so it will be hard
to do it another way given the current cache directory layout. I guess
the only reasonable alternative is $(dirname $cache_dir)/ccache.conf.

-- Joel
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Configuration file plan

2011-04-06 Thread Owen Mann
FWIW, it sounds pretty sexy to me! :-)

Question: for an NFS-mounted cache, wouldn't different users' CCACHE_MAX 
values conflict? It seems to me it's better as a one-time or per-cache setting. 
I can definitely see how it would have value in a single-user setup, though.

 Original message 
Date: Wed, 06 Apr 2011 22:12:55 +0200
From: ccache-boun...@lists.samba.org (on behalf of Joel Rosdahl 
j...@rosdahl.net)
Subject: [ccache] Configuration file plan  
To: ccache list ccache@lists.samba.org

Hi,

I would like to improve ccache's configurability. As you know, configuration of
ccache is today done by setting a bunch of environment variables, but that's
becoming increasingly messy; there are currently 24 CCACHE_* variables in the
development version of ccache. I think it's time to move settings to a
configuration file while keeping the ability to override configuration by
setting environment variables.

I actually envision two configuration files:

- sysconfdir/ccache.conf (typically /etc/ccache.conf)
- ccachedir/ccache.conf (typically $HOME/.ccache/ccache.conf)

ccache reads both (if they exist) each time it's run. Settings then have the
following priority:

1. Environment variables.
2. ccachedir/ccache.conf
3. sysconfdir/ccache.conf
4. Compile-time defaults.

This means that:

- The administrator can choose default settings for the system by editing
  sysconfdir/ccache.conf.
- The user can override the system settings with his/her own default settings
  by editing ccachedir/ccache.conf. (If ccachedir is shared by several
  users, the settings are of course also shared.)
- The user can override the default settings temporarily by setting environment
  variables.
- It's backwards compatible with the existing environment variables.

I expect that the overhead of reading the configuration file(s) will be
negligible.

The max files and max size settings (set by command-line options
-F/--max-files and -M/--max-size) are today stored in the stats files in the
cache, but these will find a much better place in ccachedir/ccache.conf.

I think the configuration file syntax should be a simple text format like this:

# A comment.
key = value

No quotes around strings (at least not mandatory). Whitespace is trimmed at the
beginning and end of values.

Mapping between environment variables and keys in the configuration files:

Environment variable   Config key   Type Default   Note
---
CCACHE_BASEDIR base_dir string   [1]
CCACHE_CC  compiler string   [2]
CCACHE_COMPILERCHECK   compiler_check   string   mtime
CCACHE_COMPRESScompression  boolean  false
CCACHE_CPP2run_second_cpp   boolean  false
CCACHE_DETECT_SHEBANG  detect_shebang   boolean  false
CCACHE_DIR cache_dirstring   $HOME/.ccache
CCACHE_DIRECT  direct_mode  boolean  true
CCACHE_DISABLE disable  boolean  false
CCACHE_EXTENSION   cpp_extensionstring   [3]
CCACHE_EXTRAFILES  extra_files_to_hash  string   
CCACHE_HARDLINKhard_linkboolean  false
CCACHE_HASHDIR hash_dir boolean  false
CCACHE_LOGFILE log_file string   [4]
NEW CCACHE_MAXFILESmax_filesinteger  0 [5]
NEW CCACHE_MAXSIZE max_size integer  1G[6]
CCACHE_NLEVELS cache_dir_levels integer  2
CCACHE_PATHpath string   [7]
CCACHE_PREFIX  prefix_command   string   [8]
CCACHE_READONLYread_onlyboolean  false
CCACHE_RECACHE recache  boolean  false
CCACHE_SLOPPINESS  sloppiness   string   
CCACHE_STATS   statsboolean  true
CCACHE_TEMPDIR temporary_dirstring   [9]
CCACHE_UMASK   umaskinteger  - [10]
CCACHE_UNIFY   unifyboolean  false

String and integer settings are handled in a straight-forward manner, but
boolean settings are a bit special for backward-compatibility reasons:

  - A boolean CCACHE_FOO set to any value (even the empty string) means true;
unset means false.
  - For each boolean CCACHE_FOO, there is also a CCACHE_NOFOO with the inverse
logic. CCACHE_FOO (if set) has higher priority than CCACHE_NOFOO. (Some
settings are quite silly in their NO variant, but I think it's worth it for
consistency.)
  - The possible values of a boolean setting in the configuration file are
spelled true and false.

$VARIABLE and ${VARIABLE} references will be expanded as expected in variables
that specify paths.

Notes:

[1] The empty string

Re: [ccache] Configuration file plan

2011-04-06 Thread Martin Pool
I would think about not putting ccache.conf inside .ccache, because
that directory might often be excluded from backups or in some other
way treated as disposable.  Aside from that it sounds really good.

Martin
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache