Skip to content

Commit

Permalink
Added a log of commands that can be used to recreate the sources. refs:
Browse files Browse the repository at this point in the history
  • Loading branch information
spanezz committed May 19, 2023
1 parent 29e8234 commit 700d32f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions moncic/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Build:
success: bool = False
# List of container paths for artifacts
artifacts: list[str] = field(default_factory=list)
# Commands that can be used to recreate this build
trace_log: list[str] = field(default_factory=list)

artifacts_dir: Optional[str] = field(
default=None,
Expand Down
11 changes: 10 additions & 1 deletion moncic/source/source.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import logging
from dataclasses import dataclass
import shlex
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Optional, Type

from ..utils.guest import guest_only, host_only
Expand Down Expand Up @@ -62,6 +63,8 @@ class Source:
host_path: str
# Path to the unpacked sources in the guest system
guest_path: Optional[str] = None
# Commands that can be used to recreate this source
trace_log: list[str] = field(default_factory=list)

@classmethod
def get_name(cls) -> str:
Expand All @@ -72,6 +75,12 @@ def get_name(cls) -> str:
return name
return cls.__name__.lower()

def add_trace_log(self, *args: str) -> None:
"""
Add a command to the trace log
"""
self.trace_log.append(" ".join(shlex.quote(c) for c in args))

def get_build_class(self) -> Type["Build"]:
"""
Return the Build subclass used to build this source
Expand Down

0 comments on commit 700d32f

Please sign in to comment.