mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-04-05 11:20:55 +01:00
Merge branch '0.5' into 0.6
Some checks are pending
Debug / Get build version (push) Waiting to run
Debug / Build for linux-x86_64 (push) Blocked by required conditions
Debug / Build for macos-aarch64 (push) Blocked by required conditions
Debug / Build for macos-x86_64 (push) Blocked by required conditions
Debug / Build for windows-x86_64 (push) Blocked by required conditions
Test & Lint / lint (push) Waiting to run
Some checks are pending
Debug / Get build version (push) Waiting to run
Debug / Build for linux-x86_64 (push) Blocked by required conditions
Debug / Build for macos-aarch64 (push) Blocked by required conditions
Debug / Build for macos-x86_64 (push) Blocked by required conditions
Debug / Build for windows-x86_64 (push) Blocked by required conditions
Test & Lint / lint (push) Waiting to run
This commit is contained in:
commit
6cf9f14649
12 changed files with 65 additions and 25 deletions
|
@ -17,6 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Remove unnecessary mutex in Wally package download by @daimond113
|
- Remove unnecessary mutex in Wally package download by @daimond113
|
||||||
- Lazily format error messages by @daimond113
|
- Lazily format error messages by @daimond113
|
||||||
|
|
||||||
|
## [0.5.3] - 2024-12-30
|
||||||
|
### Added
|
||||||
|
- Add meta field in index files to preserve compatibility with potential future changes by @daimond113
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Remove verbosity from release mode logging by @daimond113
|
||||||
|
|
||||||
## [0.5.2] - 2024-12-19
|
## [0.5.2] - 2024-12-19
|
||||||
### Fixed
|
### Fixed
|
||||||
- Change dependency types for removed peer dependencies by @daimond113
|
- Change dependency types for removed peer dependencies by @daimond113
|
||||||
|
@ -117,6 +124,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Asyncify dependency linking by @daimond113
|
- Asyncify dependency linking by @daimond113
|
||||||
- Use `exec` in Unix bin linking to reduce the number of processes by @daimond113
|
- Use `exec` in Unix bin linking to reduce the number of processes by @daimond113
|
||||||
|
|
||||||
|
[0.5.3]: https://github.com/daimond113/pesde/compare/v0.5.2%2Bregistry.0.1.1..v0.5.3%2Bregistry.0.1.2
|
||||||
[0.5.2]: https://github.com/daimond113/pesde/compare/v0.5.1%2Bregistry.0.1.0..v0.5.2%2Bregistry.0.1.1
|
[0.5.2]: https://github.com/daimond113/pesde/compare/v0.5.1%2Bregistry.0.1.0..v0.5.2%2Bregistry.0.1.1
|
||||||
[0.5.1]: https://github.com/daimond113/pesde/compare/v0.5.0%2Bregistry.0.1.0..v0.5.1%2Bregistry.0.1.0
|
[0.5.1]: https://github.com/daimond113/pesde/compare/v0.5.0%2Bregistry.0.1.0..v0.5.1%2Bregistry.0.1.0
|
||||||
[0.5.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0%2Bregistry.0.1.0
|
[0.5.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0%2Bregistry.0.1.0
|
||||||
|
|
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -3655,7 +3655,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pesde"
|
name = "pesde"
|
||||||
version = "0.5.2"
|
version = "0.5.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-compression",
|
"async-compression",
|
||||||
|
@ -3698,7 +3698,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pesde-registry"
|
name = "pesde-registry"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-cors",
|
"actix-cors",
|
||||||
"actix-governor",
|
"actix-governor",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pesde"
|
name = "pesde"
|
||||||
version = "0.5.2"
|
version = "0.5.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["daimond113 <contact@daimond113.com>"]
|
authors = ["daimond113 <contact@daimond113.com>"]
|
||||||
|
|
|
@ -5,8 +5,18 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.1.2]
|
||||||
|
### Changed
|
||||||
|
- Update to pesde lib API changes by @daimond113
|
||||||
|
|
||||||
|
## [0.1.1] - 2024-12-19
|
||||||
|
### Changed
|
||||||
|
- Switch to traccing for logging by @daimond113
|
||||||
|
|
||||||
## [0.1.0] - 2024-12-14
|
## [0.1.0] - 2024-12-14
|
||||||
### Added
|
### Added
|
||||||
- Rewrite registry for pesde v0.5.0 by @daimond113
|
- Rewrite registry for pesde v0.5.0 by @daimond113
|
||||||
|
|
||||||
[0.1.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0
|
[0.1.2]: https://github.com/daimond113/pesde/compare/v0.5.2%2Bregistry.0.1.1..v0.5.3%2Bregistry.0.1.2
|
||||||
|
[0.1.1]: https://github.com/daimond113/pesde/compare/v0.5.1%2Bregistry.0.1.0..v0.5.2%2Bregistry.0.1.1
|
||||||
|
[0.1.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0%2Bregistry.0.1.0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pesde-registry"
|
name = "pesde-registry"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/pesde-pkg/index"
|
repository = "https://github.com/pesde-pkg/index"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub async fn get_package_version(
|
||||||
|
|
||||||
let (scope, name_part) = name.as_str();
|
let (scope, name_part) = name.as_str();
|
||||||
|
|
||||||
let entries: IndexFile = {
|
let file: IndexFile = {
|
||||||
let source = app_state.source.lock().await;
|
let source = app_state.source.lock().await;
|
||||||
let repo = gix::open(source.path(&app_state.project))?;
|
let repo = gix::open(source.path(&app_state.project))?;
|
||||||
let tree = root_tree(&repo)?;
|
let tree = root_tree(&repo)?;
|
||||||
|
@ -84,14 +84,15 @@ pub async fn get_package_version(
|
||||||
|
|
||||||
let Some((v_id, entry, targets)) = ({
|
let Some((v_id, entry, targets)) = ({
|
||||||
let version = match version {
|
let version = match version {
|
||||||
VersionRequest::Latest => match entries.keys().map(|k| k.version()).max() {
|
VersionRequest::Latest => match file.entries.keys().map(|k| k.version()).max() {
|
||||||
Some(latest) => latest.clone(),
|
Some(latest) => latest.clone(),
|
||||||
None => return Ok(HttpResponse::NotFound().finish()),
|
None => return Ok(HttpResponse::NotFound().finish()),
|
||||||
},
|
},
|
||||||
VersionRequest::Specific(version) => version,
|
VersionRequest::Specific(version) => version,
|
||||||
};
|
};
|
||||||
|
|
||||||
let versions = entries
|
let versions = file
|
||||||
|
.entries
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(v_id, _)| *v_id.version() == version);
|
.filter(|(v_id, _)| *v_id.version() == version);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub async fn get_package_versions(
|
||||||
|
|
||||||
let (scope, name_part) = name.as_str();
|
let (scope, name_part) = name.as_str();
|
||||||
|
|
||||||
let versions: IndexFile = {
|
let file: IndexFile = {
|
||||||
let source = app_state.source.lock().await;
|
let source = app_state.source.lock().await;
|
||||||
let repo = gix::open(source.path(&app_state.project))?;
|
let repo = gix::open(source.path(&app_state.project))?;
|
||||||
let tree = root_tree(&repo)?;
|
let tree = root_tree(&repo)?;
|
||||||
|
@ -32,7 +32,7 @@ pub async fn get_package_versions(
|
||||||
|
|
||||||
let mut responses = BTreeMap::new();
|
let mut responses = BTreeMap::new();
|
||||||
|
|
||||||
for (v_id, entry) in versions {
|
for (v_id, entry) in file.entries {
|
||||||
let info = responses
|
let info = responses
|
||||||
.entry(v_id.version().clone())
|
.entry(v_id.version().clone())
|
||||||
.or_insert_with(|| PackageResponse {
|
.or_insert_with(|| PackageResponse {
|
||||||
|
|
|
@ -377,7 +377,7 @@ pub async fn publish_package(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut entries: IndexFile =
|
let mut file: IndexFile =
|
||||||
toml::de::from_str(&read_file(&gix_tree, [scope, name])?.unwrap_or_default())?;
|
toml::de::from_str(&read_file(&gix_tree, [scope, name])?.unwrap_or_default())?;
|
||||||
|
|
||||||
let new_entry = IndexFileEntry {
|
let new_entry = IndexFileEntry {
|
||||||
|
@ -392,11 +392,12 @@ pub async fn publish_package(
|
||||||
dependencies,
|
dependencies,
|
||||||
};
|
};
|
||||||
|
|
||||||
let this_version = entries
|
let this_version = file
|
||||||
|
.entries
|
||||||
.keys()
|
.keys()
|
||||||
.find(|v_id| *v_id.version() == manifest.version);
|
.find(|v_id| *v_id.version() == manifest.version);
|
||||||
if let Some(this_version) = this_version {
|
if let Some(this_version) = this_version {
|
||||||
let other_entry = entries.get(this_version).unwrap();
|
let other_entry = file.entries.get(this_version).unwrap();
|
||||||
|
|
||||||
// description cannot be different - which one to render in the "Recently published" list?
|
// description cannot be different - which one to render in the "Recently published" list?
|
||||||
// the others cannot be different because what to return from the versions endpoint?
|
// the others cannot be different because what to return from the versions endpoint?
|
||||||
|
@ -412,7 +413,8 @@ pub async fn publish_package(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if entries
|
if file
|
||||||
|
.entries
|
||||||
.insert(
|
.insert(
|
||||||
VersionId::new(manifest.version.clone(), manifest.target.kind()),
|
VersionId::new(manifest.version.clone(), manifest.target.kind()),
|
||||||
new_entry.clone(),
|
new_entry.clone(),
|
||||||
|
@ -428,7 +430,7 @@ pub async fn publish_package(
|
||||||
let reference = repo.find_reference(&refspec)?;
|
let reference = repo.find_reference(&refspec)?;
|
||||||
|
|
||||||
{
|
{
|
||||||
let index_content = toml::to_string(&entries)?;
|
let index_content = toml::to_string(&file)?;
|
||||||
let mut blob_writer = repo.blob_writer(None)?;
|
let mut blob_writer = repo.blob_writer(None)?;
|
||||||
blob_writer.write_all(index_content.as_bytes())?;
|
blob_writer.write_all(index_content.as_bytes())?;
|
||||||
oids.push((name, blob_writer.commit()?));
|
oids.push((name, blob_writer.commit()?));
|
||||||
|
|
|
@ -68,10 +68,11 @@ pub async fn search_packages(
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let (scope, name) = id.as_str();
|
let (scope, name) = id.as_str();
|
||||||
|
|
||||||
let versions: IndexFile =
|
let file: IndexFile =
|
||||||
toml::de::from_str(&read_file(&tree, [scope, name]).unwrap().unwrap()).unwrap();
|
toml::de::from_str(&read_file(&tree, [scope, name]).unwrap().unwrap()).unwrap();
|
||||||
|
|
||||||
let (latest_version, entry) = versions
|
let (latest_version, entry) = file
|
||||||
|
.entries
|
||||||
.iter()
|
.iter()
|
||||||
.max_by_key(|(v_id, _)| v_id.version())
|
.max_by_key(|(v_id, _)| v_id.version())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -79,17 +80,19 @@ pub async fn search_packages(
|
||||||
PackageResponse {
|
PackageResponse {
|
||||||
name: id.to_string(),
|
name: id.to_string(),
|
||||||
version: latest_version.version().to_string(),
|
version: latest_version.version().to_string(),
|
||||||
targets: versions
|
targets: file
|
||||||
|
.entries
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(v_id, _)| v_id.version() == latest_version.version())
|
.filter(|(v_id, _)| v_id.version() == latest_version.version())
|
||||||
.map(|(_, entry)| (&entry.target).into())
|
.map(|(_, entry)| (&entry.target).into())
|
||||||
.collect(),
|
.collect(),
|
||||||
description: entry.description.clone().unwrap_or_default(),
|
description: entry.description.clone().unwrap_or_default(),
|
||||||
published_at: versions
|
published_at: file
|
||||||
|
.entries
|
||||||
.values()
|
.values()
|
||||||
.max_by_key(|entry| entry.published_at)
|
.map(|entry| entry.published_at)
|
||||||
.unwrap()
|
.max()
|
||||||
.published_at,
|
.unwrap(),
|
||||||
license: entry.license.clone().unwrap_or_default(),
|
license: entry.license.clone().unwrap_or_default(),
|
||||||
authors: entry.authors.clone(),
|
authors: entry.authors.clone(),
|
||||||
repository: entry.repository.clone().map(|url| url.to_string()),
|
repository: entry.repository.clone().map(|url| url.to_string()),
|
||||||
|
|
|
@ -104,7 +104,7 @@ pub async fn make_search(
|
||||||
pin!(stream);
|
pin!(stream);
|
||||||
|
|
||||||
while let Some((pkg_name, mut file)) = stream.next().await {
|
while let Some((pkg_name, mut file)) = stream.next().await {
|
||||||
let Some((_, latest_entry)) = file.pop_last() else {
|
let Some((_, latest_entry)) = file.entries.pop_last() else {
|
||||||
tracing::error!("no versions found for {pkg_name}");
|
tracing::error!("no versions found for {pkg_name}");
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,7 +134,7 @@ impl PackageSource for PesdePackageSource {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let entries: IndexFile = toml::from_str(&string)
|
let IndexFile { entries, .. } = toml::from_str(&string)
|
||||||
.map_err(|e| Self::ResolveError::Parse(specifier.name.to_string(), e))?;
|
.map_err(|e| Self::ResolveError::Parse(specifier.name.to_string(), e))?;
|
||||||
|
|
||||||
tracing::debug!("{} has {} possible entries", specifier.name, entries.len());
|
tracing::debug!("{} has {} possible entries", specifier.name, entries.len());
|
||||||
|
@ -462,8 +462,20 @@ pub struct IndexFileEntry {
|
||||||
pub dependencies: BTreeMap<String, (DependencySpecifiers, DependencyType)>,
|
pub dependencies: BTreeMap<String, (DependencySpecifiers, DependencyType)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The package metadata in the index file
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
|
||||||
|
pub struct IndexMetadata {}
|
||||||
|
|
||||||
/// The index file for a package
|
/// The index file for a package
|
||||||
pub type IndexFile = BTreeMap<VersionId, IndexFileEntry>;
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
|
||||||
|
pub struct IndexFile {
|
||||||
|
/// Any package-wide metadata
|
||||||
|
#[serde(default, skip_serializing_if = "crate::util::is_default")]
|
||||||
|
pub meta: IndexMetadata,
|
||||||
|
/// The entries in the index file
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub entries: BTreeMap<VersionId, IndexFileEntry>,
|
||||||
|
}
|
||||||
|
|
||||||
/// Errors that can occur when interacting with the pesde package source
|
/// Errors that can occur when interacting with the pesde package source
|
||||||
pub mod errors {
|
pub mod errors {
|
||||||
|
|
|
@ -83,3 +83,7 @@ pub fn deserialize_git_like_url<'de, D: Deserializer<'de>>(
|
||||||
pub fn hash<S: AsRef<[u8]>>(struc: S) -> String {
|
pub fn hash<S: AsRef<[u8]>>(struc: S) -> String {
|
||||||
format!("{:x}", Sha256::digest(struc.as_ref()))
|
format!("{:x}", Sha256::digest(struc.as_ref()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_default<T: Default + Eq>(t: &T) -> bool {
|
||||||
|
t == &T::default()
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue