diff options
author | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-02-11 12:07:55 +0000 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-19 17:05:17 +0000 |
commit | 4b62b9362870045a6203d01f2abf3e437bf23ae6 (patch) | |
tree | 36377248836d2f6e8e25d87a81a7de1bd27bc722 /buildstream/_context.py | |
parent | c7f76268cc6f35209587749df85f3af9cfbaabf1 (diff) | |
download | buildstream-4b62b9362870045a6203d01f2abf3e437bf23ae6.tar.gz |
context: remove artifactdir
Will check and move old artifact directory if it exists, and create
symlink linking old directory to new.
Part of #870
Diffstat (limited to 'buildstream/_context.py')
-rw-r--r-- | buildstream/_context.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py index cb537cf60..f7f298f3b 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -70,15 +70,15 @@ class Context(): # The directory for CAS self.casdir = None + # Extract directory + self.extractdir = None + # The directory for temporary files self.tmpdir = None # Default root location for workspaces self.workspacedir = None - # The local binary artifact cache directory - self.artifactdir = None - # The locations from which to push and pull prebuilt artifacts self.artifact_cache_specs = None @@ -194,18 +194,16 @@ class Context(): "builddir is obsolete, use cachedir") if defaults.get('artifactdir'): - print("artifactdir is deprecated, use cachedir") - else: - defaults['artifactdir'] = os.path.join(defaults['cachedir'], 'artifacts') + raise LoadError(LoadErrorReason.INVALID_DATA, + "artifactdir is obsolete") _yaml.node_validate(defaults, [ - 'cachedir', 'sourcedir', 'builddir', 'artifactdir', 'logdir', - 'scheduler', 'artifacts', 'logging', 'projects', - 'cache', 'prompt', 'workspacedir', 'remote-execution', + 'cachedir', 'sourcedir', 'builddir', 'logdir', 'scheduler', + 'artifacts', 'logging', 'projects', 'cache', 'prompt', + 'workspacedir', 'remote-execution', ]) - for directory in ['cachedir', 'sourcedir', 'artifactdir', 'logdir', - 'workspacedir']: + for directory in ['cachedir', 'sourcedir', 'logdir', 'workspacedir']: # Allow the ~ tilde expansion and any environment variables in # path specification in the config files. # @@ -216,14 +214,21 @@ class Context(): setattr(self, directory, path) # add directories not set by users + self.extractdir = os.path.join(self.cachedir, 'extract') self.tmpdir = os.path.join(self.cachedir, 'tmp') self.casdir = os.path.join(self.cachedir, 'cas') self.builddir = os.path.join(self.cachedir, 'build') + # Move old artifact cas to cas if it exists and create symlink + old_casdir = os.path.join(self.cachedir, 'artifacts', 'cas') + if (os.path.exists(old_casdir) and not os.path.islink(old_casdir) and + not os.path.exists(self.casdir)): + os.rename(old_casdir, self.casdir) + os.symlink(self.casdir, old_casdir) + # Load quota configuration - # We need to find the first existing directory in the path of - # our artifactdir - the artifactdir may not have been created - # yet. + # We need to find the first existing directory in the path of our + # cachedir - the cachedir may not have been created yet. cache = _yaml.node_get(defaults, Mapping, 'cache') _yaml.node_validate(cache, ['quota', 'pull-buildtrees', 'cache-buildtrees']) |