Skip to content
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

bldr.py, cli.py: implement build profiles #51

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bldr/bldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self,
source_dir: Path,
docker_from: str,
deb_build_options: Optional[str] = None,
build_profiles: Optional[List[str]] = None,
debug_shell: bool = False,
snapshot: bool = False,
nocache: bool = False,
Expand All @@ -43,6 +44,7 @@ def __init__(self,

self._debug_shell = debug_shell
self._deb_build_options = deb_build_options
self._build_profiles = [] if build_profiles is None else build_profiles
self._snapshot = snapshot
self._nocache = nocache

Expand Down Expand Up @@ -148,6 +150,8 @@ def _create_container(self, image: DockerImage, command: Union[str, list, None]
env_vars['no_proxy'] = os.environ.get('no_proxy')
if self._deb_build_options is not None:
env_vars['DEB_BUILD_OPTIONS'] = self._deb_build_options
if self._build_profiles:
env_vars['DEB_BUILD_PROFILES'] = ' '.join(self._build_profiles)
env_vars['BLDR_SNAPSHOT'] = '1' if self._snapshot else ''
env_vars['TERM'] = os.environ.get('TERM', 'xterm-256color')
env_vars['USER'] = self._nonpriv_user_name
Expand Down
6 changes: 6 additions & 0 deletions bldr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def _add_common_arguments(cls, parser: argparse.ArgumentParser) -> None:
"(default: %(default)s)",
action='store', default=os.environ.get('DEB_BUILD_OPTIONS', None)
)
parser.add_argument(
'--build-profiles',
help="Profiles for the build as a comma-separated list (default: no specific profile).",
action='store'
)
parser.add_argument(
'--local-repo-dir',
help="The directory for the local apt repository. The value will be: "
Expand Down Expand Up @@ -241,6 +246,7 @@ def _init_bldr(self) -> BLDR:
source_dir=Path().cwd().parent,
docker_from=self.args.docker_from,
deb_build_options=self.args.deb_build_options,
build_profiles=[] if self.args.build_profiles is None else self.args.build_profiles.split(','),
debug_shell=self.args.shell,
snapshot=self.args.snapshot,
nocache=self.args.nocache,
Expand Down