Python client API

The Debusine class

class debusine.client.debusine.Debusine(base_api_url: str, api_token: str | None = None, scope: str | None = None, *, logger: Logger)[source]

Bases: object

Class to interact with debusine server.

API_VERSION = '1.0'
__init__(base_api_url: str, api_token: str | None = None, scope: str | None = None, *, logger: Logger)[source]

Initialize client.

Parameters:
  • base_api_url – URL for API endpoint (e.g. http://localhost/api)

  • api_token – optional token to be used for the calls.

artifact_create(artifact: LocalArtifact[Any], *, workspace: str | None, work_request: int | None = None, expire_at: datetime.datetime | None = None) ArtifactResponse[source]

Create artifact in the debusine server.

artifact_get(artifact_id: int) ArtifactResponse[source]

Get artifact information.

Use download_artifact() to download the artifact.

download_artifact(artifact_id: int, destination: Path, *, tarball: bool = False) ArtifactResponse[source]

Download artifact_id into destination directory.

Parameters:
  • artifact_id – artifact id to download

  • destination – destination directory to download/uncompress

  • tarball – True to only download the tarball (artifact-id.tar.gz), False to uncompress it

download_artifact_file(artifact_id: int | debusine.client.models.ArtifactResponse, path_in_artifact: str, destination: Path) ArtifactResponse[source]

Download a single file from artifact into destination directory.

Parameters:
  • artifact_id – artifact id to download, or an ArtifactResponse representing the artifact

  • path_in_artifact – download the file from the artifact with this name

  • destination – destination file to download to

lookup_multiple(lookup: LookupMultiple, work_request: int, expect_type: ~typing.Literal[<LookupChildType.ARTIFACT: 'artifact'>], default_category: debusine.artifacts.models.CollectionCategory | None = None) LookupMultipleResponse[LookupSingleResponseArtifact][source]
lookup_multiple(lookup: LookupMultiple, work_request: int, expect_type: ~typing.Literal[<LookupChildType.COLLECTION: 'collection'>], default_category: debusine.artifacts.models.CollectionCategory | None = None) LookupMultipleResponse[LookupSingleResponseCollection]
lookup_multiple(lookup: LookupMultiple, work_request: int, expect_type: LookupChildType, default_category: debusine.artifacts.models.CollectionCategory | None = None) LookupMultipleResponse[LookupSingleResponse]

Look up multiple collection items.

lookup_single(lookup: LookupSingle, work_request: int, expect_type: ~typing.Literal[<LookupChildType.ARTIFACT: 'artifact'>], default_category: debusine.artifacts.models.CollectionCategory | None = None) LookupSingleResponseArtifact[source]
lookup_single(lookup: LookupSingle, work_request: int, expect_type: ~typing.Literal[<LookupChildType.COLLECTION: 'collection'>], default_category: debusine.artifacts.models.CollectionCategory | None = None) LookupSingleResponseCollection
lookup_single(lookup: LookupSingle, work_request: int, expect_type: LookupChildType, default_category: debusine.artifacts.models.CollectionCategory | None = None) LookupSingleResponse

Look up a single collection item.

on_work_request_completed(*, workspaces: list[str] | None = None, last_completed_at: pathlib.Path | None = None, command: str, working_directory: Path) None[source]

Execute command when a work request is completed.

async process_async_message(msg: WSMessage, msg_text_to_callable: dict[str, debusine.client.debusine._MessageProcessor]) bool[source]

Process “msg”: logs possible error, raise errors.

If msg.type is aiohttp.WSMsgType.TEXT: decode msg.data (contains JSON), call callable msg_text_to_callable[msg.data[“text”]](msg_content: dict).

Return True a callable from msg_to_callable is called or False if not (invalid messages, etc.).

Raises:

TokenDisabledError – if reason_code is TOKEN_DISABLED.

relation_create(artifact_id: int, target_id: int, relation_type: RelationType) RelationResponse[source]

Create a new relation between artifacts.

Parameters:
  • artifact_id – relation from

  • target_id – relation to

  • relation_type – type of relation such as extends, relates-to, built-using

Returns:

True if the relation already existed/has been created, False if it could not be created

relation_list(*, artifact_id: int | None = None, target_id: int | None = None) RelationsResponse[source]

List relations associated with an artifact.

Exactly one of artifact_id or target_id must be set.

Parameters:
  • artifact_id – search for relations from this artifact

  • target_id – search for relations to this artifact

Returns:

a list of relations

Raises:

ValueError – if exactly one of artifact_id or target_id is not set

upload_artifact(local_artifact: LocalArtifact[Any], *, workspace: str | None, work_request: int | None = None, expire_at: datetime.datetime | None = None) RemoteArtifact[source]

Upload (create and upload files) the local_artifact to the server.

upload_files(artifact_id: int, upload_files: dict[str, pathlib.Path], base_directory: pathlib.Path | None = None) None[source]

Upload into artifact the files.

Parameters:
  • artifact_id – artifact_id to upload files to.

  • upload_files – list of files to upload.

  • base_directory – base directory for relative path’s files to upload.

static work_request_completed_path(work_request_id: int) str[source]

Return path to update the completed result for work_request_id.

work_request_completed_update(work_request_id: int, result: str) None[source]

Update work_request_id as completed with result.

work_request_create(work_request: WorkRequestRequest) WorkRequestResponse[source]

Create a work request (via POST /work-request/).

Returns:

WorkRequest returned by the server.

Raises:

see _api_request method documentation.

work_request_external_debsign_complete(work_request_id: int, external_debsign_request: WorkRequestExternalDebsignRequest) WorkRequestResponse[source]

Provide external debsign data to a work request.

work_request_external_debsign_get(work_request_id: int) WorkRequestResponse[source]

Get data about work request waiting for an external debsign.

work_request_get(work_request_id: int) WorkRequestResponse[source]

Get WorkRequest for work_request_id.

Parameters:

work_request_id – id to fetch the status of.

Raises:

many – see _api_request method documentation.

work_request_iter() Iterable[WorkRequestResponse][source]

List all WorkRequests.

Raises:

many – see _api_request method documentation.

work_request_retry(work_request_id: int) WorkRequestResponse[source]

Retry a work request.

work_request_update(work_request_id: int, *, priority_adjustment: int) WorkRequestResponse[source]

Update properties of work_request_id.

workflow_create(create_workflow: CreateWorkflowRequest) WorkRequestResponse[source]

Create a workflow (via POST /workflow/).

Returns:

Workflow WorkRequest returned by the server.

Raises:

see _api_request method documentation.

workflow_template_create(workflow_template: WorkflowTemplateRequest) WorkflowTemplateResponse[source]

Create a workflow template (via POST /workflow-template/).

Returns:

WorkflowTemplate returned by the server.

Raises:

see _api_request method documentation.

static write_last_completed_at(completed_at_file: pathlib.Path | None, completed_at: datetime.datetime | None) None[source]

Write to completed_at_file the completed_at datetime.

Associated data models

The parameters of the HTTP requests and the responses of the server are represented by Pydantic models that are described below.

Models used by debusine client.

class debusine.client.models.ArtifactCreateRequest(*, category: str, workspace: str | None = None, files: FilesRequestType = {}, data: dict[str, Any] = {}, work_request: int | None = None, expire_at: datetime.datetime | None = None)[source]

Bases: StrictBaseModel

Declare an ArtifactCreateRequest: client sends it to the server.

category: str
data: dict[str, Any]
expire_at: datetime.datetime | None
files: FilesRequestType
work_request: int | None
workspace: str | None
class debusine.client.models.ArtifactResponse(*, id: int, workspace: str, category: str, created_at: datetime, data: dict[str, Any], download_tar_gz_url: AnyUrl, files_to_upload: list[str], expire_at: datetime.datetime | None = None, files: FilesResponseType = {})[source]

Bases: StrictBaseModel

Declare an ArtifactResponse: server sends it to the client.

category: str
created_at: datetime
data: dict[str, Any]
download_tar_gz_url: AnyUrl
expire_at: datetime.datetime | None
files: FilesResponseType
files_to_upload: list[str]
id: int
workspace: str
class debusine.client.models.CreateWorkflowRequest(*, template_name: str, workspace: str | None = None, task_data: dict[str, Any])[source]

Bases: StrictBaseModel

Client sends a workflow creation request to the server.

task_data: dict[str, Any]
template_name: str
workspace: str | None
class debusine.client.models.FileRequest(*, size: ConstrainedIntValue, checksums: dict[str, debusine.client.models.StrMaxLength255], type: Literal['file'])[source]

Bases: StrictBaseModel

Declare a FileRequest: client sends it to the server.

checksums: dict[str, debusine.client.models.StrMaxLength255]
static create_from(path: Path) FileRequest[source]

Return a FileRequest for the file path.

size: int
type: Literal['file']
class debusine.client.models.FileResponse(*, size: ConstrainedIntValue, checksums: dict[str, debusine.client.models.StrMaxLength255], type: Literal['file'], url: AnyUrl)[source]

Bases: StrictBaseModel

Declare a FileResponse: server sends it to the client.

checksums: dict[str, debusine.client.models.StrMaxLength255]
size: int
type: Literal['file']
url: AnyUrl
class debusine.client.models.LookupChildType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Possible values for LookupDict.child_type and expect_type.

ANY = 'any'
ARTIFACT = 'artifact'
ARTIFACT_OR_PROMISE = 'artifact-or-promise'
BARE = 'bare'
COLLECTION = 'collection'
class debusine.client.models.LookupMultipleRequest(*, lookup: list[int | str | dict[str, Any]], work_request: int, expect_type: LookupChildType, default_category: str | None = None)[source]

Bases: StrictBaseModel

A request from the client to look up multiple collection items.

default_category: str | None
expect_type: LookupChildType
lookup: list[int | str | dict[str, Any]]
work_request: int
class debusine.client.models.LookupMultipleResponse(*, __root__: Sequence[LSR])[source]

Bases: StrictBaseModel, Generic[LSR]

A response from the server with multiple lookup results.

class debusine.client.models.LookupResultType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

A collection item type returned by a lookup.

ARTIFACT = 'a'
BARE = 'b'
COLLECTION = 'c'
class debusine.client.models.LookupSingleRequest(*, lookup: int | str, work_request: int, expect_type: LookupChildType, default_category: str | None = None)[source]

Bases: StrictBaseModel

A request from the client to look up a single collection item.

default_category: str | None
expect_type: LookupChildType
lookup: int | str
work_request: int
class debusine.client.models.LookupSingleResponse(*, result_type: LookupResultType, collection_item: int | None = None, artifact: int | None = None, collection: int | None = None)[source]

Bases: StrictBaseModel

A response from the server with a single lookup result.

artifact: int | None
collection: int | None
collection_item: int | None
result_type: LookupResultType
class debusine.client.models.LookupSingleResponseArtifact(*, result_type: ~typing.Literal[<LookupResultType.ARTIFACT: 'a'>], collection_item: int | None = None, artifact: int, collection: int | None = None)[source]

Bases: LookupSingleResponse

A response from the server with a single lookup result for an artifact.

Used to assist type annotations.

artifact: int
result_type: ARTIFACT: 'a'>]
class debusine.client.models.LookupSingleResponseCollection(*, result_type: ~typing.Literal[<LookupResultType.COLLECTION: 'c'>], collection_item: int | None = None, artifact: int | None = None, collection: int)[source]

