def __init__(self, working_dir, build_system, vcs=None, ensure_latest=True, verbose=False): """Create a BuildProcess. Args: working_dir (str): Directory containing the package to build. build_system (`BuildSystem`): Build system used to build the package. vcs (`ReleaseVCS`): Version control system to use for the release process. If None, the package will only be built, not released. ensure_latest: If True, do not allow the release process to occur if an newer versioned package is already released. """ self.verbose = verbose self.working_dir = working_dir self.build_system = build_system self.vcs = vcs self.ensure_latest = ensure_latest if vcs and vcs.path != working_dir: raise BuildProcessError( "Build process was instantiated with a mismatched VCS instance" ) self.debug_print = config.debug_printer("package_release") self.package = get_developer_package(working_dir) hook_names = self.package.config.release_hooks or [] self.hooks = create_release_hooks(hook_names, working_dir) self.build_path = os.path.join(self.working_dir, self.package.config.build_directory)
def __init__(self, working_dir, build_system, package=None, vcs=None, ensure_latest=True, skip_repo_errors=False, ignore_existing_tag=False, verbose=False): """Create a BuildProcess. Args: working_dir (str): Directory containing the package to build. build_system (`BuildSystem`): Build system used to build the package. vcs (`ReleaseVCS`): Version control system to use for the release process. ensure_latest: If True, do not allow the release process to occur if an newer versioned package is already released. skip_repo_errors: If True, proceed with the release even when errors occur. BE CAREFUL using this option, it is here in case a package needs to be released urgently even though there is some problem with reading or writing the repository. ignore_existing_tag: Perform the release even if the repository is already tagged at the current version. If the config setting plugins.release_vcs.check_tag is False, this has no effect. """ self.verbose = verbose self.working_dir = working_dir self.build_system = build_system self.vcs = vcs self.ensure_latest = ensure_latest self.skip_repo_errors = skip_repo_errors self.ignore_existing_tag = ignore_existing_tag if vcs and vcs.pkg_root != working_dir: raise BuildProcessError( "Build process was instantiated with a mismatched VCS instance" ) self.debug_print = config.debug_printer("package_release") self.package = package or get_developer_package(working_dir) hook_names = self.package.config.release_hooks or [] self.hooks = create_release_hooks(hook_names, working_dir) self.build_path = os.path.join(self.working_dir, self.package.config.build_directory)
def run_hooks(self, hook_event, **kwargs): hook_names = self.package.config.release_hooks or [] hooks = create_release_hooks(hook_names, self.working_dir) for hook in hooks: debug_print("Running %s hook '%s'...", hook_event.label, hook.name()) try: func = getattr(hook, hook_event.__name__) func(user=getpass.getuser(), **kwargs) except ReleaseHookCancellingError as e: raise ReleaseError("%s cancelled by %s hook '%s': %s:\n%s" % (hook_event.noun, hook_event.label, hook.name(), e.__class__.__name__, str(e))) except RezError: debug_print("Error in %s hook '%s': %s:\n%s" % (hook_event.label, hook.name(), e.__class__.__name__, str(e)))
def run_hooks(self, hook_event, **kwargs): hook_names = self.package.config.release_hooks or [] hooks = create_release_hooks(hook_names, self.working_dir) for hook in hooks: debug_print("Running %s hook '%s'...", hook_event.label, hook.name()) try: func = getattr(hook, hook_event.func_name) func(user=getpass.getuser(), **kwargs) except ReleaseHookCancellingError as e: raise ReleaseError( "%s cancelled by %s hook '%s': %s:\n%s" % (hook_event.noun, hook_event.label, hook.name(), e.__class__.__name__, str(e))) except RezError: debug_print("Error in %s hook '%s': %s:\n%s" % (hook_event.label, hook.name(), e.__class__.__name__, str(e)))
def __init__(self, working_dir, build_system, package=None, vcs=None, ensure_latest=True, skip_repo_errors=False, ignore_existing_tag=False, verbose=False): """Create a BuildProcess. Args: working_dir (str): Directory containing the package to build. build_system (`BuildSystem`): Build system used to build the package. vcs (`ReleaseVCS`): Version control system to use for the release process. ensure_latest: If True, do not allow the release process to occur if an newer versioned package is already released. skip_repo_errors: If True, proceed with the release even when errors occur. BE CAREFUL using this option, it is here in case a package needs to be released urgently even though there is some problem with reading or writing the repository. ignore_existing_tag: Perform the release even if the repository is already tagged at the current version. If the config setting plugins.release_vcs.check_tag is False, this has no effect. """ self.verbose = verbose self.working_dir = working_dir self.build_system = build_system self.vcs = vcs self.ensure_latest = ensure_latest self.skip_repo_errors = skip_repo_errors self.ignore_existing_tag = ignore_existing_tag if vcs and vcs.pkg_root != working_dir: raise BuildProcessError( "Build process was instantiated with a mismatched VCS instance") self.debug_print = config.debug_printer("package_release") self.package = package or get_developer_package(working_dir) hook_names = self.package.config.release_hooks or [] self.hooks = create_release_hooks(hook_names, working_dir) self.build_path = os.path.join(self.working_dir, self.package.config.build_directory)