Example #1
0
    def __init__(self, cp, target_dir):
        self.cp = cp
        self.cache = FileCache(cp)

        self.target_dir = target_dir
        self.trees_dir = os.path.join(target_dir, 'trees')
        self.archives_dir = os.path.join(target_dir, 'archives')

        mkdir_p(self.trees_dir)
        mkdir_p(self.archives_dir)
Example #2
0
def do_thaw(conf, tree, dest_path):
    """st: the storage object to pull archives from"""

    for (relpath, entry) in tree.entries.items():
        fullpath = os.path.join(dest_path, relpath.lstrip('/'))
        log(StartedProcessingFile(relpath, fullpath))

        dirname = os.path.dirname(fullpath)
        # Sanity check
        assert dest_path.rstrip('/') in dirname

        mkdir_p(dirname)

        # Check type of entry
        if entry.entry_type == TreeEntry.FILE:
            thaw_file(conf, tree, entry, fullpath)
        elif entry.entry_type == TreeEntry.DIR:
            # TODO: perms
            os.mkdir(fullpath)
        elif entry.entry_type == TreeEntry.SYMLINK:
            thaw_symlink(entry, fullpath)
        else:
            raise NotImplementedError("TreeEntry type not recognized: {}".format(entry.entry_type))