Skip to content
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
1 change: 1 addition & 0 deletions completions/_ciel
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ _arguments "${_arguments_options[@]}" \
'-i+[Instance to build in]: : ' \
'(--stage-select)-c+[Continue from a Ciel checkpoint]: : ' \
'(--stage-select)--resume=[Continue from a Ciel checkpoint]: : ' \
'*--with-topics=[Try to add topics before building, delimited by space]: : ' \
'--stage-select=[Select the starting point for a build]' \
'-g[Fetch source packages only]' \
'-x[Disable network in the container during the build]' \
Expand Down
6 changes: 5 additions & 1 deletion completions/ciel.bash
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ _ciel() {
return 0
;;
ciel__build)
opts="-g -x -i -2 -c -h --offline --stage2 --resume --stage-select --help"
opts="-g -x -i -2 -c -h --offline --stage2 --with-topics --resume --stage-select --help"
_ciel_source_env 2>/dev/null || true
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 && -z "${CIEL_INST}" ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
Expand All @@ -276,6 +276,10 @@ _ciel() {
COMPREPLY=($(compgen -W "$(_ciel_list_instances)" -- "$cur"))
return 0
;;
--with-topics)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--resume)
COMPREPLY=($(compgen -f "${cur}"))
return 0
Expand Down
1 change: 1 addition & 0 deletions completions/ciel.fish
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ complete -c ciel -n "__fish_seen_subcommand_from config" -s h -l help -d 'Print
complete -c ciel -n "__fish_seen_subcommand_from commit" -s h -l help -d 'Print help information'
complete -c ciel -n "__fish_seen_subcommand_from doctor" -s h -l help -d 'Print help information'
complete -c ciel -n "__fish_seen_subcommand_from build" -s c -l resume -d 'Continue from a Ciel checkpoint' -r
complete -c ciel -n "__fish_seen_subcommand_from build" -l with-topics -d 'Try to add topics before building, delimited by space' -r
complete -c ciel -n "__fish_seen_subcommand_from build" -l stage-select -d 'Select the starting point for a build' -r
complete -c ciel -n "__fish_seen_subcommand_from build" -s g -d 'Fetch source packages only'
complete -c ciel -n "__fish_seen_subcommand_from build" -s x -l offline -d 'Disable network in the container during the build'
Expand Down
12 changes: 11 additions & 1 deletion src/actions/packaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ pub struct BuildCheckPoint {
}

#[derive(Debug, Copy, Clone)]
pub struct BuildSettings {
pub struct BuildSettings<'a> {
pub offline: bool,
pub stage2: bool,
pub force_use_apt: bool,
pub with_topics: &'a [&'a str],
}

pub fn load_build_checkpoint<P: AsRef<Path>>(path: P) -> Result<BuildCheckPoint> {
Expand Down Expand Up @@ -334,6 +335,15 @@ pub fn package_build<S: AsRef<str>, K: Clone + ExactSizeIterator<Item = S>>(
info!("Running in stage 2 mode. ACBS and autobuild3 may behave differently.");
}

if !settings.with_topics.is_empty() {
let mut cmd = vec!["/bin/oma", "topics", "--yes"];
for topic in settings.with_topics {
cmd.push("--opt-in");
cmd.push(topic);
}
let _ = run_in_container(instance, &cmd);
}

mount_fs(instance)?;
rollback_container(instance)?;

Expand Down
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub fn build_cli() -> Command {
.arg(instance_arg.clone().help("Instance to build in"))
.arg(Arg::new("STAGE2").long("stage2").short('2').action(clap::ArgAction::SetTrue).env("CIEL_STAGE2").help("Use stage 2 mode instead of the regular build mode"))
.arg(Arg::new("force_use_apt").long("force-use-apt").action(clap::ArgAction::SetTrue).env("FORCE_USE_APT").help("Force use apt to run acbs"))
.arg(Arg::new("TOPICS").long("with-topics").action(clap::ArgAction::Append).num_args(1..).help("Try to add topics before building, delimited by space"))
.arg(Arg::new("CONTINUE").conflicts_with("SELECT").short('c').long("resume").alias("continue").num_args(1).help("Continue from a Ciel checkpoint"))
.arg(Arg::new("SELECT").num_args(0..=1).long("stage-select").help("Select the starting point for a build"))
.arg(Arg::new("PACKAGES").conflicts_with("CONTINUE").num_args(1..))
Expand Down
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,18 @@ fn main() -> Result<()> {
}
("build", args) => {
let instance = get_instance_option(args)?;
let topics = args
.get_many::<String>("TOPICS")
.unwrap_or_default()
.into_iter()
.map(|s| s.as_str())
.collect::<Vec<_>>();
let settings = BuildSettings {
offline: args.get_flag("OFFLINE"),
stage2: args.get_flag("STAGE2"),
force_use_apt: args.get_flag("force_use_apt")
|| read_config().is_ok_and(|config| config.force_use_apt),
with_topics: &topics,
};
let mut state = None;
if let Some(cont) = args.get_one::<String>("CONTINUE") {
Expand Down
Loading