diff options
-rw-r--r-- | morphlib/builder2.py | 22 | ||||
-rwxr-xr-x | scripts/assemble-stratum | 12 | ||||
-rwxr-xr-x | scripts/list-overlaps | 10 |
3 files changed, 22 insertions, 22 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index e0e1ca57..4191c32a 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -76,8 +76,8 @@ def download_depends(constituents, lac, rac, metadatas=None): src = rac.get_artifact_metadata(constituent, metadata) dst = lac.put_artifact_metadata(constituent, metadata) shutil.copyfileobj(src, dst) - dst.close() - src.close() + dst.close() + src.close() def get_chunk_files(f): # pragma: no cover tar = tarfile.open(fileobj=f) @@ -386,8 +386,8 @@ class StratumBuilder(BuilderBase): constituents = [dependency for dependency in self.artifact.dependencies if dependency.source.morphology['kind'] == 'chunk'] - # the only reason the StratumBuilder has to download chunks is to check - # for overlap now that strata are lists of chunks + # the only reason the StratumBuilder has to download chunks is to + # check for overlap now that strata are lists of chunks with self.build_watch('check-chunks'): # download the chunk artifact if necessary download_depends(constituents, @@ -554,13 +554,13 @@ class SystemBuilder(BuilderBase): # pragma: no cover chunk_handle.close() f.close() meta = self.local_artifact_cache.get_artifact_metadata( - stratum_artifact, 'meta') - dst = morphlib.savefile.SaveFile( - os.path.join(path, 'baserock', - '%s.meta' % stratum_artifact.name), 'w') - shutil.copyfileobj(meta, dst) - dst.close() - meta.close() + stratum_artifact, 'meta') + dst = morphlib.savefile.SaveFile( + os.path.join(path, 'baserock', + '%s.meta' % stratum_artifact.name), 'w') + shutil.copyfileobj(meta, dst) + dst.close() + meta.close() ldconfig(self.app.runcmd, path) diff --git a/scripts/assemble-stratum b/scripts/assemble-stratum index 1fe9bd12..ef81c7f6 100755 --- a/scripts/assemble-stratum +++ b/scripts/assemble-stratum @@ -35,15 +35,15 @@ class AssembleStratum(cliapp.Application): def process_args(self, args): chunklist = json.load(open(args[0])) - tarformat = 'w' + tarformat = 'w' if self.settings['tarformat'] != "": tarformat += self.settings['tarformat'] - outfile = tarfile.open(args[1], tarformat) - # concatenate chunk tarballs + outfile = tarfile.open(args[1], tarformat) + # concatenate chunk tarballs for chunk in chunklist: path = os.path.join(self.settings['cachedir'], 'artifacts', chunk) - chunktar = tarfile.open(path, mode='r:*') - for tarinfo in chunktar: + chunktar = tarfile.open(path, mode='r:*') + for tarinfo in chunktar: if tarinfo.isfile(): outfile.addfile(tarinfo, chunktar.extractfile(tarinfo)) else: @@ -53,6 +53,6 @@ class AssembleStratum(cliapp.Application): if os.path.exists(args[0] + '.meta'): outfile.add(args[0] + '.meta', os.path.join('baserock', '%s.meta' % args[2])) - outfile.close() + outfile.close() AssembleStratum().run() diff --git a/scripts/list-overlaps b/scripts/list-overlaps index 5bd96832..3d92d4ad 100755 --- a/scripts/list-overlaps +++ b/scripts/list-overlaps @@ -27,18 +27,18 @@ class ListOverlaps(cliapp.Application): @staticmethod def _load_overlap(filename): data = json.load(open(filename)) - overlaps = dict((frozenset(pair[0]), set(pair[1])) for pair in data) - return overlaps + overlaps = dict((frozenset(pair[0]), set(pair[1])) for pair in data) + return overlaps def cmd_groups(self, args): overlaps = ListOverlaps._load_overlap(args[0]) - for group in overlaps: + for group in overlaps: print(' '.join(sorted(group))) def cmd_list_files(self, args): overlaps = self._load_overlap(args[0]) - group = frozenset(args[1:]) - for filename in overlaps[group]: + group = frozenset(args[1:]) + for filename in overlaps[group]: print filename ListOverlaps().run() |