diff options
-rwxr-xr-x | morphlib/app.py | 24 | ||||
-rw-r--r-- | morphlib/buildcommand.py | 11 | ||||
-rw-r--r-- | morphlib/builder2.py | 5 | ||||
-rw-r--r-- | morphlib/util.py | 23 |
4 files changed, 18 insertions, 45 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index b2ddfdb1..47288a6a 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -220,12 +220,6 @@ class Morph(cliapp.Application): yield args[0], args[1], args[2] + ".morph" args = args[3:] - def _itertriplets(self, *args): - warnings.warn('_itertriplets is deprecated, ' - 'use itertriplets instead', stacklevel=1, - category=DeprecationWarning) - return self.itertriplets(*args) - def create_source_pool(self, lrc, rrc, triplet): pool = morphlib.sourcepool.SourcePool() @@ -239,12 +233,6 @@ class Morph(cliapp.Application): visit=add_to_pool) return pool - def _create_source_pool(self, *args): - warnings.warn('_create_source_pool is deprecated, ' - 'use create_source_pool instead', stacklevel=1, - category=DeprecationWarning) - return self.create_source_pool(*args) - def resolve_ref(self, lrc, rrc, reponame, ref, update=True): '''Resolves commit and tree sha1s of the ref in a repo and returns it. @@ -321,12 +309,6 @@ class Morph(cliapp.Application): queue.extend((c['repo'], c['ref'], '%s.morph' % c['morph']) for c in morphology['chunks']) - def _traverse_morphs(self, *args): - warnings.warn('_traverse_morphs is deprecated, ' - 'use traverse_morphs instead', stacklevel=1, - category=DeprecationWarning) - return self.traverse_morphs(*args) - def cache_repo_and_submodules(self, cache, url, ref, done): subs_to_process = set() subs_to_process.add((url, ref)) @@ -347,12 +329,6 @@ class Morph(cliapp.Application): if (submod.url, submod.commit) not in done: subs_to_process.add((submod.url, submod.commit)) - def _cache_repo_and_submodules(self, *args): - warnings.warn('_cache_repo_and_submodules is deprecated, ' - 'use cache_repo_and_submodules instead', stacklevel=1, - category=DeprecationWarning) - return self.cache_repo_and_submodules(*args) - def status(self, **kwargs): '''Show user a status update. diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index df9cc690..907676fa 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -62,17 +62,16 @@ class BuildCommand(object): return morphlib.cachekeycomputer.CacheKeyComputer(build_env) def new_artifact_caches(self): - return morphlib.util.new_artifact_caches(self.app.settings) + '''Create interfaces for the build artifact caches. - def create_artifact_cachedir(self): - return morphlib.util.create_artifact_cachedir(self.app.settings) + This includes creating the directories on disk if they are missing. + + ''' + return morphlib.util.new_artifact_caches(self.app.settings) def new_repo_caches(self): return morphlib.util.new_repo_caches(self.app) - def create_cachedir(self): - return morphlib.util.create_cachedir(self.app.settings) - def compute_build_order(self, repo_name, ref, filename): '''Compute build order for a triplet.''' self.app.status(msg='Figuring out the right build order') diff --git a/morphlib/builder2.py b/morphlib/builder2.py index ac40bf22..9ed75397 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -321,9 +321,10 @@ class ChunkBuilder(BuilderBase): # Get the destination path ccache_destdir= os.path.join(self.staging_area.tempdir, 'tmp', 'ccache') - # Make sure that the destination exists + # Make sure that the destination exists. We'll create /tmp if necessary + # to avoid breaking when faced with an empty staging area. if not os.path.isdir(ccache_destdir): - os.mkdir(ccache_destdir) + os.makedirs(ccache_destdir) # Mount it into the staging-area self.app.runcmd(['mount', '--bind', ccache_repodir, ccache_destdir]) diff --git a/morphlib/util.py b/morphlib/util.py index e171714a..c832a141 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -76,7 +76,7 @@ def make_concurrency(cores=None): def create_cachedir(settings): # pragma: no cover - '''Create a new cache directory.''' + '''Return cache directory, creating it if necessary.''' cachedir = settings['cachedir'] if not os.path.exists(cachedir): @@ -84,21 +84,17 @@ def create_cachedir(settings): # pragma: no cover return cachedir -def create_artifact_cachedir(settings): # pragma: no cover - '''Create a new directory for the local artifact cache.''' - - artifact_cachedir = os.path.join( - settings['cachedir'], 'artifacts') - if not os.path.exists(artifact_cachedir): - os.mkdir(artifact_cachedir) - return artifact_cachedir +def new_artifact_caches(settings): # pragma: no cover + '''Create new objects for local and remote artifact caches. + This includes creating the directories on disk, if missing. -def new_artifact_caches(settings): # pragma: no cover - '''Create new objects for local, remote artifact caches.''' + ''' - create_cachedir(settings) - artifact_cachedir = create_artifact_cachedir(settings) + cachedir = create_cachedir(settings) + artifact_cachedir = os.path.join(cachedir, 'artifacts') + if not os.path.exists(artifact_cachedir): + os.mkdir(artifact_cachedir) lac = morphlib.localartifactcache.LocalArtifactCache(artifact_cachedir) @@ -109,6 +105,7 @@ def new_artifact_caches(settings): # pragma: no cover rac = None return lac, rac + def combine_aliases(app): # pragma: no cover '''Create a full repo-alias set from the app's settings.''' trove_host = app.settings['trove-host'] |