diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-01-26 13:10:15 +0200 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-02-07 10:16:00 +0000 |
commit | 4299a3d9bad4269a3ed7b1501faa4f3648f322bb (patch) | |
tree | ea2913345d01145f10e5a51f61187e1c1a158119 | |
parent | 773ba91953bd5c8982fb0aabc71299f77c788c58 (diff) |
Add a summary of sdkcomponent errors at the end of a dry run
When running release_repo_updater.py and create_installer.py scripts,
capture a summary of sdkcomponent validation errors during a dry run.
Task-number: QTBUG-110633
Change-Id: I5ce637f84bcae580717a9b106cb6ce802ddc6dae
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
-rw-r--r-- | packaging-tools/create_installer.py | 7 | ||||
-rwxr-xr-x | packaging-tools/release_repo_updater.py | 20 | ||||
-rw-r--r-- | packaging-tools/sdkcomponent.py | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/packaging-tools/create_installer.py b/packaging-tools/create_installer.py index 3359e736e..1abc39d2e 100644 --- a/packaging-tools/create_installer.py +++ b/packaging-tools/create_installer.py @@ -301,6 +301,8 @@ def parse_component_data( # all component data is skipped when a dry_run mode is specified if (task.partial_installer and not component_is_valid) or task.dry_run: log.warning("Skipping component: [%s]", sdk_comp.ifw_sdk_comp_name) + # collect validation errors + task.errors.extend(sdk_comp.errors) sdk_comp.archive_skip = True # if include filter defined for component it is included only if LICENSE_TYPE # matches to include_filter @@ -1164,6 +1166,7 @@ class QtInstallerTask(Generic[QtInstallerTaskType]): create_repository: bool = False partial_installer: bool = False # Invalid IfwSdkComponents will be excluded from the installer dry_run: Optional[DryRunMode] = None + errors: List[str] = field(default_factory=list) license_type: str = "opensource" build_timestamp: str = strftime("%Y-%m-%d", gmtime()) force_version_number_increase: bool = False @@ -1389,6 +1392,10 @@ def main() -> None: ) log.info(str(task)) create_installer(task) + if task.errors: + log.warning("Collected %s errors during the execution of the task:", len(task.errors)) + for err_msg in task.errors: + log.warning(err_msg) if __name__ == "__main__": diff --git a/packaging-tools/release_repo_updater.py b/packaging-tools/release_repo_updater.py index ab8c84d80..733953c42 100755 --- a/packaging-tools/release_repo_updater.py +++ b/packaging-tools/release_repo_updater.py @@ -524,6 +524,7 @@ async def build_online_repositories( loop = asyncio.get_running_loop() # pylint: disable=no-member # use same timestamp for all built repos job_timestamp = strftime("%Y-%m-%d", gmtime()) + errors: List[str] = [] for task in tasks: tmp_dir = os.path.join(tmp_base_dir, task.repo_path) task.source_online_repository_path = os.path.join(tmp_dir, "online_repository") @@ -557,6 +558,12 @@ async def build_online_repositories( except Exception as exc: log.exception("Repository build failed!") raise PackagingError from exc + if dry_run and installer_task.errors: + errors.append( + f"Collected {len(installer_task.errors)} errors during the repository task: " + f"{task.get_repo_path()}" + ) + errors.extend(installer_task.errors) if not dry_run: script_dir = os.path.dirname(__file__) online_repo_path = os.path.abspath(os.path.join(script_dir, "online_repository")) @@ -564,6 +571,9 @@ async def build_online_repositories( shutil.move(online_repo_path, task.source_online_repository_path) log.info("Repository created at: %s", task.source_online_repository_path) done_repositories.append(task.source_online_repository_path) + if dry_run: + for err_msg in errors: + log.error(err_msg) return done_repositories @@ -799,6 +809,7 @@ async def _build_offline_tasks( loop = asyncio.get_running_loop() # pylint: disable=no-member # use same timestamp for all installer tasks job_timestamp = strftime("%Y-%m-%d", gmtime()) + errors: List[str] = [] for task in tasks: log.info("Building offline installer: %s", task.installer_name) installer_config_file = os.path.join(installer_config_base_dir, task.config_file) @@ -827,11 +838,20 @@ async def _build_offline_tasks( except Exception as exc: log.exception("Installer build failed!") raise PackagingError from exc + if dry_run and installer_task.errors: + errors.append( + f"Collected {len(installer_task.errors)} errors during the installer task: " + f"{task.get_installer_name()}" + ) + errors.extend(installer_task.errors) await sign_offline_installer(installer_output_dir, task.installer_name) if update_staging: remote_upload_path = create_offline_remote_dirs(task, staging_server, staging_server_root, installer_build_id) upload_offline_to_remote(installer_output_dir, remote_upload_path, staging_server, task, installer_build_id, enable_oss_snapshots, license_) + if dry_run: + for err_msg in errors: + log.error(err_msg) def upload_snapshots_to_remote(staging_server: str, remote_upload_path: str, task: IFWReleaseTask, installer_build_id: str, installer_filename: str) -> None: diff --git a/packaging-tools/sdkcomponent.py b/packaging-tools/sdkcomponent.py index 6e9f4decc..ea67c0db0 100644 --- a/packaging-tools/sdkcomponent.py +++ b/packaging-tools/sdkcomponent.py @@ -344,6 +344,7 @@ class IfwSdkComponent: temp_data_dir: Optional[Path] = None meta_dir_dest: Optional[Path] = None archive_skip: bool = False + errors: List[str] = field(default_factory=list) def __post_init__(self) -> None: """Post init: resolve component sha1 uri if it exists""" @@ -373,6 +374,7 @@ class IfwSdkComponent: archive.validate_uri() return True except IfwSdkError as err: + self.errors.append(f"[{self.ifw_sdk_comp_name}]: {str(err)}") if not ignore_errors: raise log.exception("[%s] Ignored error in component: %s", self.ifw_sdk_comp_name, err) |