def execute(self): self.journal.section('Finalise Package') build_tree = self.__create_pkg_build_tree() files.clean_directory(build_tree.root_path) pkg_meta_file_path = build_tree.pkg_meta_file_path() self.__create_pkg_meta(pkg_meta_file_path) pkg_path = build_tree.gen_pkg_path( self.project.config.full_name, self.project.config.version, packaging=self.project.config.packaging) self.journal.event('Creating package at: {0}'.format(pkg_path)) pkg_tree = pkgs.ExpandedPkgTree() compiled_content_path = self.content_tree.root_path if self.project.config.packaging == CSAR_PACKAGING: with zipfile.ZipFile(pkg_path, mode='w') as pkg_zip: self.__build_package(pkg_zip.write, pkg_tree, compiled_content_path, pkg_meta_file_path) else: with tarfile.open(pkg_path, mode='w:gz') as pkg_tar: self.__build_package(pkg_tar.add, pkg_tree, compiled_content_path, pkg_meta_file_path) self.__clear_compile_directory() try: return pkgs.Pkg(pkg_path) except pkgs.InvalidPackageError as e: raise PkgProcessError(str(e)) from e
def push(self, env_sessions, options): journal = self.__init_journal(options.journal_consumer) journal.section('Processing Package') journal.event('Processing {0}'.format(self.path)) push_workspace = self.__create_push_workspace() files.clean_directory(push_workspace) pkg_content = self.open(push_workspace) pkg_content.push(env_sessions, options) return pkg_content
def push(self, env_sessions, options): journal = self.__init_journal(options.journal_consumer) journal.section('Processing Package') journal.event('Processing {0}'.format(self.path)) push_workspace = self.__create_push_workspace() files.clean_directory(push_workspace) pkg_content = self.open(push_workspace) if self.__is_etsi_pkg(pkg_content.meta): etsi_push_exec.EtsiPushProcess(self, pkg_content.meta, journal, env_sessions, push_workspace).execute() else: pkg_content.push(env_sessions, options) return pkg_content
def __prepare_compile_directories(self): files.clean_directory(self.content_tree.root_path)
def __prepare_stage_directories(self): files.clean_directory(self.staging_tree.root_path)