Bases: LookupSingleResponse

A response from the server with a single lookup result for a collection.

Used to assist type annotations.

collection: int
result_type: COLLECTION: 'c'>]
class debusine.client.models.OnWorkRequestCompleted(*, work_request_id: int, completed_at: datetime, result: str)[source]

Bases: StrictBaseModel

Server return an OnWorkRequestCompleted to the client.

Returned via websocket consumer endpoint.

completed_at: datetime
result: str
work_request_id: int
class debusine.client.models.PaginatedResponse(*, count: int | None = None, next: pydantic.networks.AnyUrl | None = None, previous: pydantic.networks.AnyUrl | None = None, results: list[dict[str, Any]])[source]

Bases: StrictBaseModel

Paginated response from the API.

count: int | None
next: pydantic.networks.AnyUrl | None
previous: pydantic.networks.AnyUrl | None
results: list[dict[str, Any]]
class debusine.client.models.RelationCreateRequest(*, artifact: int, target: int, type: RelationType)[source]

Bases: StrictBaseModel

Declare a RelationCreateRequest: client sends it to the server.

artifact: int
target: int
type: RelationType
class debusine.client.models.RelationResponse(*, artifact: int, target: int, type: RelationType, id: int)[source]

Bases: RelationCreateRequest

Declare a RelationResponse.

