- Add a shared AUFS utility lib and change both changes and streamlayerformat to use it

- Add UI for selecting whether to pull the tag, the repo, or the squashed tag
This commit is contained in:
Joseph Schorr 2014-09-18 15:56:59 -04:00
parent 43555af63d
commit 05bb710830
8 changed files with 197 additions and 79 deletions

View file

@ -1,8 +1,8 @@
import marisa_trie
import os
import tarfile
import StringIO
import traceback
from aufs import is_aufs_metadata, get_deleted_prefix
AUFS_METADATA = u'.wh..wh.'
@ -70,19 +70,15 @@ class StreamLayerMerger(object):
def process_tar_info(self, tar_info):
absolute = os.path.relpath(tar_info.name.decode('utf-8'), './')
dirname = os.path.dirname(absolute)
filename = os.path.basename(absolute)
# Skip directories and metadata
if (filename.startswith(AUFS_METADATA) or
absolute.startswith(AUFS_METADATA)):
# Skip
# Skip metadata.
if is_aufs_metadata(absolute):
return None
elif filename.startswith(AUFS_WHITEOUT):
removed_filename = filename[AUFS_WHITEOUT_PREFIX_LENGTH:]
removed_prefix = os.path.join('/', dirname, removed_filename)
self.encountered.append(removed_prefix)
# Add any prefix of deleted paths to the prefix list.
deleted_prefix = get_deleted_prefix(absolute)
if deleted_prefix is not None:
self.encountered.append(deleted_prefix)
return None
# Check if this file has already been encountered somewhere. If so,
@ -90,10 +86,6 @@ class StreamLayerMerger(object):
if unicode(absolute) in self.trie:
return None
# Otherwise, add the path to the encountered list and return it.
self.encountered.append(absolute)
if tar_info.isdir() or tar_info.issym() or tar_info.islnk():
return (tar_info, False)
elif tar_info.isfile():
return (tar_info, True)
return (tar_info, tar_info.isfile() or tar_info.isdev())