diff options
Diffstat (limited to 'src/plan.rs')
| -rw-r--r-- | src/plan.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plan.rs b/src/plan.rs index 3d28d96..f3e58fa 100644 --- a/src/plan.rs +++ b/src/plan.rs @@ -1,5 +1,8 @@ +use std::path::Path; + use anyhow::Result; +use crate::package_installer::{AptConfig, PackageRequest}; use crate::{ImageSpec, Stage}; #[derive(Debug, Clone, PartialEq, Eq)] @@ -24,4 +27,23 @@ impl BuildPlan { pub fn dependencies(&self, stage: Stage) -> &'static [Stage] { stage.dependencies() } + + /// Compile package-installation inputs from the validated immutable spec. + /// This keeps ALT's external resolver behind the typed adapter boundary. + pub fn package_request( + &self, + workdir: impl AsRef<Path>, + apt_config: impl AsRef<Path>, + ) -> Result<PackageRequest> { + PackageRequest::new( + workdir, + AptConfig::new(apt_config)?, + self.spec.packages.base.iter().cloned(), + self.spec + .packages + .selectors + .iter() + .map(|selector| selector.as_str().to_owned()), + ) + } } |