feat(models): add configuration and lock models for patch management

- Introduce models for managing upstream and patch configurations.
- Add lock models to track the last processed upstream commit.
- Enable structured data validation using Pydantic.
This commit is contained in:
2025-07-23 13:33:45 +02:00
parent 1ff3091ef1
commit c90fa6e39f
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
from typing import Optional
from pydantic import BaseModel, Field, HttpUrl
class UpstreamConfig(BaseModel):
url: HttpUrl = Field(..., description="Git URL of the upstream repository")
branch: str = Field(default="main", description="Upstream branch to track (default: 'main')")
class PatchesConfig(BaseModel):
directory: str = Field(default="./patches", description="Path to patch directory")
class PatchmanConfig(BaseModel):
upstream: UpstreamConfig
patches: PatchesConfig

View File

@@ -0,0 +1,11 @@
from pydantic import BaseModel, Field
from typing import Literal
class UpstreamLock(BaseModel):
last_commit: str = Field(..., min_length=40, max_length=40, pattern="^[0-9a-f]{40}$",
description="Commit hash of the last processed upstream repository")
class PatchmanLock(BaseModel):
upstream: UpstreamLock