diff options
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/bins.py | 21 | ||||
-rw-r--r-- | morphlib/bins_tests.py | 6 |
2 files changed, 7 insertions, 20 deletions
diff --git a/morphlib/bins.py b/morphlib/bins.py index 3381bc28..24a8b1f0 100644 --- a/morphlib/bins.py +++ b/morphlib/bins.py @@ -85,19 +85,6 @@ def create_chunk(rootdir, chunk_filename, regexps): os.remove(filename) -def unpack_chunk(chunk_filename, dirname): - '''Unpack a chunk into a directory. - - The directory must exist already. - - ''' - - logging.debug('Unpacking chunk %s into %s' % (chunk_filename, dirname)) - tar = tarfile.open(name=chunk_filename) - tar.extractall(path=dirname) - tar.close() - - def create_stratum(rootdir, stratum_filename): '''Create a stratum from the contents of a directory.''' logging.debug('Creating stratum file %s from %s' % @@ -107,15 +94,15 @@ def create_stratum(rootdir, stratum_filename): tar.close() -def unpack_stratum(stratum_filename, dirname): - '''Unpack a stratum into a directory. +def unpack_binary(filename, dirname): + '''Unpack a binary into a directory. The directory must exist already. ''' - logging.debug('Unpacking stratum %s into %s' % (stratum_filename, dirname)) - tar = tarfile.open(name=stratum_filename) + logging.debug('Unpacking %s into %s' % (filename, dirname)) + tar = tarfile.open(name=filename) tar.extractall(path=dirname) tar.close() diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py index 02706648..171b9652 100644 --- a/morphlib/bins_tests.py +++ b/morphlib/bins_tests.py @@ -89,14 +89,14 @@ class ChunkTests(unittest.TestCase): orig_files = recursive_lstat(self.instdir) morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['.']) os.mkdir(self.unpacked) - morphlib.bins.unpack_chunk(self.chunk_file, self.unpacked) + morphlib.bins.unpack_binary(self.chunk_file, self.unpacked) self.assertEqual(orig_files, recursive_lstat(self.unpacked)) def test_uses_only_matching_names(self): self.populate_instdir() morphlib.bins.create_chunk(self.instdir, self.chunk_file, ['bin']) os.mkdir(self.unpacked) - morphlib.bins.unpack_chunk(self.chunk_file, self.unpacked) + morphlib.bins.unpack_binary(self.chunk_file, self.unpacked) self.assertEqual([x for x,y in recursive_lstat(self.unpacked)], ['.', 'bin', 'bin/foo']) self.assertEqual([x for x,y in recursive_lstat(self.instdir)], @@ -121,7 +121,7 @@ class StratumTests(unittest.TestCase): self.populate_instdir() morphlib.bins.create_stratum(self.instdir, self.stratum_file) os.mkdir(self.unpacked) - morphlib.bins.unpack_stratum(self.stratum_file, self.unpacked) + morphlib.bins.unpack_binary(self.stratum_file, self.unpacked) self.assertEqual(recursive_lstat(self.instdir), recursive_lstat(self.unpacked)) |