From a4b29144be0cd44ef79256c8a2d08f3bc4998151 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Thu, 15 May 2025 12:26:38 +0200 Subject: [PATCH 1/3] feat: Add purls to IndexJson --- crates/rattler_conda_types/src/package/index.rs | 7 +++++-- crates/rattler_conda_types/src/repo_data/mod.rs | 2 +- crates/rattler_index/src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/rattler_conda_types/src/package/index.rs b/crates/rattler_conda_types/src/package/index.rs index e7bfac055c..075acece05 100644 --- a/crates/rattler_conda_types/src/package/index.rs +++ b/crates/rattler_conda_types/src/package/index.rs @@ -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. /// @@ -58,6 +58,9 @@ pub struct IndexJson { /// Optionally, the OS the package is build for. pub platform: Option, + /// A list of Package URLs identifying this package. + pub purls: Option>, + /// 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 . diff --git a/crates/rattler_conda_types/src/repo_data/mod.rs b/crates/rattler_conda_types/src/repo_data/mod.rs index 38800101ec..49a3c0a1b0 100644 --- a/crates/rattler_conda_types/src/repo_data/mod.rs +++ b/crates/rattler_conda_types/src/repo_data/mod.rs @@ -515,7 +515,7 @@ impl PackageRecord { timestamp: index.timestamp, track_features: index.track_features, version: index.version, - purls: None, + purls: index.purls, run_exports: None, }) } diff --git a/crates/rattler_index/src/lib.rs b/crates/rattler_index/src/lib.rs index c781d0a387..f3fa67d892 100644 --- a/crates/rattler_index/src/lib.rs +++ b/crates/rattler_index/src/lib.rs @@ -68,7 +68,7 @@ pub fn package_record_from_index_json( 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, }; From be00977580397eb77980371d4186f46f85ae2ed2 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Thu, 15 May 2025 13:24:21 +0200 Subject: [PATCH 2/3] reference CEP --- crates/rattler_conda_types/src/package/index.rs | 1 + crates/rattler_conda_types/src/repo_data/mod.rs | 1 + crates/rattler_conda_types/src/repo_data/patches.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/crates/rattler_conda_types/src/package/index.rs b/crates/rattler_conda_types/src/package/index.rs index 075acece05..8e2f10f91b 100644 --- a/crates/rattler_conda_types/src/package/index.rs +++ b/crates/rattler_conda_types/src/package/index.rs @@ -59,6 +59,7 @@ pub struct IndexJson { pub platform: Option, /// A list of Package URLs identifying this package. + /// See this CEP: https://github.com/conda/ceps/pull/63 pub purls: Option>, /// Optionally a path within the environment of the site-packages directory. diff --git a/crates/rattler_conda_types/src/repo_data/mod.rs b/crates/rattler_conda_types/src/repo_data/mod.rs index 49a3c0a1b0..f05cf68f02 100644 --- a/crates/rattler_conda_types/src/repo_data/mod.rs +++ b/crates/rattler_conda_types/src/repo_data/mod.rs @@ -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>, diff --git a/crates/rattler_conda_types/src/repo_data/patches.rs b/crates/rattler_conda_types/src/repo_data/patches.rs index 72e9906e03..92b3a9a6cb 100644 --- a/crates/rattler_conda_types/src/repo_data/patches.rs +++ b/crates/rattler_conda_types/src/repo_data/patches.rs @@ -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>, } From 731c6cc561b8de5440a948db1292c17997356522 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Thu, 15 May 2025 13:27:08 +0200 Subject: [PATCH 3/3] fix cargo doc --- crates/rattler_conda_types/src/package/index.rs | 2 +- crates/rattler_conda_types/src/repo_data/mod.rs | 2 +- crates/rattler_conda_types/src/repo_data/patches.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/rattler_conda_types/src/package/index.rs b/crates/rattler_conda_types/src/package/index.rs index 8e2f10f91b..17fa4ad787 100644 --- a/crates/rattler_conda_types/src/package/index.rs +++ b/crates/rattler_conda_types/src/package/index.rs @@ -59,7 +59,7 @@ pub struct IndexJson { pub platform: Option, /// A list of Package URLs identifying this package. - /// See this CEP: https://github.com/conda/ceps/pull/63 + /// See this CEP: pub purls: Option>, /// Optionally a path within the environment of the site-packages directory. diff --git a/crates/rattler_conda_types/src/repo_data/mod.rs b/crates/rattler_conda_types/src/repo_data/mod.rs index f05cf68f02..790cbd9d44 100644 --- a/crates/rattler_conda_types/src/repo_data/mod.rs +++ b/crates/rattler_conda_types/src/repo_data/mod.rs @@ -170,7 +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 + /// See this CEP: #[serde(default, skip_serializing_if = "Option::is_none")] pub purls: Option>, diff --git a/crates/rattler_conda_types/src/repo_data/patches.rs b/crates/rattler_conda_types/src/repo_data/patches.rs index 92b3a9a6cb..996d1102db 100644 --- a/crates/rattler_conda_types/src/repo_data/patches.rs +++ b/crates/rattler_conda_types/src/repo_data/patches.rs @@ -98,7 +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 + /// See this CEP: pub purls: Option>, }