Skip to content

Commit 0122bfb

Browse files
committed
fix: add topics after mount_rs again
1 parent 8c68a40 commit 0122bfb

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

src/actions/packaging.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn package_build_inner<P: AsRef<Path>>(
162162
packages: &[String],
163163
instance: &str,
164164
root: P,
165-
apt: bool,
165+
settings: BuildSettings,
166166
) -> Result<(i32, usize)> {
167167
let total = packages.len();
168168
let hostname = gethostname().map_or_else(
@@ -186,12 +186,22 @@ fn package_build_inner<P: AsRef<Path>>(
186186
// hopefully the sequence gets flushed together with the `info!` below
187187
info!("[{}/{}] Building {}...", index + 1, total, package);
188188
mount_fs(instance)?;
189+
190+
if !settings.with_topics.is_empty() {
191+
let mut cmd = vec!["/bin/oma", "topics", "--yes"];
192+
for topic in settings.with_topics {
193+
cmd.push("--opt-in");
194+
cmd.push(topic);
195+
}
196+
run_in_container(instance, &cmd)?;
197+
}
198+
189199
info!("Refreshing local repository...");
190200
repo::init_repo(root.as_ref(), Path::new(instance))?;
191201
let mut status = -1;
192202
let mut oma = true;
193203
for i in 1..=5 {
194-
status = if oma && !apt {
204+
status = if oma && !settings.force_use_apt {
195205
run_in_container(instance, &["/bin/bash", "-ec", OMA_UPDATE_SCRIPT]).unwrap_or(-1)
196206
} else {
197207
run_in_container(instance, &["/bin/bash", "-ec", APT_UPDATE_SCRIPT]).unwrap_or(-1)
@@ -215,7 +225,7 @@ fn package_build_inner<P: AsRef<Path>>(
215225

216226
let mut acbs = vec!["/bin/acbs-build"];
217227

218-
if apt {
228+
if settings.force_use_apt {
219229
acbs.push("--force-use-apt");
220230
}
221231

@@ -338,16 +348,16 @@ pub fn package_build<S: AsRef<str>, K: Clone + ExactSizeIterator<Item = S>>(
338348
mount_fs(instance)?;
339349
rollback_container(instance)?;
340350

341-
if !settings.with_topics.is_empty() {
342-
let mut cmd = vec!["/bin/oma", "topics", "--yes"];
343-
for topic in settings.with_topics {
344-
cmd.push("--opt-in");
345-
cmd.push(topic);
351+
if !conf.local_repo {
352+
if !settings.with_topics.is_empty() {
353+
let mut cmd = vec!["/bin/oma", "topics", "--yes"];
354+
for topic in settings.with_topics {
355+
cmd.push("--opt-in");
356+
cmd.push(topic);
357+
}
358+
run_in_container(instance, &cmd)?;
346359
}
347-
run_in_container(instance, &cmd)?;
348-
}
349360

350-
if !conf.local_repo {
351361
let mut cmd = vec!["/bin/acbs-build".to_string()];
352362

353363
if settings.force_use_apt {
@@ -366,7 +376,7 @@ pub fn package_build<S: AsRef<str>, K: Clone + ExactSizeIterator<Item = S>>(
366376
let total = packages.len();
367377
let start = Instant::now();
368378
let (exit_status, progress) =
369-
package_build_inner(&packages, instance, root, settings.force_use_apt)?;
379+
package_build_inner(&packages, instance, root, settings)?;
370380
if exit_status != 0 {
371381
let checkpoint = BuildCheckPoint {
372382
packages,

0 commit comments

Comments
 (0)