id: int
class debusine.client.models.RelationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Possible values for RelationCreateRequest.type.

BUILT_USING = 'built-using'
EXTENDS = 'extends'
RELATES_TO = 'relates-to'
class debusine.client.models.RelationsResponse(*, __root__: Sequence[RelationResponse])[source]

Bases: StrictBaseModel

A response from the server with multiple RelationResponse objects.

class debusine.client.models.RemoteArtifact(*, id: int, workspace: str)[source]

Bases: StrictBaseModel

Declare RemoteArtifact.

id: int
workspace: str
class debusine.client.models.StrMaxLength255[source]

Bases: ConstrainedStr

A string with a maximum length of 255 characters.

max_length: OptionalInt = 255
class debusine.client.models.StrictBaseModel[source]

Bases: BaseModel

Stricter pydantic configuration.

class Config[source]

Bases: object

Set up stricter pydantic Config.

validate_assignment = True
class debusine.client.models.WorkRequestExternalDebsignRequest(*, signed_artifact: int)[source]

Bases: StrictBaseModel

Client sends data from an external debsign run to the server.

signed_artifact: int
class debusine.client.models.WorkRequestRequest(*, task_name: str, workspace: str | None = None, task_data: dict[str, Any], event_reactions: dict[str, Any])[source]

Bases: StrictBaseModel

