Verified Commit f549d51a authored by David Runge's avatar David Runge
Browse files

Add models for describing output facing package data

repo_management/models.py:
Add model `PackageFiles` to track the list of files for a given package.
Add model `RepoDbMemberType` to track the type of a repository database
member (distinguished by the IntEnum defaults.RepoDbMemberType).
Add model `RepoDbMemberData` to track the data (represented by an
io.StringIO instance) of a repository database member.
Add model `OutputPackage` to track the attributes required for a single
package in the context of a representation within its pkgbase.
Add model `OutputPackageBase` to track the attributes required for a
pkgbase and its list of packages.
parent 98c227d1
import io
from typing import List, Optional
from pydantic import BaseModel
from repo_management import defaults
class Base(BaseModel):
"""A model describing the %BASE% header in a 'desc' file, which type it represents and whether it is required or
......@@ -178,6 +181,10 @@ class Files(BaseModel):
files: Optional[List[str]]
class PackageFiles(Name, Files):
pass
class PackageDesc(
Arch,
Backup,
......@@ -208,3 +215,61 @@ class PackageDesc(
not"""
pass
class RepoDbMemberType(BaseModel):
"""A model describing an attribute used to identify/ distinguish different types of repo database file types (e.g.
'desc' and 'files' files, which are contained in a repository database file).
The file types are distinguished with the help of the IntEnum defaults.REpoDbFileType
"""
member_type: defaults.RepoDbMemberType
class RepoDbMemberData(Name, RepoDbMemberType):
data: io.StringIO
class Config:
arbitrary_types_allowed = True
class OutputPackage(
Arch,
Backup,
BuildDate,
Conflicts,
CSize,
Depends,
Desc,
CheckDepends,
FileName,
Files,
Groups,
ISize,
License,
Md5Sum,
Name,
OptDepends,
PgpSig,
Provides,
Replaces,
Sha256Sum,
Url,
):
"""A model describing all required attributes for a package in the context of an output file, that describes a
(potential) list of packages based upon its pkgbase
"""
pass
class OutputPackageBase(
MakeDepends,
Packager,
Version,
):
"""A model describing all required attributes for an output file, that describes a list of packages based upon a
pkgbase
"""
packages: List[OutputPackage]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment