deb: add -j/--jobs to control parallel build jobs
By default the number of parallel jobs is detected with nproc inside the build context. Add a -j/--jobs option so an explicit count can be honored instead, threading it through build_binary_package and local::build into DEB_BUILD_OPTIONS=parallel=N.
This commit is contained in:
+10
@@ -78,6 +78,7 @@ fn main() {
|
||||
.long_help("Cross-compile for target architecture (instead of using qemu-binfmt)\nNote that most packages cannot be cross-compiled").required(false))
|
||||
.arg(arg!(--mode <mode> "Change build mode [local]").required(false)
|
||||
.long_help("Change build mode [local]\nDefault will chose depending on other parameters, don't provide if unsure"))
|
||||
.arg(arg!(-j --jobs <jobs> "Number of parallel build jobs (default: number of CPUs available in the build context)").required(false))
|
||||
.arg(arg!(--verbose "Show raw tool output instead of the live build view").required(false)
|
||||
.long_help("Show raw tool output instead of the live build view.\nAlso implied by RUST_LOG=debug for pkh's own logs.")),
|
||||
)
|
||||
@@ -313,6 +314,14 @@ fn main() {
|
||||
.copied()
|
||||
.unwrap_or(false);
|
||||
|
||||
let jobs = sub_matches.get_one::<String>("jobs").map(|s| s.as_str());
|
||||
let jobs = jobs.map(|j| {
|
||||
j.parse::<usize>().unwrap_or_else(|_| {
|
||||
error!("Invalid --jobs value '{}': expected a positive integer", j);
|
||||
std::process::exit(1);
|
||||
})
|
||||
});
|
||||
|
||||
// Live build view: disabled by --verbose or when stdout is not a
|
||||
// terminal (DebUi handles the non-TTY case itself)
|
||||
let ui = if verbose {
|
||||
@@ -333,6 +342,7 @@ fn main() {
|
||||
inject_packages,
|
||||
None,
|
||||
ui.clone(),
|
||||
jobs,
|
||||
)
|
||||
.await
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user