Client send a WorkRequest to the server.

event_reactions: dict[str, Any]
task_data: dict[str, Any]
task_name: str
workspace: str | None
class debusine.client.models.WorkRequestResponse(*, id: int, created_at: datetime, started_at: datetime.datetime | None = None, completed_at: datetime.datetime | None = None, duration: int | None = None, status: str, result: str, worker: int | None = None, task_type: str, task_name: str, task_data: dict[str, Any], dynamic_task_data: dict[str, Any] | None = None, priority_base: int, priority_adjustment: int, artifacts: list[int], workspace: str)[source]

Bases: StrictBaseModel

Server return a WorkRequest to the client.

artifacts: list[int]
completed_at: datetime.datetime | None
created_at: datetime
duration: int | None
dynamic_task_data: dict[str, Any] | None
id: int
priority_adjustment: int
priority_base: int
result: str
started_at: datetime.datetime | None
status: str
task_data: dict[str, Any]
task_name: str
task_type: str
worker: int | None
workspace: str
class debusine.client.models.WorkflowTemplateRequest(*, name: str, task_name: str, workspace: str | None = None, task_data: dict[str, Any], priority: int)[source]

Bases: StrictBaseModel

Client sends a WorkflowTemplate to the server.

name: str
priority: int
task_data: dict[str, Any]
task_name: str
workspace: str | None
class debusine.client.models.WorkflowTemplateResponse(*, id: int, task_name: str, workspace: str, task_data: dict[str, Any], priority: int)[source]

Bases: StrictBaseModel

Server returns a WorkflowTemplate to the server.

id: int
priority: int
task_data: dict[str, Any]
task_name: str
workspace: str
debusine.client.models.model_to_json_serializable_dict(model: BaseModel, exclude_unset: bool = False) dict[Any, Any][source]

Similar to model.dict() but the returned dictionary is JSON serializable.

For example, a datetime() is not JSON serializable. Using this method will return a dictionary with a string instead of a datetime object.

Replace with model_dump() in Pydantic 2.

Representation of artifacts

Artifacts to be uploaded are first created as a debusine.artifacts.local_artifact.LocalArtifact object. There are many descendants of that class available in debusine.artifacts, one for each category of artifact.

class debusine.artifacts.local_artifact.LocalArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: BaseModel, Generic[AD], ABC

Represent an artifact locally.

class Config[source]

Bases: object

Set up stricter pydantic Config.

extra = 'forbid'
validate_assignment = True
__init__(**kwargs: Any) None[source]

Set category to _category by default.

add_local_file(file: Path, *, artifact_base_dir: pathlib.Path | None = None, override_name: str | None = None) None[source]

Add a local file in the artifact.

Parameters:
  • file – file in the local file system that is added to the artifact

  • artifact_base_dir – base directory of the artifact. Must be an absolute path. If it’s None: file is added in the root of the artifact. If it’s not None: file is added with the relative path of the file with the artifact_base_dir. E.g. file=/tmp/artifact/dir1/file1 artifact_base_dir=/tmp/artifact Path of this file in the artifact: dir1/file1

  • override_name – if not None: use it instead of file.name

Raises:

ValueError – artifact_base_dir is not absolute or is not a directory; file does not exist; the path in the artifact already had a file.

add_remote_file(path_in_artifact: str, file_request: FileRequest) None[source]

Add a remote file to the artifact.

This may be used when a file does not exist locally, but can be expected to already exist on the server when uploading the rest of the artifact.

Parameters:
  • path_in_artifact – path of the file in the artifact

  • file_request – description of the remote file

static artifact_categories() list[str][source]

