From 1525ad1e6e8ab4959656a6c47a8b978f9a53d616 Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Mon, 8 Jul 2024 18:22:50 +0200 Subject: [PATCH] fix(wasix): Fix incorrect webc version mapping --- .../src/runtime/resolver/backend_source.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/wasix/src/runtime/resolver/backend_source.rs b/lib/wasix/src/runtime/resolver/backend_source.rs index 3456fbb08f6..27aa45dda30 100644 --- a/lib/wasix/src/runtime/resolver/backend_source.rs +++ b/lib/wasix/src/runtime/resolver/backend_source.rs @@ -364,14 +364,12 @@ fn decode_summary( let WebQueryGetPackageVersion { v2: WebQueryGetPackageVersionDistribution { - webc_version: v2_webc_version, pirita_sha256_hash: v2_pirita_sha256_hash, pirita_download_url: v2_pirita_download_url, webc_manifest: v2_manifest, }, v3: WebQueryGetPackageVersionDistribution { - webc_version: v3_webc_version, pirita_sha256_hash: v3_pirita_sha256_hash, pirita_download_url: v3_pirita_download_url, webc_manifest: v3_manifest, @@ -379,17 +377,17 @@ fn decode_summary( .. } = pkg_version; - let (webc_version, pirita_sha256_hash, pirita_download_url, manifest) = + let (version, pirita_sha256_hash, pirita_download_url, manifest) = if preferred_webc_version == webc::Version::V3 { ( - v3_webc_version, + webc::Version::V3, v3_pirita_sha256_hash, v3_pirita_download_url, v3_manifest, ) } else { ( - v2_webc_version, + webc::Version::V2, v2_pirita_sha256_hash, v2_pirita_download_url, v2_manifest, @@ -413,8 +411,6 @@ fn decode_summary( let webc_sha256 = WebcHash::parse_hex(&hash).context("invalid webc sha256 hash in manifest")?; - let version: webc::Version = webc_version.unwrap_or_default().into(); - Ok(PackageSummary { pkg: PackageInfo::from_manifest(id, &manifest, version)?, dist: DistributionInfo { webc, webc_sha256 }, @@ -705,8 +701,6 @@ impl From for webc::Version { #[derive(Debug, serde::Serialize, serde::Deserialize, Clone)] pub struct WebQueryGetPackageVersionDistribution { - #[serde(rename = "webcVersion")] - pub webc_version: Option, #[serde(rename = "piritaDownloadUrl")] pub pirita_download_url: Option, #[serde(rename = "piritaSha256Hash")] @@ -921,12 +915,7 @@ mod tests { name: "wasmer-pack".to_string(), },], entrypoint: Some("wasmer-pack".to_string()), - filesystem: vec![FileSystemMapping { - volume_name: "atom".to_string(), - mount_path: "/".to_string(), - original_path: Some("/".to_string()), - dependency_name: None, - }], + filesystem: vec![], }, dist: DistributionInfo { webc: "https://storage.googleapis.com/wapm-registry-prod/webc/wasmer/wasmer-pack-cli/0.6.0/wasmer-pack-cli-0.6.0.webc"