Multiple changes
- quirks: added quirks, that does nothing for now - deb: install arch-independant dependencies (too much is better) - deb: added linux-riscv crossbuild test
This commit is contained in:
14
quirks.yml
Normal file
14
quirks.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Quirks configuration for package-specific workarounds
|
||||||
|
# This file defines package-specific quirks that are applied during pull and deb operations
|
||||||
|
|
||||||
|
quirks:
|
||||||
|
|
||||||
|
# Add more packages and their quirks as needed
|
||||||
|
# example-package:
|
||||||
|
# pull:
|
||||||
|
# method: archive
|
||||||
|
# deb:
|
||||||
|
# extra_dependencies:
|
||||||
|
# - another-dependency
|
||||||
|
# parameters:
|
||||||
|
# key: value
|
||||||
@@ -185,22 +185,22 @@ pub async fn build(
|
|||||||
return Err("Could not install build-dependencies for the build".into());
|
return Err("Could not install build-dependencies for the build".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Install arch-independant build dependencies
|
// Install arch-independant build dependencies
|
||||||
// log::debug!("Installing arch-independant build dependencies...");
|
log::debug!("Installing arch-independant build dependencies...");
|
||||||
// let status = ctx.command("apt-get")
|
let status = ctx
|
||||||
// .current_dir(package_dir_str)
|
.command("apt-get")
|
||||||
// .envs(env.clone())
|
.current_dir(package_dir_str)
|
||||||
// .arg("-y")
|
.envs(env.clone())
|
||||||
// .arg("build-dep")
|
.arg("-y")
|
||||||
// .arg("--indep-only")
|
.arg("build-dep")
|
||||||
// .arg("./")
|
.arg("./")
|
||||||
// .status()?;
|
.status()?;
|
||||||
|
|
||||||
// // If build-dep fails, we try to explain the failure using dose-debcheck
|
// If build-dep fails, we try to explain the failure using dose-debcheck
|
||||||
// if !status.success() {
|
if !status.success() {
|
||||||
// dose3_explain_dependencies(package, version, arch, build_root, cross)?;
|
dose3_explain_dependencies(package, version, arch, build_root, cross)?;
|
||||||
// return Err("Could not install build-dependencies for the build".into());
|
return Err("Could not install build-dependencies for the build".into());
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Run the build step
|
// Run the build step
|
||||||
log::debug!("Building (debian/rules build) package...");
|
log::debug!("Building (debian/rules build) package...");
|
||||||
@@ -260,6 +260,7 @@ fn dose3_explain_dependencies(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transform the dsc file into a 'Source' stanza (replacing 'Source' with 'Package')
|
// Transform the dsc file into a 'Source' stanza (replacing 'Source' with 'Package')
|
||||||
|
// TODO: Remove potential GPG headers/signature
|
||||||
let dsc_path = find_dsc_file(build_root, package, version)?;
|
let dsc_path = find_dsc_file(build_root, package, version)?;
|
||||||
let mut dsc_content = ctx.read_file(&dsc_path)?;
|
let mut dsc_content = ctx.read_file(&dsc_path)?;
|
||||||
dsc_content = dsc_content.replace("Source", "Package");
|
dsc_content = dsc_content.replace("Source", "Package");
|
||||||
|
|||||||
@@ -288,6 +288,17 @@ mod tests {
|
|||||||
test_build_end_to_end("hello", "sid", None, None, false).await;
|
test_build_end_to_end("hello", "sid", None, None, false).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This is a specific test case for the linux-riscv package on Ubuntu
|
||||||
|
/// It is important to ensure that pkh can cross-compile linux-riscv, as
|
||||||
|
/// for risc-v hardware is still rare and cross-compilation is necessary
|
||||||
|
/// to debug and test
|
||||||
|
#[tokio::test]
|
||||||
|
#[test_log::test]
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
async fn test_deb_linux_riscv_ubuntu_cross_end_to_end() {
|
||||||
|
test_build_end_to_end("linux-riscv", "questing", None, Some("riscv64"), true).await;
|
||||||
|
}
|
||||||
|
|
||||||
/// This is a specific test case for the latest gcc package on Debian
|
/// This is a specific test case for the latest gcc package on Debian
|
||||||
/// The GCC package is complex and hard to build, with specific stages
|
/// The GCC package is complex and hard to build, with specific stages
|
||||||
/// and system-bound scripts. Building it requires specific things that
|
/// and system-bound scripts. Building it requires specific things that
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ pub mod distro_info;
|
|||||||
pub mod package_info;
|
pub mod package_info;
|
||||||
/// Download a source package locally
|
/// Download a source package locally
|
||||||
pub mod pull;
|
pub mod pull;
|
||||||
|
/// Handle package-specific quirks and workarounds
|
||||||
|
pub mod quirks;
|
||||||
|
|
||||||
/// Handle context for .deb building: locally, over ssh, in a chroot...
|
/// Handle context for .deb building: locally, over ssh, in a chroot...
|
||||||
pub mod context;
|
pub mod context;
|
||||||
|
|||||||
77
src/quirks.rs
Normal file
77
src/quirks.rs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
//! Quirks module for handling package-specific workarounds
|
||||||
|
//!
|
||||||
|
//! This module provides functionality to read quirks from a YAML file
|
||||||
|
//! and apply them during pull and deb operations.
|
||||||
|
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
/// Quirks configuration for a specific operation (pull or deb)
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
pub struct OperationQuirks {
|
||||||
|
/// Extra dependencies to install before the operation
|
||||||
|
#[serde(default)]
|
||||||
|
pub extra_dependencies: Vec<String>,
|
||||||
|
|
||||||
|
/// Additional parameters for the operation
|
||||||
|
#[serde(default)]
|
||||||
|
pub parameters: HashMap<String, serde_yaml::Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Quirks for a specific package
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
pub struct PackageQuirks {
|
||||||
|
/// Quirks to apply during pull operation
|
||||||
|
#[serde(default)]
|
||||||
|
pub pull: Option<OperationQuirks>,
|
||||||
|
|
||||||
|
/// Quirks to apply during deb operation
|
||||||
|
#[serde(default)]
|
||||||
|
pub deb: Option<OperationQuirks>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Top-level quirks configuration
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
|
pub struct QuirksConfig {
|
||||||
|
/// Map of package names to their quirks
|
||||||
|
pub quirks: HashMap<String, PackageQuirks>,
|
||||||
|
}
|
||||||
|
|
||||||
|
const QUIRKS_YAML: &str = include_str!("../quirks.yml");
|
||||||
|
lazy_static! {
|
||||||
|
static ref QUIRKS_DATA: QuirksConfig = serde_yaml::from_str(QUIRKS_YAML).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get quirks for a specific package
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
/// * `config` - The quirks configuration
|
||||||
|
/// * `package` - The package name
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// * `Option<PackageQuirks>` - The quirks for the package, or None if not found
|
||||||
|
pub fn get_package_quirks<'a>(
|
||||||
|
config: &'a QuirksConfig,
|
||||||
|
package: &str,
|
||||||
|
) -> Option<&'a PackageQuirks> {
|
||||||
|
config.quirks.get(package)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get deb-time extra dependencies for a package
|
||||||
|
///
|
||||||
|
/// This function returns the list of extra dependencies that should be installed
|
||||||
|
/// before building a package, as defined in the quirks configuration.
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
/// * `package` - The package name
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// * `Vec<String>` - List of extra dependencies, or empty vector if none
|
||||||
|
pub fn get_deb_extra_dependencies(package: &str) -> Vec<String> {
|
||||||
|
if let Some(quirks) = &get_package_quirks(&QUIRKS_DATA, package).unwrap().deb {
|
||||||
|
return quirks.extra_dependencies.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user