Return list of artifact categories.

category: ArtifactCategory

Artifact type

static class_from_category(category: str) type[debusine.artifacts.local_artifact.LocalArtifact[Any]][source]

Return class sub_local_artifact.

classmethod create_data(data_dict: dict[str, Any]) AD[source]

Instantiate a data model from a dict.

data: AD

Artifact data

files: dict[str, pathlib.Path]
remote_files: dict[str, debusine.client.models.FileRequest]
serialize_for_create_artifact(*, workspace: str | None, work_request: int | None = None, expire_at: datetime.datetime | None = None) dict[str, Any][source]

Return dictionary to be used by the API to create an artifact.

validate_model() None[source]

Raise ValueError with an error if the model is not valid.

Debusine client.

class debusine.artifacts.AutopkgtestArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianAutopkgtest]

Autopkgtest: encapsulate result of the Autopkgtest run.

classmethod create(artifact_directory: Path, data: DebianAutopkgtest) Self[source]

Return AutopkgtestArtifact with the files and data set.

class debusine.artifacts.BinaryPackage(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianBinaryPackage]

BinaryPackage: encapsulates a single *.deb / *.udeb.

classmethod create(*, file: Path) Self[source]

Return a BinaryPackage setting file and data.

classmethod files_exactly_one(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Raise ValueError if len(files) != 1.

classmethod files_must_end_in_deb_or_udeb(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Raise ValueError if a file does not end in .deb or .udeb.

class debusine.artifacts.BinaryPackages(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianBinaryPackages]

BinaryPackages: encapsulates a group of *.deb / *.udeb.

classmethod create(*, srcpkg_name: str, srcpkg_version: str, version: str, architecture: str, files: list[pathlib.Path]) Self[source]

Return a BinaryPackages setting files and data.

classmethod files_more_than_zero(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Raise ValueError if len(files) == 0.

classmethod files_must_end_in_deb_or_udeb(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Raise ValueError if a file does not end in .deb or .udeb.

class debusine.artifacts.BlhcArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: EmptyArtifactData = None)[source]

Bases: LocalArtifact[EmptyArtifactData]

BlhcArtifact: encapsulate result of the blhc run.

classmethod create(blhc_output: Path) Self[source]

Return a BlhcArtifact with the files set.

data: EmptyArtifactData

Artifact data

class debusine.artifacts.DebDiffArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebDiff]

DebDiffArtifact: encapsulate result of the debdiff run.

classmethod create(debdiff_output: Path, original: str, new: str) Self[source]

Return a DebDiffArtifact with the files set.

class debusine.artifacts.DebianSystemTarballArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianSystemTarball]

Contain system.tar.xz file with a Debian.

Can be used by a chroot, container, etc.

classmethod create(tarball: Path, data: dict[str, Any]) Self[source]

Return a DebianSystemTarballArtifact with the tarball file.

class debusine.artifacts.LintianArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianLintian]

LintianArtifact: encapsulate result of the Lintian run.

classmethod create(analysis: Path, lintian_output: Path, summary: DebianLintianSummary) Self[source]

Return a LintianArtifact with the files set.

class debusine.artifacts.LocalArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: BaseModel, Generic[AD], ABC

Represent an artifact locally.

class Config[source]

Bases: object

Set up stricter pydantic Config.

extra = 'forbid'
validate_assignment = True
__init__(**kwargs: Any) None[source]

Set category to _category by default.

add_local_file(file: Path, *, artifact_base_dir: pathlib.Path | None = None, override_name: str | None = None) None[source]

Add a local file in the artifact.

Parameters:
  • file – file in the local file system that is added to the artifact

  • artifact_base_dir – base directory of the artifact. Must be an absolute path. If it’s None: file is added in the root of the artifact. If it’s not None: file is added with the relative path of the file with the artifact_base_dir. E.g. file=/tmp/artifact/dir1/file1 artifact_base_dir=/tmp/artifact Path of this file in the artifact: dir1/file1

  • override_name – if not None: use it instead of file.name

Raises:

ValueError – artifact_base_dir is not absolute or is not a directory; file does not exist; the path in the artifact already had a file.

add_remote_file(path_in_artifact: str, file_request: FileRequest) None[source]

Add a remote file to the artifact.

This may be used when a file does not exist locally, but can be expected to already exist on the server when uploading the rest of the artifact.

Parameters:
  • path_in_artifact – path of the file in the artifact

  • file_request – description of the remote file

