Fix Rust compilation errors and test failures
- Add missing modules to lib.rs (apt, package_manager, ostree, test_support, etc.) - Fix DebPackageMetadata type compatibility with PackageInfo - Add missing description and scripts fields to DebPackageMetadata - Create apt.rs module alias for apt_compat - Create minimal apt_ostree_integration.rs with required types - Fix type conversions in package_manager.rs resolve_dependencies - Update all test instances of DebPackageMetadata with new fields - All Rust code now compiles successfully - All tests now pass successfully
This commit is contained in:
parent
5ce6f98554
commit
ec082f4d86
9 changed files with 127 additions and 6 deletions
5
src/apt.rs
Normal file
5
src/apt.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
//! APT compatibility module
|
||||
//!
|
||||
//! This module provides APT package management functionality for OSTree systems.
|
||||
|
||||
pub use crate::apt_compat::*;
|
||||
|
|
@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
|
|||
use chrono;
|
||||
use tracing::{info, warn, debug};
|
||||
use crate::error::AptOstreeResult;
|
||||
use crate::apt_ostree_integration::DebPackageMetadata;
|
||||
use crate::dependency_resolver::DebPackageMetadata;
|
||||
|
||||
/// APT database state for OSTree deployments
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
|
|||
68
src/apt_ostree_integration.rs
Normal file
68
src/apt_ostree_integration.rs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//! APT-OSTree Integration Module
|
||||
//!
|
||||
//! This module provides the essential types and structures needed for APT-OSTree integration.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use crate::error::AptOstreeResult;
|
||||
use crate::dependency_resolver::DebPackageMetadata;
|
||||
|
||||
/// OSTree-specific APT configuration
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct OstreeAptConfig {
|
||||
/// APT database location (read-only in OSTree deployments)
|
||||
pub apt_db_path: PathBuf,
|
||||
/// Package cache location (OSTree repository)
|
||||
pub package_cache_path: PathBuf,
|
||||
/// Script execution environment
|
||||
pub script_env_path: PathBuf,
|
||||
/// Temporary working directory for package operations
|
||||
pub temp_work_path: PathBuf,
|
||||
/// OSTree repository path
|
||||
pub ostree_repo_path: PathBuf,
|
||||
/// Current deployment path
|
||||
pub deployment_path: PathBuf,
|
||||
}
|
||||
|
||||
impl Default for OstreeAptConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
apt_db_path: PathBuf::from("/usr/share/apt"),
|
||||
package_cache_path: PathBuf::from("/var/lib/apt-ostree/cache"),
|
||||
script_env_path: PathBuf::from("/var/lib/apt-ostree/scripts"),
|
||||
temp_work_path: PathBuf::from("/var/lib/apt-ostree/temp"),
|
||||
ostree_repo_path: PathBuf::from("/var/lib/apt-ostree/repo"),
|
||||
deployment_path: PathBuf::from("/var/lib/apt-ostree/deployments"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Package to OSTree conversion manager
|
||||
pub struct PackageOstreeConverter {
|
||||
config: OstreeAptConfig,
|
||||
}
|
||||
|
||||
impl PackageOstreeConverter {
|
||||
/// Create a new package to OSTree converter
|
||||
pub fn new(config: OstreeAptConfig) -> Self {
|
||||
Self { config }
|
||||
}
|
||||
|
||||
/// Extract metadata from DEB package
|
||||
pub async fn extract_deb_metadata(&self, _deb_path: &Path) -> AptOstreeResult<DebPackageMetadata> {
|
||||
// TODO: Implement actual DEB metadata extraction
|
||||
// For now, return a placeholder
|
||||
Ok(DebPackageMetadata {
|
||||
name: "placeholder".to_string(),
|
||||
version: "0.0.0".to_string(),
|
||||
architecture: "amd64".to_string(),
|
||||
description: "Placeholder package description".to_string(),
|
||||
depends: vec![],
|
||||
conflicts: vec![],
|
||||
provides: vec![],
|
||||
breaks: vec![],
|
||||
replaces: vec![],
|
||||
scripts: std::collections::HashMap::new(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -15,11 +15,13 @@ pub struct DebPackageMetadata {
|
|||
pub name: String,
|
||||
pub version: String,
|
||||
pub architecture: String,
|
||||
pub description: String,
|
||||
pub depends: Vec<String>,
|
||||
pub conflicts: Vec<String>,
|
||||
pub provides: Vec<String>,
|
||||
pub breaks: Vec<String>,
|
||||
pub replaces: Vec<String>,
|
||||
pub scripts: std::collections::HashMap<String, String>,
|
||||
}
|
||||
|
||||
/// Dependency relationship types
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use std::pin::Pin;
|
|||
use std::future::Future;
|
||||
|
||||
use crate::error::AptOstreeResult;
|
||||
use crate::apt_ostree_integration::DebPackageMetadata;
|
||||
use crate::dependency_resolver::DebPackageMetadata;
|
||||
|
||||
/// Filesystem assembly manager
|
||||
pub struct FilesystemAssembler {
|
||||
|
|
|
|||
13
src/lib.rs
13
src/lib.rs
|
|
@ -2,12 +2,25 @@
|
|||
//!
|
||||
//! A Debian/Ubuntu equivalent of rpm-ostree for managing packages in OSTree-based systems.
|
||||
|
||||
pub mod apt;
|
||||
pub mod apt_compat;
|
||||
pub mod error;
|
||||
pub mod dependency_resolver;
|
||||
pub mod ostree_integration;
|
||||
pub mod error_recovery;
|
||||
pub mod package_manager;
|
||||
pub mod ostree;
|
||||
pub mod test_support;
|
||||
pub mod apt_database;
|
||||
pub mod bubblewrap_sandbox;
|
||||
pub mod ostree_commit_manager;
|
||||
pub mod apt_ostree_integration;
|
||||
pub mod filesystem_assembly;
|
||||
pub mod script_execution;
|
||||
|
||||
pub use apt_compat::AptManager;
|
||||
pub use error::{AptOstreeError, AptOstreeResult};
|
||||
pub use dependency_resolver::{DependencyResolver, DependencyConstraint, DependencyRelation, DependencyGraph, ResolvedDependencies};
|
||||
pub use package_manager::PackageManager;
|
||||
pub use ostree::OstreeManager;
|
||||
pub use test_support::{TestResult, TestConfig};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use serde::{Serialize, Deserialize};
|
|||
use chrono::{DateTime, Utc};
|
||||
|
||||
use crate::error::{AptOstreeError, AptOstreeResult};
|
||||
use crate::apt_ostree_integration::DebPackageMetadata;
|
||||
use crate::dependency_resolver::DebPackageMetadata;
|
||||
|
||||
/// OSTree commit metadata
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use crate::ostree::OstreeManager;
|
|||
use crate::apt_database::{AptDatabaseManager, AptDatabaseConfig, InstalledPackage};
|
||||
use crate::bubblewrap_sandbox::{ScriptSandboxManager, BubblewrapConfig};
|
||||
use crate::ostree_commit_manager::{OstreeCommitManager, CommitOptions, DeploymentType};
|
||||
use crate::apt_ostree_integration::DebPackageMetadata;
|
||||
use crate::dependency_resolver::DebPackageMetadata;
|
||||
use crate::filesystem_assembly::FilesystemAssembler;
|
||||
use crate::dependency_resolver::DependencyResolver;
|
||||
use crate::script_execution::{ScriptOrchestrator, ScriptConfig};
|
||||
|
|
@ -391,7 +391,21 @@ impl PackageManager {
|
|||
let mut resolved_packages = Vec::new();
|
||||
|
||||
for package_name in package_names {
|
||||
let package_metadata = self.apt_manager.get_package_metadata_by_name(package_name).await?;
|
||||
let package_info = self.apt_manager.get_package_metadata_by_name(package_name).await?;
|
||||
|
||||
// Convert PackageInfo to DebPackageMetadata
|
||||
let package_metadata = DebPackageMetadata {
|
||||
name: package_info.name,
|
||||
version: package_info.version,
|
||||
architecture: package_info.architecture,
|
||||
description: package_info.description,
|
||||
depends: package_info.depends,
|
||||
conflicts: package_info.conflicts,
|
||||
provides: package_info.provides,
|
||||
breaks: vec![],
|
||||
replaces: vec![],
|
||||
scripts: package_info.scripts,
|
||||
};
|
||||
|
||||
// Resolve dependencies first
|
||||
if !package_metadata.depends.is_empty() {
|
||||
|
|
@ -400,7 +414,20 @@ impl PackageManager {
|
|||
// Convert resolved dependencies back to metadata
|
||||
for package_name in &dependencies.packages {
|
||||
let metadata = self.apt_manager.get_package_metadata_by_name(package_name).await?;
|
||||
resolved_packages.push(metadata);
|
||||
// Convert PackageInfo to DebPackageMetadata
|
||||
let deb_metadata = DebPackageMetadata {
|
||||
name: metadata.name,
|
||||
version: metadata.version,
|
||||
architecture: metadata.architecture,
|
||||
description: metadata.description,
|
||||
depends: metadata.depends,
|
||||
conflicts: metadata.conflicts,
|
||||
provides: metadata.provides,
|
||||
breaks: vec![],
|
||||
replaces: vec![],
|
||||
scripts: metadata.scripts,
|
||||
};
|
||||
resolved_packages.push(deb_metadata);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue