def unpack(self, toolchain, out_of_tree=True): if out_of_tree: parent_path = toolchain.src_path else: parent_path = toolchain.build_path path = untar(self.download(toolchain), parent_path, self.base) return path
def unpack(self, toolchain, out_of_tree=True): if out_of_tree: parent_path = toolchain.src_path else: parent_path = toolchain.build_path path = untar(self.download(toolchain), parent_path, self.base) if self.patches is not None: push_all(toolchain, path, self.patches) return path
def unpack(self, toolchain, out_of_tree=True): if out_of_tree: parent_path = toolchain.src_path else: parent_path = toolchain.build_path path = untar(self.download(toolchain), parent_path, self.base) if self.edits is not None: for filename, function in self.edits.items(): with open(os.path.join(path, filename), 'r+t') as f: old_data = f.read() new_data = function(old_data) f.seek(0) f.truncate(0) f.write(new_data) return path
def unpack(self, toolchain, out_of_tree=True): if out_of_tree: parent_path = toolchain.src_path else: parent_path = toolchain.build_path # protect concurrent builds by holding an exclusive lock os.makedirs(parent_path, exist_ok=True) self.__unpack_lockfile = open( os.path.join(parent_path, 'lock.' + self.base), 'w') fcntl.flock(self.__unpack_lockfile.fileno(), fcntl.LOCK_EX) path = untar(self.download(toolchain), parent_path, self.base, lazy=out_of_tree and self.patches is None) if self.patches is not None: push_all(toolchain, path, self.patches) return path
def unpack(self, toolchain, out_of_tree=True): if out_of_tree: parent_path = toolchain.src_path else: parent_path = toolchain.build_path return untar(self.download(toolchain), parent_path, self.base)