Skip to content
Merged
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
8 changes: 6 additions & 2 deletions crates/rattler_conda_types/src/package/index.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::path::Path;
use std::{collections::BTreeSet, path::Path};

use rattler_macros::sorted;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, skip_serializing_none};

use super::PackageFile;
use crate::{NoArchType, PackageName, VersionWithSource};
use crate::{NoArchType, PackageName, PackageUrl, VersionWithSource};

/// A representation of the `index.json` file found in package archives.
///
Expand Down Expand Up @@ -58,6 +58,10 @@ pub struct IndexJson {
/// Optionally, the OS the package is build for.
pub platform: Option<String>,

/// A list of Package URLs identifying this package.
/// See this CEP: <https://github.com/conda/ceps/pull/63>
pub purls: Option<BTreeSet<PackageUrl>>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry we need to add #[serde(default, skip_serializing ...] here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/// Optionally a path within the environment of the site-packages directory.
/// This field is only present for python interpreter packages.
/// This field was introduced with <https://github.com/conda/ceps/blob/main/cep-17.md>.
Expand Down
3 changes: 2 additions & 1 deletion crates/rattler_conda_types/src/repo_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ pub struct PackageRecord {
/// filled in. So later it can be one of the following:
/// [`Some(vec![])`] means that the purl is empty and package is not pypi
/// one. [`Some([`PackageUrl`])`] means that it is a pypi package.
/// See this CEP: <https://github.com/conda/ceps/pull/63>
#[serde(default, skip_serializing_if = "Option::is_none")]
pub purls: Option<BTreeSet<PackageUrl>>,

Expand Down Expand Up @@ -515,7 +516,7 @@ impl PackageRecord {
timestamp: index.timestamp,
track_features: index.track_features,
version: index.version,
purls: None,
purls: index.purls,
run_exports: None,
})
}
Expand Down
1 change: 1 addition & 0 deletions crates/rattler_conda_types/src/repo_data/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub struct PackageRecordPatch {

/// Package identifiers of packages that are equivalent to this package but from other
/// ecosystems.
/// See this CEP: <https://github.com/conda/ceps/pull/63>
pub purls: Option<BTreeSet<PackageUrl>>,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rattler_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn package_record_from_index_json<T: Read>(
python_site_packages_path: index.python_site_packages_path,
legacy_bz2_md5: None,
legacy_bz2_size: None,
purls: None,
purls: index.purls,
run_exports: None,
};

Expand Down