Move the generic components out of src/build/ into a new src/debian/ module so they can be reused independently of the build pipeline: deb822 control parsing (plus the debian/control model), file checksum registry, debian/files registry, Debian version handling and changelog entry parsing. Merge OpenPGP clearsigning into utils/gpg.rs next to the existing key discovery helper, making signing available outside of builds. Delegate changelog.rs header/footer parsing to the new debian::changelog parser, removing the duplicate regex implementation. src/build/ keeps only build-specific logic: the pipeline driver, build types, environment setup and the .buildinfo/.changes writers.
55 lines
1.8 KiB
Rust
55 lines
1.8 KiB
Rust
//! pkh: Debian packaging helper
|
|
//!
|
|
//! pkh allows working with Debian packages, with multiple actions/submodules
|
|
#![deny(missing_docs)]
|
|
|
|
/// Handle apt data (apt sources)
|
|
pub mod apt;
|
|
/// Build a Debian source package (into a .dsc)
|
|
pub mod build;
|
|
/// Parse or edit a Debian changelog of a source package
|
|
pub mod changelog;
|
|
/// Reusable Debian format primitives (control/deb822, checksums, versions,
|
|
/// changelog entries, artifact registries)
|
|
pub mod debian;
|
|
/// Build a Debian package into a binary (.deb)
|
|
pub mod deb;
|
|
/// Obtain general information about distribution, series, etc
|
|
pub mod distro_info;
|
|
/// Obtain information about one or multiple packages
|
|
pub mod package_info;
|
|
/// Prune residual pkh build artifacts and caches
|
|
pub mod prune;
|
|
/// Download a source package locally
|
|
pub mod pull;
|
|
/// Handle package-specific quirks and workarounds
|
|
pub mod quirks;
|
|
|
|
/// Terminal UI helpers (progress bars, live build views, prompts)
|
|
pub mod ui;
|
|
|
|
/// Handle context for .deb building: locally, over ssh, in a chroot...
|
|
pub mod context;
|
|
|
|
/// Utility functions
|
|
pub(crate) mod utils;
|
|
|
|
/// Optional callback function (taking 4 arguments)
|
|
/// - Name of the current main operation (e.g. pulling package)
|
|
/// - Name of the current nested operation (e.g. cloning git repo)
|
|
/// - Progress, position, index of current operation (e.g. amount of data downloaded)
|
|
/// - Total amount for current operation (e.g. size of the file to download)
|
|
pub type ProgressCallback<'a> = Option<&'a dyn Fn(&str, &str, usize, usize)>;
|
|
|
|
/// Returns the architecture of current CPU, debian-compatible
|
|
pub fn get_current_arch() -> String {
|
|
match std::env::consts::ARCH {
|
|
"x86" => "i386".to_string(),
|
|
"x86_64" => "amd64".to_string(),
|
|
"arm" => "armhf".to_string(),
|
|
"aarch64" => "arm64".to_string(),
|
|
"powerpc64" => "ppc64el".to_string(),
|
|
x => x.to_string(),
|
|
}
|
|
}
|