-
-
Notifications
You must be signed in to change notification settings - Fork 1
build drivers and self building #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6478f71 to
f066493
Compare
TheJJ
left a comment
There was a problem hiding this 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"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not enum?
src/debmagic/_build_driver/build.py
Outdated
|
|
||
| # 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) |
There was a problem hiding this comment.
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"]) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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}"]) |
There was a problem hiding this comment.
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.
f066493 to
08ead93
Compare
depends on #1