Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ example, the rpmdb is a component repo (one can imagine similar component repos
for other distros). There is also an xattr-based component repo (see the section
"Customizing the layers" below). Multiple component repos can be active at once.

The following component repos are supported:

- `rpm`: files owned by RPM packages, grouped by source RPM.
- `alpm`: files owned by pacman packages, grouped by package base.
- `pip`: Python distributions installed by pip, uv, or any other installer
following [PEP 376][pep376].
- `xattr`: files explicitly assigned via the `user.component` xattr.
- `bigfiles`: large files not claimed by any other repo, each as their own
component.

### Customizing the layers

It is possible to create custom components by setting the `user.component` xattr
Expand Down Expand Up @@ -416,6 +426,7 @@ well.

[add-determinism]: https://github.com/keszybz/add-determinism
[bootable container images]: https://containers.github.io/bootable/
[pep376]: https://packaging.python.org/en/latest/specifications/recording-installed-packages/
[buildah-annotations-bug]: https://github.com/containers/buildah/issues/6652
[buildah-rfe]: https://github.com/containers/buildah/issues/6621
[build-chunked-oci]: https://coreos.github.io/rpm-ostree/build-chunked-oci/
Expand Down
15 changes: 14 additions & 1 deletion src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod alpm;
mod bigfiles;
mod pip;
mod rpm;
mod xattr;

Expand All @@ -24,6 +25,11 @@ pub const STABILITY_PERIOD_DAYS: f64 = 7.0;
/// Maximum lookback period in days for changelog analysis.
pub const STABILITY_LOOKBACK_DAYS: u64 = 365;

/// Convert a stability interval in days to a probability using the Poisson model.
pub fn interval_to_stability(interval_days: u64) -> f64 {
(-STABILITY_PERIOD_DAYS / interval_days as f64).exp()
}

/// Loaded component repos along with the default mtime to use.
pub struct ComponentsRepos {
repos: Vec<Box<dyn ComponentsRepo>>,
Expand Down Expand Up @@ -145,12 +151,19 @@ impl ComponentsRepos {
repos.push(Box::new(repo));
}

if let Some(repo) = pip::PipRepo::load(rootfs, files, default_mtime_clamp)
.context("loading pip dist-info")?
{
tracing::info!(repo = "pip", "loaded repo");
repos.push(Box::new(repo));
}

if let Some(repo) = bigfiles::BigfilesRepo::load(files, default_mtime_clamp) {
tracing::info!(repo = "bigfiles", "loaded repo");
repos.push(Box::new(repo));
}

// Other backends (e.g. deb, apk, pip, etc.) would go here...
// Other backends (e.g. deb, apk, etc.) would go here...

Ok(Self {
repos,
Expand Down
Loading