Initial commit: APT-DNF Bridge workspace

- Core crate: Minimal shell-out implementation
- Advanced crate: Pluggable backends and enhanced features
- Main crate: Re-exports core + optional advanced features
- Feature flags: Users choose complexity level
- Examples: Working demonstrations of both approaches
- Documentation: Clear README explaining the structure

Implements the refined two-crate approach with workspace + feature flags.
This commit is contained in:
robojerk 2025-09-13 20:45:18 -07:00
commit 06cafa0366
24 changed files with 2790 additions and 0 deletions

37
apt-dnf-bridge/Cargo.toml Normal file
View file

@ -0,0 +1,37 @@
[package]
name = "apt-dnf-bridge"
version.workspace = true
edition.workspace = true
description = "DNF-like API for APT, with optional advanced features"
license.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
[dependencies]
apt-dnf-bridge-core = { path = "../apt-dnf-bridge-core" }
apt-dnf-bridge-advanced = { path = "../apt-dnf-bridge-advanced", optional = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
[features]
default = [] # Core-only by default
advanced = ["apt-dnf-bridge-advanced"]
[dev-dependencies]
tempfile.workspace = true
[[example]]
name = "basic_usage"
path = "../examples/basic_usage.rs"
[[example]]
name = "package_query"
path = "../examples/package_query.rs"
[[example]]
name = "atomicity_notes"
path = "../examples/atomicity_notes.rs"
[[example]]
name = "backend_selection"
path = "../examples/backend_selection.rs"

47
apt-dnf-bridge/src/lib.rs Normal file
View file

@ -0,0 +1,47 @@
//! # APT-DNF Bridge
//!
//! A DNF-like bridge around APT for apt-ostree integration.
//! This crate provides a transaction-based API that makes APT work like DNF.
//!
//! ## Quick Start
//!
//! Core (minimal, shell-out only):
//! ```toml
//! apt-dnf-bridge = "0.1"
//! ```
//!
//! With advanced features (pluggable backends, caching):
//! ```toml
//! apt-dnf-bridge = { version = "0.1", features = ["advanced"] }
//! ```
//!
//! ## Example
//!
//! ```rust,no_run
//! use apt_dnf_bridge::{Transaction, Package, Repository};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a transaction
//! let mut tx = Transaction::new();
//!
//! // Add packages to install
//! let vim = Package::new("vim", "2:8.1.2269-1ubuntu5.14", "amd64");
//! tx.add_install(vim).await?;
//!
//! // Resolve dependencies (APT handles automatically)
//! tx.resolve().await?;
//!
//! // Commit the transaction
//! tx.commit().await?;
//!
//! Ok(())
//! }
//! ```
// Always expose the core API
pub use apt_dnf_bridge_core::*;
// Conditionally expose advanced features
#[cfg(feature = "advanced")]
pub use apt_dnf_bridge_advanced::*;