This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new aecb141 Rename the checks archive module to targz
aecb141 is described below
commit aecb141335471224a9d5168a5393efe3f96e89b9
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Apr 7 15:37:44 2025 +0100
Rename the checks archive module to targz
---
atr/db/models.py | 4 ++--
atr/tasks/__init__.py | 30 +++++++++++++++---------------
atr/tasks/checks/license.py | 6 +++---
atr/tasks/checks/rat.py | 4 ++--
atr/tasks/checks/{archive.py => targz.py} | 11 ++---------
atr/tasks/sbom.py | 4 ++--
6 files changed, 26 insertions(+), 33 deletions(-)
diff --git a/atr/db/models.py b/atr/db/models.py
index 6bfe988..fb6f79b 100644
--- a/atr/db/models.py
+++ b/atr/db/models.py
@@ -286,8 +286,6 @@ class TaskStatus(str, enum.Enum):
class TaskType(str, enum.Enum):
- ARCHIVE_INTEGRITY = "archive_integrity"
- ARCHIVE_STRUCTURE = "archive_structure"
HASHING_CHECK = "hashing_check"
LICENSE_FILES = "license_files"
LICENSE_HEADERS = "license_headers"
@@ -296,6 +294,8 @@ class TaskType(str, enum.Enum):
RSYNC_ANALYSE = "rsync_analyse"
SBOM_GENERATE_CYCLONEDX = "sbom_generate_cyclonedx"
SIGNATURE_CHECK = "signature_check"
+ TARGZ_INTEGRITY = "targz_integrity"
+ TARGZ_STRUCTURE = "targz_structure"
VOTE_INITIATE = "vote_initiate"
ZIPFORMAT_INTEGRITY = "zipformat_integrity"
ZIPFORMAT_LICENSE_FILES = "zipformat_license_files"
diff --git a/atr/tasks/__init__.py b/atr/tasks/__init__.py
index b42294d..b5a6fd0 100644
--- a/atr/tasks/__init__.py
+++ b/atr/tasks/__init__.py
@@ -24,12 +24,12 @@ import aiofiles.os
import atr.db as db
import atr.db.models as models
import atr.tasks.checks as checks
-import atr.tasks.checks.archive as archive
import atr.tasks.checks.hashing as hashing
import atr.tasks.checks.license as license
import atr.tasks.checks.paths as paths
import atr.tasks.checks.rat as rat
import atr.tasks.checks.signature as signature
+import atr.tasks.checks.targz as targz
import atr.tasks.checks.zipformat as zipformat
import atr.tasks.rsync as rsync
import atr.tasks.sbom as sbom
@@ -101,10 +101,6 @@ async def draft_checks(project_name: str, release_version:
str, caller_data: db.
def resolve(task_type: models.TaskType) -> Callable[..., Awaitable[str |
None]]: # noqa: C901
match task_type:
- case models.TaskType.ARCHIVE_INTEGRITY:
- return archive.integrity
- case models.TaskType.ARCHIVE_STRUCTURE:
- return archive.structure
case models.TaskType.HASHING_CHECK:
return hashing.check
case models.TaskType.LICENSE_FILES:
@@ -121,6 +117,10 @@ def resolve(task_type: models.TaskType) -> Callable[...,
Awaitable[str | None]]:
return sbom.generate_cyclonedx
case models.TaskType.SIGNATURE_CHECK:
return signature.check
+ case models.TaskType.TARGZ_INTEGRITY:
+ return targz.integrity
+ case models.TaskType.TARGZ_STRUCTURE:
+ return targz.structure
case models.TaskType.VOTE_INITIATE:
return vote.initiate
case models.TaskType.ZIPFORMAT_INTEGRITY:
@@ -179,40 +179,40 @@ async def tar_gz_checks(release: models.Release, path:
str) -> list[models.Task]
tasks = [
models.Task(
status=models.TaskStatus.QUEUED,
- task_type=models.TaskType.ARCHIVE_INTEGRITY,
- task_args=archive.Integrity(release_name=release.name,
abs_path=full_path).model_dump(),
+ task_type=models.TaskType.LICENSE_FILES,
+ task_args=license.Files(release_name=release.name,
abs_path=full_path).model_dump(),
release_name=release.name,
path=path,
modified=modified,
),
models.Task(
status=models.TaskStatus.QUEUED,
- task_type=models.TaskType.ARCHIVE_STRUCTURE,
- task_args=archive.Structure(release_name=release.name,
abs_path=full_path).model_dump(),
+ task_type=models.TaskType.LICENSE_HEADERS,
+ task_args=license.Headers(release_name=release.name,
abs_path=full_path).model_dump(),
release_name=release.name,
path=path,
modified=modified,
),
models.Task(
status=models.TaskStatus.QUEUED,
- task_type=models.TaskType.LICENSE_FILES,
- task_args=license.Files(release_name=release.name,
abs_path=full_path).model_dump(),
+ task_type=models.TaskType.RAT_CHECK,
+ task_args=rat.Check(release_name=release.name,
abs_path=full_path).model_dump(),
release_name=release.name,
path=path,
modified=modified,
),
models.Task(
status=models.TaskStatus.QUEUED,
- task_type=models.TaskType.LICENSE_HEADERS,
- task_args=license.Headers(release_name=release.name,
abs_path=full_path).model_dump(),
+ task_type=models.TaskType.TARGZ_INTEGRITY,
+ task_args=targz.Integrity(release_name=release.name,
abs_path=full_path).model_dump(),
release_name=release.name,
path=path,
modified=modified,
),
models.Task(
status=models.TaskStatus.QUEUED,
- task_type=models.TaskType.RAT_CHECK,
- task_args=rat.Check(release_name=release.name,
abs_path=full_path).model_dump(),
+ task_type=models.TaskType.TARGZ_STRUCTURE,
+ task_args=checks.ReleaseAndAbsPath(release_name=release.name,
abs_path=full_path).model_dump(),
release_name=release.name,
path=path,
modified=modified,
diff --git a/atr/tasks/checks/license.py b/atr/tasks/checks/license.py
index ec96628..6871eaf 100644
--- a/atr/tasks/checks/license.py
+++ b/atr/tasks/checks/license.py
@@ -26,7 +26,7 @@ from typing import Any, Final
import pydantic
import atr.tasks.checks as checks
-import atr.tasks.checks.archive as archive
+import atr.tasks.checks.targz as targz
_LOGGER = logging.getLogger(__name__)
@@ -298,7 +298,7 @@ def _files_check_core_logic(artifact_path: str) ->
dict[str, Any]:
# First find and validate the root directory
try:
- root_dir = archive.root_directory(artifact_path)
+ root_dir = targz.root_directory(artifact_path)
except ValueError as e:
return {
"files_checked": ["LICENSE", "NOTICE"],
@@ -404,7 +404,7 @@ def _headers_check_core_logic(artifact_path: str) ->
dict[str, Any]:
# First find and validate the root directory
try:
- root_dir = archive.root_directory(artifact_path)
+ root_dir = targz.root_directory(artifact_path)
except ValueError as e:
return {
"files_checked": 0,
diff --git a/atr/tasks/checks/rat.py b/atr/tasks/checks/rat.py
index 92284f6..d272a3d 100644
--- a/atr/tasks/checks/rat.py
+++ b/atr/tasks/checks/rat.py
@@ -27,7 +27,7 @@ import pydantic
import atr.config as config
import atr.tasks.checks as checks
-import atr.tasks.checks.archive as archive
+import atr.tasks.checks.targz as targz
import atr.tasks.sbom as sbom
_CONFIG: Final = config.get()
@@ -157,7 +157,7 @@ def _check_core_logic(
# Find and validate the root directory
try:
- root_dir = archive.root_directory(artifact_path)
+ root_dir = targz.root_directory(artifact_path)
except ValueError as e:
error_msg = str(e)
_LOGGER.error(f"Archive root directory issue: {error_msg}")
diff --git a/atr/tasks/checks/archive.py b/atr/tasks/checks/targz.py
similarity index 92%
rename from atr/tasks/checks/archive.py
rename to atr/tasks/checks/targz.py
index f25665a..2c152ca 100644
--- a/atr/tasks/checks/archive.py
+++ b/atr/tasks/checks/targz.py
@@ -50,15 +50,8 @@ async def integrity(args: Integrity) -> str | None:
return None
-class Structure(pydantic.BaseModel):
- """Parameters for archive structure checking."""
-
- release_name: str = pydantic.Field(..., description="Release name")
- abs_path: str = pydantic.Field(..., description="Absolute path to the
.tar.gz file to check")
-
-
[email protected]_model(Structure)
-async def structure(args: Structure) -> str | None:
[email protected]_model(checks.ReleaseAndAbsPath)
+async def structure(args: checks.ReleaseAndAbsPath) -> str | None:
"""Check the structure of a .tar.gz file."""
rel_path = checks.rel_path(args.abs_path)
check = await checks.Check.create(checker=structure,
release_name=args.release_name, path=rel_path)
diff --git a/atr/tasks/sbom.py b/atr/tasks/sbom.py
index 14d63d5..3bdb5b0 100644
--- a/atr/tasks/sbom.py
+++ b/atr/tasks/sbom.py
@@ -27,7 +27,7 @@ import pydantic
import atr.config as config
import atr.tasks.checks as checks
-import atr.tasks.checks.archive as archive
+import atr.tasks.checks.targz as targz
import atr.util as util
_CONFIG: Final = config.get()
@@ -164,7 +164,7 @@ async def _generate_cyclonedx_core(artifact_path: str,
output_path: str) -> dict
# Find and validate the root directory
try:
- root_dir = await asyncio.to_thread(archive.root_directory,
artifact_path)
+ root_dir = await asyncio.to_thread(targz.root_directory,
artifact_path)
except ValueError as e:
raise SBOMGenerationError(f"Archive root directory issue: {e}",
{"artifact_path": artifact_path}) from e
except Exception as e:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]