Skip to content

Commit f5b9510

Browse files
committed
feat: add option to allow ciel build with --force-use-apt
1 parent 9a8a294 commit f5b9510

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/actions/packaging.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub struct BuildCheckPoint {
3131
pub struct BuildSettings {
3232
pub offline: bool,
3333
pub stage2: bool,
34+
pub force_use_apt: bool,
3435
}
3536

3637
pub fn load_build_checkpoint<P: AsRef<Path>>(path: P) -> Result<BuildCheckPoint> {
@@ -151,6 +152,7 @@ fn package_build_inner<P: AsRef<Path>>(
151152
packages: &[String],
152153
instance: &str,
153154
root: P,
155+
apt: bool,
154156
) -> Result<(i32, usize)> {
155157
let total = packages.len();
156158
let hostname = gethostname().map_or_else(
@@ -200,7 +202,18 @@ fn package_build_inner<P: AsRef<Path>>(
200202
error!("Failed to update the OS before building packages");
201203
return Ok((status, index));
202204
}
203-
let status = run_in_container(instance, &["/bin/acbs-build", "--", package])?;
205+
206+
let mut acbs = vec!["/bin/acbs-build"];
207+
208+
if apt {
209+
acbs.push("--force-use-apt");
210+
}
211+
212+
acbs.push("--");
213+
acbs.push(package);
214+
215+
let status = run_in_container(instance, &acbs)?;
216+
204217
if status != 0 {
205218
error!("Build failed with status: {}", status);
206219
return Ok((status, index));
@@ -326,7 +339,8 @@ pub fn package_build<S: AsRef<str>, K: Clone + ExactSizeIterator<Item = S>>(
326339
let root = std::env::current_dir()?.join(output_dir);
327340
let total = packages.len();
328341
let start = Instant::now();
329-
let (exit_status, progress) = package_build_inner(&packages, instance, root)?;
342+
let (exit_status, progress) =
343+
package_build_inner(&packages, instance, root, settings.force_use_apt)?;
330344
if exit_status != 0 {
331345
let checkpoint = BuildCheckPoint {
332346
packages,

src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ pub fn build_cli() -> Command {
122122
.arg(Arg::new("OFFLINE").short('x').long("offline").action(clap::ArgAction::SetTrue).env("CIEL_OFFLINE").help("Disable network in the container during the build"))
123123
.arg(instance_arg.clone().help("Instance to build in"))
124124
.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"))
125+
.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"))
125126
.arg(Arg::new("CONTINUE").conflicts_with("SELECT").short('c').long("resume").alias("continue").num_args(1).help("Continue from a Ciel checkpoint"))
126127
.arg(Arg::new("SELECT").num_args(0..=1).long("stage-select").help("Select the starting point for a build"))
127128
.arg(Arg::new("PACKAGES").conflicts_with("CONTINUE").num_args(1..))

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ fn main() -> Result<()> {
302302
let settings = BuildSettings {
303303
offline: args.get_flag("OFFLINE"),
304304
stage2: args.get_flag("STAGE2"),
305+
force_use_apt: args.get_flag("force_use_apt")
306+
|| read_config().is_ok_and(|config| config.force_use_apt),
305307
};
306308
let mut state = None;
307309
if let Some(cont) = args.get_one::<String>("CONTINUE") {

0 commit comments

Comments
 (0)