static artifact_categories() list[str][source]

Return list of artifact categories.

category: ArtifactCategory

Artifact type

static class_from_category(category: str) type[debusine.artifacts.local_artifact.LocalArtifact[Any]][source]

Return class sub_local_artifact.

classmethod create_data(data_dict: dict[str, Any]) AD[source]

Instantiate a data model from a dict.

data: AD

Artifact data

files: dict[str, pathlib.Path]
remote_files: dict[str, debusine.client.models.FileRequest]
serialize_for_create_artifact(*, workspace: str | None, work_request: int | None = None, expire_at: datetime.datetime | None = None) dict[str, Any][source]

Return dictionary to be used by the API to create an artifact.

validate_model() None[source]

Raise ValueError with an error if the model is not valid.

class debusine.artifacts.PackageBuildLog(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianPackageBuildLog]

PackageBuildLog: represents a build log file.

classmethod create(*, file: Path, source: str, version: str, bd_uninstallable: debusine.artifacts.models.DoseDistCheck | None = None) Self[source]

Return a PackageBuildLog.

classmethod file_must_end_in_build(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Raise ValueError if the file does not end in .build.

classmethod validate_files_length_is_one(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Validate that artifact has only one file.

class debusine.artifacts.SigningInputArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebusineSigningInput]

Input to a Sign task.

classmethod create(files: Iterable[Path], base_dir: Path, trusted_certs: list[str] | None = None, binary_package_name: str | None = None) Self[source]

Return a new SigningInputArtifact.

classmethod validate_at_least_one_file(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Validate that artifact has at least one file.

class debusine.artifacts.SigningKeyArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebusineSigningKey]

Record the existence of a key in the signing service.

classmethod create(purpose: KeyPurpose, fingerprint: str, public_key: bytes) Self[source]

Return a SigningKeyArtifact with the given properties.

property public_key_bytes: bytes

Return the public key as bytes.

class debusine.artifacts.SigningOutputArtifact(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebusineSigningOutput]

Output of a Sign task.

classmethod create(purpose: KeyPurpose, fingerprint: str, results: Iterable[SigningResult], files: Iterable[Path], base_dir: Path) Self[source]

Return a new SigningOutputArtifact.

class debusine.artifacts.SourcePackage(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianSourcePackage]

SourcePackage: contains source code to be built into BinaryPackages.

classmethod create(*, name: str, version: str, files: list[pathlib.Path]) Self[source]

Return a SourcePackage setting files and data.

classmethod files_contain_one_dsc(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Raise ValueError when files does not have exactly 1 .dsc file.

classmethod files_contains_files_in_dsc(files: dict[str, pathlib.Path]) dict[str, pathlib.Path][source]

Validate that set(files) == set(files_in_dsc_file).

Exception: The .dsc file must be in files but not in the .dsc file.

class debusine.artifacts.Upload(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: AD)[source]

Bases: LocalArtifact[DebianUpload]

Upload: encapsulate a .changes and files listed in it.

classmethod create(*, changes_file: Path, exclude_files: frozenset[pathlib.Path] | set[pathlib.Path] = frozenset({}), allow_remote: bool = False) Self[source]

Return a Upload. Add the changes_files and files listed in it.

Parameters:
  • changes_file – a .changes file. Parsed by deb822.Changes.

  • exclude_files – do not add them in files even if listed in the Files section in the changes_file.

  • allow_remote – if True, allow files referenced by the .changes file to be missing locally; uploading this artifact will require them to already exist on the server.

classmethod files_contain_changes(values: dict[str, Any]) dict[str, Any][source]

Raise ValueError when files does not have exactly 1 .changes file.

classmethod files_contains_files_in_changes(values: dict[str, Any]) dict[str, Any][source]

Validate that set(files) == set(files_in_changes_file).

Exception: The .changes file must be in files but not in the .changes file.

class debusine.artifacts.WorkRequestDebugLogs(*, category: ArtifactCategory, files: dict[str, pathlib.Path] = None, remote_files: dict[str, debusine.client.models.FileRequest] = None, data: EmptyArtifactData = None)[source]

Bases: LocalArtifact[EmptyArtifactData]

WorkRequestDebugLogs: help debugging issues executing the task.

Log files for debusine users in order to debug possible problems in their WorkRequests.

classmethod create(*, files: Iterable[Path]) Self[source]

Return a WorkRequestDebugLogs.

data: EmptyArtifactData

Artifact data