-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add purls to PackageRecord and lockfile (#414)
Implementation of conda/ceps#63
- Loading branch information
1 parent
bdc0e59
commit d7ecd1f
Showing
9 changed files
with
150 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...es/src/repo_data/snapshots/rattler_conda_types__repo_data__patches__test__patch_purl.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
source: crates/rattler_conda_types/src/repo_data/patches.rs | ||
assertion_line: 281 | ||
expression: repodata | ||
--- | ||
info: | ||
subdir: linux-64 | ||
packages: | ||
cross-python_emscripten-32-3.10.1-h60d57d3_8.tar.bz2: | ||
build: h60d57d3_8 | ||
build_number: 8 | ||
depends: | ||
- coreutils | ||
- crossenv >=1.2 | ||
- emscripten_emscripten-32 | ||
- pip | ||
- python 3.10.* | ||
- rsync | ||
- sed | ||
- setuptools | ||
md5: 07b8bdf69566cd63e6e49759033830ad | ||
name: cross-python_emscripten-32 | ||
purls: | ||
- "pkg:pypi/[email protected]" | ||
sha256: 50064d294599734090b9a33a2194a94f5d3743325d5bae61fab3fa5151acf0f9 | ||
size: 7069 | ||
subdir: linux-64 | ||
timestamp: 1679045249592 | ||
version: 3.10.1 | ||
emscripten_emscripten-32-3.1.27-h60d57d3_5.tar.bz2: | ||
build: h60d57d3_5 | ||
build_number: 5 | ||
depends: | ||
- emsdk | ||
md5: 16f2daa96cb33b21c78f3dbc6d83546f | ||
name: emscripten_emscripten-32 | ||
sha256: ab5117990980e5243446c7e83a501cedfc9863c56bbf896e45c77155c84cc3ed | ||
size: 6820 | ||
subdir: linux-64 | ||
timestamp: 1678986155405 | ||
version: 3.1.27 | ||
packages.conda: | ||
cross-python_emscripten-32-3.10.1-h60d57d3_8.conda: | ||
build: h60d57d3_8 | ||
build_number: 8 | ||
depends: | ||
- coreutils | ||
- crossenv >=1.2 | ||
- emscripten_emscripten-32 | ||
- pip | ||
- python 3.10.* | ||
- rsync | ||
- sed | ||
- setuptools | ||
md5: 07b8bdf69566cd63e6e49759033830ad | ||
name: cross-python_emscripten-32 | ||
purls: | ||
- "pkg:pypi/[email protected]" | ||
sha256: 12064d294599734090b9a33a2194a94f5d3743325d5bae61fab3fa5151acf0f9 | ||
size: 7069 | ||
subdir: linux-64 | ||
timestamp: 1679045249592 | ||
version: 3.10.1 | ||
cross-python_emscripten-32-3.12.1-h60d57d3_8.conda: | ||
build: h60d57d3_8 | ||
build_number: 8 | ||
depends: | ||
- coreutils | ||
- crossenv >=1.2 | ||
- emscripten_emscripten-32 | ||
- pip | ||
- python 3.12.* | ||
- rsync | ||
- sed | ||
- setuptools | ||
md5: 07b8bdf69566cd63e6e49759033830ad | ||
name: cross-python_emscripten-32 | ||
sha256: 12064d294599734090b9a33a2194a94f5d3743325d5bae61fab3fa5151acf0f9 | ||
size: 7069 | ||
subdir: linux-64 | ||
timestamp: 1679045249592 | ||
version: 3.10.1 | ||
repodata_version: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ use crate::{ | |
PackageHashes, PackageName, PipLockedDependency, Platform, RepoDataRecord, TimeMeta, | ||
}; | ||
use fxhash::{FxHashMap, FxHashSet}; | ||
use rattler_conda_types::NamelessMatchSpec; | ||
use rattler_conda_types::{NamelessMatchSpec, PackageUrl}; | ||
use std::collections::HashSet; | ||
use url::Url; | ||
|
||
|
@@ -174,6 +174,7 @@ impl LockedPackagesBuilder { | |
noarch: locked_package.noarch, | ||
size: locked_package.size, | ||
timestamp: locked_package.timestamp, | ||
purls: locked_package.purls, | ||
} | ||
.into(), | ||
}, | ||
|
@@ -248,6 +249,9 @@ pub struct CondaLockedDependencyBuilder { | |
|
||
/// Experimental: The date this entry was created. | ||
pub timestamp: Option<chrono::DateTime<chrono::Utc>>, | ||
|
||
/// Experimental: Defines that the package is an alias for a package from another ecosystem. | ||
pub purls: Vec<PackageUrl>, | ||
} | ||
|
||
impl TryFrom<&RepoDataRecord> for CondaLockedDependencyBuilder { | ||
|
@@ -286,6 +290,7 @@ impl TryFrom<RepoDataRecord> for CondaLockedDependencyBuilder { | |
noarch: record.package_record.noarch, | ||
size: record.package_record.size, | ||
timestamp: record.package_record.timestamp, | ||
purls: record.package_record.purls, | ||
}) | ||
} | ||
} | ||
|
@@ -401,6 +406,12 @@ impl CondaLockedDependencyBuilder { | |
self.timestamp = Some(timestamp); | ||
self | ||
} | ||
|
||
/// Adds a PackageUrl to the package | ||
pub fn add_purl(mut self, purl: PackageUrl) -> Self { | ||
self.purls.push(purl); | ||
self | ||
} | ||
} | ||
|
||
pub struct PipLockedDependencyBuilder { | ||
|
@@ -472,6 +483,9 @@ mod tests { | |
noarch: NoArchType::python(), | ||
size: Some(12000), | ||
timestamp: Some(Utc::now()), | ||
purls: vec![ | ||
"pkg:deb/debian/[email protected]?arch=x86_64".parse().unwrap(), | ||
] | ||
})) | ||
.build().unwrap(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"packages": { | ||
"cross-python_emscripten-32-3.10.1-h60d57d3_8.tar.bz2": { | ||
"purls": [ | ||
"pkg:pypi/[email protected]" | ||
] | ||
} | ||
} | ||
} |