Do the cleanup after the `create_srpm`
@@ -612,6 +612,7 @@ class PackitAPI:
:param srpm_dir: path to the directory where the srpm is meant to be placed
:return: a path to the srpm
"""
+ try:
self.up.run_action(actions=ActionName.post_upstream_clone)
try:
@@ -621,7 +622,9 @@ class PackitAPI:
f"Preparation of the repository for creation of an SRPM failed: {ex}"
) from ex
try:
- srpm_path = self.up.create_srpm(srpm_path=output_file, srpm_dir=srpm_dir)
+ srpm_path = self.up.create_srpm(
+ srpm_path=output_file, srpm_dir=srpm_dir
+ )
except PackitSRPMException:
raise
except Exception as ex:
@@ -634,6 +637,8 @@ class PackitAPI:
f"SRPM was created successfully, but can't be found at {srpm_path}"
)
return srpm_path
+ finally:
+ self.clean()
def create_rpms(self, upstream_ref: str = None, rpm_dir: str = None) -> List[Path]:
"""
