|
17 | 17 | from continuous_delivery_scripts.report_third_party_ip import generate_spdx_project_reports, SpdxProject
|
18 | 18 | from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
|
19 | 19 | from continuous_delivery_scripts.utils.definitions import CommitType
|
20 |
| -from continuous_delivery_scripts.utils.git_helpers import ProjectTempClone, GitWrapper |
| 20 | +from continuous_delivery_scripts.utils.git_helpers import ProjectTempClone, LocalProjectRepository, GitWrapper |
21 | 21 | from continuous_delivery_scripts.utils.logging import log_exception, set_log_level
|
22 | 22 |
|
23 | 23 | SPDX_REPORTS_DIRECTORY = "licensing"
|
@@ -50,6 +50,7 @@ def tag_and_release(mode: CommitType, current_branch: Optional[str] = None) -> N
|
50 | 50 | insert_licence_header(0)
|
51 | 51 | _update_repository(mode, is_new_version, version, current_branch)
|
52 | 52 | if is_new_version:
|
| 53 | + _clean_repository() |
53 | 54 | if spdx_project and get_language_specifics().should_include_spdx_in_package():
|
54 | 55 | _generate_spdx_reports(spdx_project)
|
55 | 56 | get_language_specifics().package_software(version)
|
@@ -98,6 +99,15 @@ def _update_repository(mode: CommitType, is_new_version: bool, version: str, cur
|
98 | 99 | git.clean()
|
99 | 100 |
|
100 | 101 |
|
| 102 | +def _clean_repository() -> None: |
| 103 | + """Cleans the local repository.""" |
| 104 | + with LocalProjectRepository() as git: |
| 105 | + logger.info("Cleaning repository") |
| 106 | + git.fetch() |
| 107 | + git.pull() |
| 108 | + git.clean() |
| 109 | + |
| 110 | + |
101 | 111 | def _generate_spdx_reports(project: SpdxProject) -> None:
|
102 | 112 | report_directory = Path(configuration.get_value(ConfigurationVariable.PROJECT_ROOT)).joinpath(
|
103 | 113 | SPDX_REPORTS_DIRECTORY
|
|
0 commit comments