Skip to content

Conversation

@mikonse
Copy link
Member

@mikonse mikonse commented Nov 23, 2025

depends on #1

@mikonse mikonse requested a review from TheJJ November 23, 2025 21:38
@mikonse mikonse force-pushed the milo/build-drivers-and-self-building branch from 6478f71 to f066493 Compare November 23, 2025 22:20
@mikonse mikonse marked this pull request as ready for review November 23, 2025 22:20
Copy link
Member

@TheJJ TheJJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naise

from pathlib import Path
from typing import Literal, Sequence

BuildDriverType = Literal["docker"] | Literal["lxd"] | Literal["none"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not enum?


# TODO: copy packages to output directory
config.output_dir.mkdir(parents=True, exist_ok=True)
driver.copy_file(source_dir=config.source_dir / "..", glob="debmagic_*.deb", dest_dir=config.output_dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why debmagic_ prefix? output should be the regular deb, no?

pass

def drop_into_shell(self):
run_cmd_in_foreground(["/usr/bin/env", "bash"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this makes sense (maybe use the user/root's shell in the build env instead of bash?), i think a shell manages the foreground run itself. i would still leave it, though.

print(
"Something failed during building - dropping into interactive shell in build environment for easier debugging"
)
driver.drop_into_shell()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a way to get into the build (and stop it at/after/... arbitrary stages) directly would be very handy

return instance

def run_command(self, args: Sequence[str | Path], cwd: Path | None = None, requires_root: bool = False):
del requires_root # we assume to always be root in the container
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe run stuff as id1000 unless requires_root is true, for consistency and checking of procedures in drivers that do need the difference?

def copy_file(self, source_dir: Path, glob: str, dest_dir: Path):
translated_source = self._translate_source_path(source_dir)
translated_output = self._translate_output_path(dest_dir)
self.run_command(["/usr/bin/env", "bash", "-c", f"cp -f {translated_source}/{glob} {translated_output}"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could have a shell=True for run_command, run_cmd supports this anyway.

@mikonse mikonse force-pushed the milo/build-drivers-and-self-building branch from f066493 to 08ead93 Compare November 24, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants