deb: remove sbuild build mode
This commit is contained in:
@@ -41,7 +41,7 @@ jobs:
|
|||||||
- name: Install runtime system dependencies
|
- name: Install runtime system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y git pristine-tar sbuild mmdebstrap util-linux dpkg-dev
|
sudo apt-get install -y git pristine-tar mmdebstrap util-linux dpkg-dev
|
||||||
- name: Setup subuid/subgid
|
- name: Setup subuid/subgid
|
||||||
run: |
|
run: |
|
||||||
usermod --add-subuids 100000-200000 --add-subgids 100000-200000 ${USER:-root}
|
usermod --add-subuids 100000-200000 --add-subgids 100000-200000 ${USER:-root}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ Missing features:
|
|||||||
- [x] Build for a specific architecture
|
- [x] Build for a specific architecture
|
||||||
- [ ] Three build modes:
|
- [ ] Three build modes:
|
||||||
- [ ] Build locally (discouraged)
|
- [ ] Build locally (discouraged)
|
||||||
- [x] Build using sbuild+unshare, with binary emulation (default)
|
- [x] Build using unshare chroot, with binary emulation (default)
|
||||||
- [x] Cross-compilation
|
- [x] Cross-compilation
|
||||||
- [ ] Async build
|
- [ ] Async build
|
||||||
- [ ] `pkh status`
|
- [ ] `pkh status`
|
||||||
@@ -111,7 +111,7 @@ Missing features:
|
|||||||
- [ ] Lint the package
|
- [ ] Lint the package
|
||||||
- [ ] `pkh test`
|
- [ ] `pkh test`
|
||||||
- [ ] Run autopkgtest
|
- [ ] Run autopkgtest
|
||||||
- [ ] Provide options: local (discouraged), sbuild/VM?, ppa
|
- [ ] Provide options: local (discouraged), chroot, VM?, ppa
|
||||||
- [ ] Async test
|
- [ ] Async test
|
||||||
|
|
||||||
## Nice-to-have features
|
## Nice-to-have features
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ parts:
|
|||||||
- git
|
- git
|
||||||
- curl
|
- curl
|
||||||
- pristine-tar
|
- pristine-tar
|
||||||
- sbuild
|
|
||||||
- mmdebstrap
|
- mmdebstrap
|
||||||
- util-linux
|
- util-linux
|
||||||
- dpkg-dev
|
- dpkg-dev
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
mod cross;
|
mod cross;
|
||||||
mod ephemeral;
|
mod ephemeral;
|
||||||
mod local;
|
mod local;
|
||||||
mod sbuild;
|
|
||||||
|
|
||||||
use crate::context::{self, Context};
|
use crate::context::{self, Context};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
@@ -11,8 +10,6 @@ use std::sync::Arc;
|
|||||||
/// Build mode for the binary build
|
/// Build mode for the binary build
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
pub enum BuildMode {
|
pub enum BuildMode {
|
||||||
/// Use `sbuild` for the build, configured in unshare mode
|
|
||||||
Sbuild,
|
|
||||||
/// Local build, directly on the context
|
/// Local build, directly on the context
|
||||||
Local,
|
Local,
|
||||||
}
|
}
|
||||||
@@ -110,15 +107,6 @@ pub async fn build_binary_package(
|
|||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
}
|
}
|
||||||
BuildMode::Sbuild => sbuild::build(
|
|
||||||
&package,
|
|
||||||
&version,
|
|
||||||
arch,
|
|
||||||
series,
|
|
||||||
&build_root,
|
|
||||||
cross,
|
|
||||||
build_ctx.clone(),
|
|
||||||
)?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Retrieve produced .deb files
|
// Retrieve produced .deb files
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
/// Sbuild binary package building
|
|
||||||
/// Call 'sbuild' with the dsc file to build the package with unshare
|
|
||||||
use crate::context::Context;
|
|
||||||
use std::error::Error;
|
|
||||||
use std::path::Path;
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub fn build(
|
|
||||||
package: &str,
|
|
||||||
version: &str,
|
|
||||||
arch: &str,
|
|
||||||
series: &str,
|
|
||||||
build_root: &str,
|
|
||||||
cross: bool,
|
|
||||||
ctx: Arc<Context>,
|
|
||||||
) -> Result<(), Box<dyn Error>> {
|
|
||||||
// Find the actual package directory
|
|
||||||
let package_dir =
|
|
||||||
crate::deb::find_package_directory(Path::new(build_root), package, version, &ctx)?;
|
|
||||||
let package_dir_str = package_dir
|
|
||||||
.to_str()
|
|
||||||
.ok_or("Invalid package directory path")?;
|
|
||||||
|
|
||||||
let mut cmd = ctx.command("sbuild");
|
|
||||||
cmd.current_dir(package_dir_str);
|
|
||||||
cmd.arg("--chroot-mode=unshare");
|
|
||||||
cmd.arg("--no-clean-source");
|
|
||||||
|
|
||||||
if cross {
|
|
||||||
cmd.arg(format!("--host={}", arch));
|
|
||||||
} else {
|
|
||||||
cmd.arg(format!("--arch={}", arch));
|
|
||||||
}
|
|
||||||
cmd.arg(format!("--dist={}", series));
|
|
||||||
|
|
||||||
// Add output directory argument
|
|
||||||
cmd.arg(format!("--build-dir={}", build_root));
|
|
||||||
|
|
||||||
let status = cmd.status()?;
|
|
||||||
if !status.success() {
|
|
||||||
return Err(format!("sbuild failed with status: {}", status).into());
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
+2
-3
@@ -71,8 +71,8 @@ fn main() {
|
|||||||
.long_help("Inject a package into the build environment before build-dep. Can be a .deb file path, a package name from the archive, or a package from a previously added PPA. Can be specified multiple times.").required(false).action(clap::ArgAction::Append))
|
.long_help("Inject a package into the build environment before build-dep. Can be a .deb file path, a package name from the archive, or a package from a previously added PPA. Can be specified multiple times.").required(false).action(clap::ArgAction::Append))
|
||||||
.arg(arg!(--cross "Cross-compile for target architecture (instead of qemu-binfmt)")
|
.arg(arg!(--cross "Cross-compile for target architecture (instead of qemu-binfmt)")
|
||||||
.long_help("Cross-compile for target architecture (instead of using qemu-binfmt)\nNote that most packages cannot be cross-compiled").required(false))
|
.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 [sbuild, local]").required(false)
|
.arg(arg!(--mode <mode> "Change build mode [local]").required(false)
|
||||||
.long_help("Change build mode [sbuild, local]\nDefault will chose depending on other parameters, don't provide if unsure")),
|
.long_help("Change build mode [local]\nDefault will chose depending on other parameters, don't provide if unsure")),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
Command::new("context")
|
Command::new("context")
|
||||||
@@ -211,7 +211,6 @@ fn main() {
|
|||||||
};
|
};
|
||||||
let mode: Option<&str> = sub_matches.get_one::<String>("mode").map(|s| s.as_str());
|
let mode: Option<&str> = sub_matches.get_one::<String>("mode").map(|s| s.as_str());
|
||||||
let mode: Option<pkh::deb::BuildMode> = match mode {
|
let mode: Option<pkh::deb::BuildMode> = match mode {
|
||||||
Some("sbuild") => Some(pkh::deb::BuildMode::Sbuild),
|
|
||||||
Some("local") => Some(pkh::deb::BuildMode::Local),
|
Some("local") => Some(pkh::deb::BuildMode::Local),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user