From 75e7a2ab23aa80f69489a0040559b3f140394e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 8 Jul 2022 13:47:02 +0200 Subject: [PATCH 01/74] Download Distribution information from wapm - Move package / version parsing into a separate function - Add --pirita CLI flag for downloading PiritaFiles - Prepare downloading PiritaFile information in GraphQL --- graphql/schema.graphql | 6 ++ src/commands/install.rs | 108 ++++++++++++++++++++++----------- src/commands/run.rs | 3 + src/dataflow/added_packages.rs | 5 +- src/dataflow/mod.rs | 4 +- 5 files changed, 85 insertions(+), 41 deletions(-) diff --git a/graphql/schema.graphql b/graphql/schema.graphql index 38ff010c..7510aa47 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -258,6 +258,12 @@ type InterfaceVersion implements Node { publishedBy: User! updatedAt: DateTime! version: String! + distribution: Distribution!, +} + +type Distribution { + downloadUrl: String!, + size: Int!, } type InterfaceVersionConnection { diff --git a/src/commands/install.rs b/src/commands/install.rs index 4e672e35..f9da3b9e 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -1,5 +1,6 @@ //! Code pertaining to the `install` subcommand +use crate::dataflow::installed_packages; use crate::graphql::execute_query; use graphql_client::*; @@ -19,6 +20,9 @@ pub struct InstallOpt { /// Install the package(s) globally #[structopt(short = "g", long = "global")] global: bool, + /// Expect the file to be a PiritaFile (experimental flag) + #[structopt(long = "pirita")] + pirita: bool, /// Agree to all prompts. Useful for non-interactive uses. (WARNING: this may cause undesired behavior) #[structopt(long = "force-yes", short = "y")] force_yes: bool, @@ -48,6 +52,8 @@ enum InstallError { InvalidPackageIdentifier { name: String }, #[error("Must supply package names to install command when using --global/-g flag.")] MustSupplyPackagesWithGlobalFlag, + #[error("Cannot combine --global/-g and --pirita flag (--pirita packages are experimental and installed locally for now).")] + CannotCombineGlobalAndPirita, } #[derive(GraphQLQuery)] @@ -71,6 +77,9 @@ mod package_args { /// Run the install command pub fn install(options: InstallOpt) -> anyhow::Result<()> { + if options.pirita { + return install_pirita(options); + } let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); debug_assert!( @@ -91,44 +100,8 @@ pub fn install(options: InstallOpt) -> anyhow::Result<()> { println!("Packages installed to wapm_packages!"); } (_, package_args::SOME_PACKAGES) => { - let mut packages = vec![]; - for name in options.packages { - let name_with_version: Vec<&str> = name.split("@").collect(); - - match &name_with_version[..] { - [package_name, package_version] => { - packages.push((package_name.to_string(), package_version.to_string())); - } - [name] => { - let q = GetPackageQuery::build_query(get_package_query::Variables { - name: name.to_string(), - }); - let response: get_package_query::ResponseData = execute_query(&q)?; - let package = response.package.ok_or(InstallError::PackageNotFound { - name: name.to_string(), - })?; - let last_version = - package - .last_version - .ok_or(InstallError::NoVersionsAvailable { - name: name.to_string(), - })?; - let package_name = package.name.clone(); - let package_version = last_version.version.clone(); - packages.push((package_name, package_version)); - } - _ => { - return Err( - InstallError::InvalidPackageIdentifier { name: name.clone() }.into(), - ); - } - } - } - let installed_packages: Vec<(&str, &str)> = packages - .iter() - .map(|(s1, s2)| (s1.as_str(), s2.as_str())) - .collect(); + let installed_packages = get_packages_with_versions(&options.packages)?; // the install directory will determine which wapm.lock we are updating. For now, we // look in the local directory, or the global install directory @@ -159,3 +132,64 @@ pub fn install(options: InstallOpt) -> anyhow::Result<()> { } Ok(()) } + +fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result> { + let mut packages = vec![]; + for name in package_args { + let name_with_version: Vec<&str> = name.split("@").collect(); + + match &name_with_version[..] { + [package_name, package_version] => { + packages.push((package_name.to_string(), package_version.to_string())); + } + [name] => { + let q = GetPackageQuery::build_query(get_package_query::Variables { + name: name.to_string(), + }); + let response: get_package_query::ResponseData = execute_query(&q)?; + let package = response.package.ok_or(InstallError::PackageNotFound { + name: name.to_string(), + })?; + let last_version = + package + .last_version + .ok_or(InstallError::NoVersionsAvailable { + name: name.to_string(), + })?; + let package_name = package.name.clone(); + let package_version = last_version.version.clone(); + packages.push((package_name, package_version)); + } + _ => { + return Err( + InstallError::InvalidPackageIdentifier { name: name.clone() }.into(), + ); + } + } + } + + Ok(packages + .iter() + .map(|(s1, s2)| (s1.as_str().to_string(), s2.as_str().to_string())) + .collect()) +} + +/// Run the install command with --pirita flags +pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { + let current_directory = crate::config::Config::get_current_dir()?; + let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); + debug_assert!( + _value.is_some(), + "this function should only be called once!" + ); + + if options.global { + return Err(InstallError::CannotCombineGlobalAndPirita.into()); + } + + let installed_packages = get_packages_with_versions(&options.packages)?; + + println!("packages with versions: {:#?}", installed_packages); + + Ok(()) +} \ No newline at end of file diff --git a/src/commands/run.rs b/src/commands/run.rs index 0bb0bea4..e625ef1a 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -19,6 +19,9 @@ use wasm_bus_process::prelude::Command; pub struct RunOpt { /// Command name command: String, + /// Expect the file to be a PiritaFile (experimental flag) + #[structopt(long = "pirita")] + pirita: bool, /// WASI pre-opened directory #[structopt(long = "dir", multiple = true, group = "wasi")] pre_opened_directories: Vec, diff --git a/src/dataflow/added_packages.rs b/src/dataflow/added_packages.rs index b2be7956..6a3af0b5 100644 --- a/src/dataflow/added_packages.rs +++ b/src/dataflow/added_packages.rs @@ -18,9 +18,10 @@ pub struct AddedPackages<'a> { impl<'a> AddedPackages<'a> { /// Extract name and version, parse version as semver, construct registry key, and finally /// normalize the global namespace if using the shorthand e.g. "_/pkg" == pkg - pub fn new_from_str_pairs(added_packages: Vec<(&'a str, &'a str)>) -> Result { + pub fn new_from_str_pairs(added_packages: &'a Vec<(String, String)>) -> Result { let added_packages = added_packages - .into_iter() + .iter() + .map(|(package, version)| (package.as_str(), version.as_str())) .map(Self::extract_name_and_version) .collect::, Error>>()?; let packages = added_packages diff --git a/src/dataflow/mod.rs b/src/dataflow/mod.rs index ed5b3938..7af860f3 100644 --- a/src/dataflow/mod.rs +++ b/src/dataflow/mod.rs @@ -337,13 +337,13 @@ pub fn update_with_manifest>( /// The function that starts lockfile dataflow. This function finds a manifest and a lockfile, /// calculates differences, installs missing dependencies, and finally generates a new lockfile. pub fn update>( - added_packages: Vec<(&str, &str)>, + added_packages: Vec<(String, String)>, removed_packages: Vec<&str>, directory: P, ) -> Result { let directory = directory.as_ref(); let added_packages = - AddedPackages::new_from_str_pairs(added_packages).map_err(Error::AddError)?; + AddedPackages::new_from_str_pairs(&added_packages).map_err(Error::AddError)?; let removed_packages = RemovedPackages::new_from_package_names(removed_packages); let manifest_result = ManifestResult::find_in_directory(&directory); match manifest_result { From 1f2bec4c7e583459c4b67bfd81c70c3a22c22516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 10:35:33 +0200 Subject: [PATCH 02/74] Add asynchronous downloading during PiritaFile installation --- Cargo.lock | 51 +++++++ Cargo.toml | 1 + graphql/queries/get_packages.graphql | 2 + graphql/schema.graphql | 8 +- src/commands/install.rs | 213 ++++++++++++++++++++------- src/dataflow/added_packages.rs | 6 +- src/dataflow/mod.rs | 11 +- src/dataflow/resolved_packages.rs | 2 +- 8 files changed, 234 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8beb0928..97b1f941 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1240,6 +1240,16 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.3.9" @@ -1489,6 +1499,29 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.13", + "smallvec", + "windows-sys", +] + [[package]] name = "pbkdf2" version = "0.6.0" @@ -1911,6 +1944,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "scrypt" version = "0.5.0" @@ -2133,6 +2172,15 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + [[package]] name = "slab" version = "0.4.6" @@ -2382,7 +2430,9 @@ dependencies = [ "mio", "num_cpus", "once_cell", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", "tokio-macros", "winapi", @@ -2721,6 +2771,7 @@ dependencies = [ "tempfile", "thiserror", "time", + "tokio", "toml", "url 2.2.2", "wapm-toml", diff --git a/Cargo.toml b/Cargo.toml index 4e976859..904653c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,6 +48,7 @@ whoami = "1.1.5" atty = "0.2" reqwest = { version = "0.11.0", features = ["native-tls-vendored", "blocking", "json", "gzip","socks","multipart"], optional = true } tar = { version = "0.4" } +tokio = { version = "1.19.2", features = ["full"] } [target.'cfg(target_os = "wasi")'.dependencies] whoami = "0.5" diff --git a/graphql/queries/get_packages.graphql b/graphql/queries/get_packages.graphql index 1c2df347..60459118 100644 --- a/graphql/queries/get_packages.graphql +++ b/graphql/queries/get_packages.graphql @@ -3,8 +3,10 @@ query GetPackagesQuery ($names: [String!]!) { name versions { version + isLastVersion distribution { downloadUrl + piritaDownloadUrl } signature { publicKey { diff --git a/graphql/schema.graphql b/graphql/schema.graphql index 7510aa47..f8213c13 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -258,12 +258,6 @@ type InterfaceVersion implements Node { publishedBy: User! updatedAt: DateTime! version: String! - distribution: Distribution!, -} - -type Distribution { - downloadUrl: String!, - size: Int!, } type InterfaceVersionConnection { @@ -651,6 +645,8 @@ type PackageConnection { type PackageDistribution { downloadUrl: String! size: Int! + piritaDownloadUrl: String + piritaSize: Int } # A Relay edge containing a `Package` and its cursor. diff --git a/src/commands/install.rs b/src/commands/install.rs index f9da3b9e..d3139296 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -1,6 +1,9 @@ //! Code pertaining to the `install` subcommand -use crate::dataflow::installed_packages; +use crate::dataflow::{ + WapmDistribution, + resolved_packages::{get_packages_query, GetPackagesQuery} +}; use crate::graphql::execute_query; use graphql_client::*; @@ -9,7 +12,7 @@ use crate::config::Config; use crate::dataflow; use crate::util; use std::borrow::Cow; -use std::path::Path; +use std::path::{Path, PathBuf}; use structopt::StructOpt; use thiserror::Error; @@ -52,18 +55,10 @@ enum InstallError { InvalidPackageIdentifier { name: String }, #[error("Must supply package names to install command when using --global/-g flag.")] MustSupplyPackagesWithGlobalFlag, - #[error("Cannot combine --global/-g and --pirita flag (--pirita packages are experimental and installed locally for now).")] - CannotCombineGlobalAndPirita, + #[error("Could not find PiritaFile donwload url for package {0}@{1}", name, version)] + NoPiritaFileForPackage { name: String, version: String }, } -#[derive(GraphQLQuery)] -#[graphql( - schema_path = "graphql/schema.graphql", - query_path = "graphql/queries/get_package.graphql", - response_derives = "Debug" -)] -struct GetPackageQuery; - mod global_flag { pub const GLOBAL_INSTALL: bool = true; pub const LOCAL_INSTALL: bool = false; @@ -133,49 +128,69 @@ pub fn install(options: InstallOpt) -> anyhow::Result<()> { Ok(()) } -fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result> { - let mut packages = vec![]; +fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result> { + + let mut result = vec![]; for name in package_args { let name_with_version: Vec<&str> = name.split("@").collect(); - match &name_with_version[..] { - [package_name, package_version] => { - packages.push((package_name.to_string(), package_version.to_string())); - } - [name] => { - let q = GetPackageQuery::build_query(get_package_query::Variables { - name: name.to_string(), - }); - let response: get_package_query::ResponseData = execute_query(&q)?; - let package = response.package.ok_or(InstallError::PackageNotFound { - name: name.to_string(), - })?; - let last_version = - package - .last_version - .ok_or(InstallError::NoVersionsAvailable { - name: name.to_string(), - })?; - let package_name = package.name.clone(); - let package_version = last_version.version.clone(); - packages.push((package_name, package_version)); - } - _ => { - return Err( - InstallError::InvalidPackageIdentifier { name: name.clone() }.into(), - ); + let package_name = match &name_with_version[..] { + [package_name, _] => Some(package_name), + [package_name] => Some(package_name), + _ => None, + }.ok_or(InstallError::InvalidPackageIdentifier { + name: name.clone() + })?; + + let q = GetPackagesQuery::build_query(get_packages_query::Variables { + names: vec![package_name.to_string()], + }); + let all_package_versions: get_packages_query::ResponseData = execute_query(&q)?; + let packages = all_package_versions.package.first().ok_or(InstallError::PackageNotFound { + name: name.to_string(), + })?; + + let versions = packages.iter().flat_map(|packageversion| { + if &packageversion.name != name { + Vec::new() + } else { + packageversion.versions.iter().flat_map(|v| { + v.into_iter() + .filter_map(|v| { + let v = v.as_ref()?; + Some(WapmDistribution { + name: name.clone(), + version: v.version.clone(), + download_url: v.distribution.download_url.clone(), + pirita_download_url: v.distribution.pirita_download_url.clone(), + is_last_version: v.is_last_version, + }) + }) + }).collect() } + }).collect::>(); + + if versions.is_empty() { + return Err(InstallError::NoVersionsAvailable { name: name.to_string() }.into()); } + + let package_to_download = match &name_with_version[..] { + [_, package_version] => versions.iter().find(|p| p.version.as_str() == *package_version), + [_] => versions.iter().find(|p| p.is_last_version), + _ => None + }.ok_or(InstallError::InvalidPackageIdentifier { + name: name.clone() + })?; + + result.push(package_to_download.clone()); } - Ok(packages - .iter() - .map(|(s1, s2)| (s1.as_str().to_string(), s2.as_str().to_string())) - .collect()) + Ok(result) } /// Run the install command with --pirita flags pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { + let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); debug_assert!( @@ -183,13 +198,111 @@ pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { "this function should only be called once!" ); - if options.global { - return Err(InstallError::CannotCombineGlobalAndPirita.into()); - } - let installed_packages = get_packages_with_versions(&options.packages)?; + let install_directory = Path::new(¤t_directory); - println!("packages with versions: {:#?}", installed_packages); + let rt = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap(); - Ok(()) + rt.block_on(async { + for p in installed_packages { + let pirita_url = p.pirita_download_url.ok_or(InstallError::NoPiritaFileForPackage { + name: p.name.clone(), + version: p.version.clone(), + })?; + let file = download_pirita(&p.name, &p.version, &pirita_url, &install_directory).await; + println!("{:#?}", file); + } + Ok(()) + }) +} + +async fn download_pirita(name: &str, version: &str, download_url: &str, directory: &Path) -> Result<(String, PathBuf, String), anyhow::Error> { + use crate::util::{ + get_package_namespace_and_name, + fully_qualified_package_display_name, + create_package_dir, + whoami_distro, + create_temp_dir, + }; + use crate::graphql::VERSION; + #[cfg(not(target_os = "wasi"))] + use crate::proxy; + use crate::dataflow::installed_packages::Error; + use reqwest::{header, ClientBuilder}; + use std::fs::OpenOptions; + use std::io::Write; + + let version = semver::Version::parse(version) + .map_err(|e| anyhow!("Invalid version for package {name:?}: {version:?}: {e}"))?; + + let key = format!("{name}@{version}"); + let (namespace, pkg_name) = get_package_namespace_and_name(name) + .map_err(|e| Error::FailedToParsePackageName(name.to_string(), e.to_string()))?; + + let fully_qualified_package_name: String = + fully_qualified_package_display_name(pkg_name, &version); + let package_dir = create_package_dir(&directory, namespace, &fully_qualified_package_name) + .map_err(|err| Error::IoErrorCreatingDirectory(key.to_string(), err.to_string()))?; + let client = { + + let builder = ClientBuilder::new().gzip(true); + #[cfg(not(target_os = "wasi"))] + let builder = if let Some(proxy) = proxy::maybe_set_up_proxy() + .map_err(|e| Error::IoConnectionError(format!("{}", e)))? + { + builder.proxy(proxy) + } else { + builder + }; + + builder.build().unwrap() + }; + let user_agent = format!( + "wapm/{} {} {}", + VERSION, + whoami::platform(), + whoami_distro(), + ); + let mut response = client + .get(download_url) + .header(header::USER_AGENT, user_agent) + .send() + .await + .map_err(|e| { + let error_message = e.to_string(); + #[cfg(feature = "telemetry")] + { + let e = e.into(); + sentry::integrations::anyhow::capture_anyhow(&e); + } + Error::DownloadError(key.to_string(), error_message) + })?; + + let temp_dir = + create_temp_dir() + .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; + let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); + std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) + .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; + + let temp_tar_gz_path = tmp_dir_path + .join("wapm_package_install") + .join("package.pirita"); + + let mut dest = OpenOptions::new() + .read(true) + .write(true) + .create(true) + .open(&temp_tar_gz_path) + .map_err(|e| Error::IoCopyError(key.to_string(), e.to_string()))?; + + while let Some(chunk) = response.chunk().await? { + println!("writing chunk({}) to file {:?}", chunk.len(), temp_tar_gz_path); + dest.write_all(&chunk)?; + } + + Ok((key, package_dir, download_url.to_string())) } \ No newline at end of file diff --git a/src/dataflow/added_packages.rs b/src/dataflow/added_packages.rs index 6a3af0b5..b184309f 100644 --- a/src/dataflow/added_packages.rs +++ b/src/dataflow/added_packages.rs @@ -3,6 +3,8 @@ use semver::Version; use std::collections::HashSet; use thiserror::Error; +use super::WapmDistribution; + #[derive(Clone, Debug, Error)] pub enum Error { #[error("Package must have version that follows semantic versioning. {0}")] @@ -18,10 +20,10 @@ pub struct AddedPackages<'a> { impl<'a> AddedPackages<'a> { /// Extract name and version, parse version as semver, construct registry key, and finally /// normalize the global namespace if using the shorthand e.g. "_/pkg" == pkg - pub fn new_from_str_pairs(added_packages: &'a Vec<(String, String)>) -> Result { + pub fn new_from_str_pairs(added_packages: &'a Vec) -> Result { let added_packages = added_packages .iter() - .map(|(package, version)| (package.as_str(), version.as_str())) + .map(|w| (w.name.as_str(), w.version.as_str())) .map(Self::extract_name_and_version) .collect::, Error>>()?; let packages = added_packages diff --git a/src/dataflow/mod.rs b/src/dataflow/mod.rs index 7af860f3..482b2415 100644 --- a/src/dataflow/mod.rs +++ b/src/dataflow/mod.rs @@ -64,6 +64,15 @@ pub struct WapmPackageKey<'a> { pub version: Version, } +#[derive(Clone, Debug, Eq, Hash, PartialOrd, PartialEq)] +pub struct WapmDistribution { + pub name: String, + pub version: String, + pub download_url: String, + pub pirita_download_url: Option, + pub is_last_version: bool, +} + /// A range of versions for a package in the wapm.io registry. #[derive(Clone, Debug, Eq, Hash, PartialOrd, PartialEq)] pub struct WapmPackageRange<'a> { @@ -337,7 +346,7 @@ pub fn update_with_manifest>( /// The function that starts lockfile dataflow. This function finds a manifest and a lockfile, /// calculates differences, installs missing dependencies, and finally generates a new lockfile. pub fn update>( - added_packages: Vec<(String, String)>, + added_packages: Vec, removed_packages: Vec<&str>, directory: P, ) -> Result { diff --git a/src/dataflow/resolved_packages.rs b/src/dataflow/resolved_packages.rs index 31dd6b9d..beaa1f9f 100644 --- a/src/dataflow/resolved_packages.rs +++ b/src/dataflow/resolved_packages.rs @@ -16,7 +16,7 @@ use thiserror::Error; query_path = "graphql/queries/get_packages.graphql", response_derives = "Debug" )] -struct GetPackagesQuery; +pub struct GetPackagesQuery; #[derive(Clone, Debug, Error)] pub enum Error { From b60ac8719097e66c74777e804bce6af1611b0201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 11:29:54 +0200 Subject: [PATCH 03/74] Add check to verify that the downloaded file is actually a PiritaFile --- Cargo.lock | 1887 +++++++++++++++++++++++++++++++++++++-- Cargo.toml | 6 + src/commands/install.rs | 42 +- 3 files changed, 1882 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97b1f941..11e27d76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,63 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher", + "opaque-debug", +] + [[package]] name = "ahash" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.6", + "once_cell", + "version_check 0.9.4", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -41,6 +92,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "any_ascii" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e" + [[package]] name = "anyhow" version = "1.0.57" @@ -65,6 +122,15 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term 0.7.0", +] + [[package]] name = "async-compression" version = "0.3.14" @@ -100,6 +166,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -121,6 +196,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + [[package]] name = "base64" version = "0.9.3" @@ -163,12 +244,39 @@ dependencies = [ "serde", ] +[[package]] +name = "bit-set" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "0.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake2b_simd" version = "0.5.11" @@ -192,7 +300,7 @@ dependencies = [ "cfg-if 0.1.10", "constant_time_eq", "crypto-mac 0.8.0", - "digest", + "digest 0.9.0", ] [[package]] @@ -204,6 +312,42 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding", + "cipher", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "blowfish" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b" +dependencies = [ + "byteorder", + "cipher", + "opaque-debug", +] + [[package]] name = "bstr" version = "0.2.17" @@ -222,12 +366,42 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e2c71c44e5bbc64de4ecfac946e05f9bba5cc296ea7bab4d3eda242a3ffa73c" +[[package]] +name = "buffered-reader" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f82920285502602088677aeb65df0909b39c347b38565e553ba0363c242f65" +dependencies = [ + "libc", +] + [[package]] name = "bumpalo" version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +[[package]] +name = "bytecheck" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a31f923c2db9513e4298b72df143e6e655a759b3d6a0966df18f81223fff54f" +dependencies = [ + "bytecheck_derive", + "ptr_meta", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb17c862a905d912174daa27ae002326fff56dc8b8ada50a0a5f0976cb174f0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "byteorder" version = "1.4.3" @@ -240,6 +414,17 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +[[package]] +name = "cast5" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1285caf81ea1f1ece6b24414c521e625ad0ec94d880625c20f2e65d8d3f78823" +dependencies = [ + "byteorder", + "cipher", + "opaque-debug", +] + [[package]] name = "cc" version = "1.0.73" @@ -264,11 +449,13 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "js-sys", "libc", "num-integer", "num-traits", "serde", - "time", + "time 0.1.43", + "wasm-bindgen", "winapi", ] @@ -308,6 +495,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "cmac" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73d4de4f7724e5fe70addfb2bd37c2abd2f95084a429d7773b0b9645499b4272" +dependencies = [ + "crypto-mac 0.10.1", + "dbl", +] + [[package]] name = "colored" version = "1.9.3" @@ -363,6 +560,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "const-oid" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279bc8fc53f788a75c7804af68237d1fce02cde1e275a886a4b320604dc2aeda" + +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -397,6 +606,19 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "corosensei" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" +dependencies = [ + "autocfg 1.1.0", + "cfg-if 1.0.0", + "libc", + "scopeguard", + "windows-sys 0.33.0", +] + [[package]] name = "cpufeatures" version = "0.2.2" @@ -406,6 +628,65 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.82.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.82.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" +dependencies = [ + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-entity", + "gimli", + "log 0.4.17", + "regalloc", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.82.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.82.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" + +[[package]] +name = "cranelift-entity" +version = "0.82.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" + +[[package]] +name = "cranelift-frontend" +version = "0.82.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" +dependencies = [ + "cranelift-codegen", + "log 0.4.17", + "smallvec", + "target-lexicon", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -415,6 +696,41 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" +dependencies = [ + "autocfg 1.1.0", + "cfg-if 1.0.0", + "crossbeam-utils", + "memoffset", + "once_cell", + "scopeguard", +] + [[package]] name = "crossbeam-utils" version = "0.8.8" @@ -425,6 +741,22 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "crypto-mac" version = "0.8.0" @@ -440,6 +772,17 @@ name = "crypto-mac" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "cipher", + "generic-array", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ "generic-array", "subtle", @@ -467,6 +810,71 @@ dependencies = [ "memchr", ] +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "dbl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" +dependencies = [ + "generic-array", +] + [[package]] name = "debugid" version = "0.7.3" @@ -477,6 +885,16 @@ dependencies = [ "uuid", ] +[[package]] +name = "der" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eeb9d92785d1facb50567852ce75d0858630630e7eabea59cf7eb7474051087" +dependencies = [ + "const-oid", + "typenum", +] + [[package]] name = "derivative" version = "2.2.0" @@ -488,6 +906,17 @@ dependencies = [ "syn", ] +[[package]] +name = "des" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b24e7c748888aa2fa8bce21d8c64a52efc810663285315ac7476f7197a982fae" +dependencies = [ + "byteorder", + "cipher", + "opaque-debug", +] + [[package]] name = "dialoguer" version = "0.4.0" @@ -499,6 +928,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + [[package]] name = "digest" version = "0.9.0" @@ -508,6 +943,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", +] + [[package]] name = "dirs" version = "1.0.5" @@ -528,6 +973,16 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.3.7" @@ -539,6 +994,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users 0.4.3", + "winapi", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "doc-comment" version = "0.3.3" @@ -551,12 +1023,90 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea6672d73216c05740850c789368d371ca226dc8104d5f2e30c74252d5d6e5e" +[[package]] +name = "dyn-clone" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140206b78fb2bc3edbcfc9b5ccbd0b30699cfe8d348b8b31b330e47df5291a5a" + +[[package]] +name = "eax" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f76e7a5e594b299a0fa9a99de627530725e341df41376aa342aecb2c5eb76e" +dependencies = [ + "aead", + "cipher", + "cmac", + "ctr", + "subtle", +] + +[[package]] +name = "ecdsa" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34d33b390ab82f2e1481e331dbd0530895640179d2128ef9a79cc690b78d1eba" +dependencies = [ + "der", + "elliptic-curve", + "hmac 0.11.0", + "signature", +] + +[[package]] +name = "ed25519" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand 0.7.3", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "elliptic-curve" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13e9b0c3c4170dcc2a12783746c4205d98e18957f57854251eea3f9750fe005" +dependencies = [ + "bitvec", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.3", + "subtle", + "zeroize", +] + +[[package]] +name = "ena" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" +dependencies = [ + "log 0.4.17", +] + [[package]] name = "encode_unicode" version = "0.3.6" @@ -636,6 +1186,47 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "enum-iterator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "enumset" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "failure" version = "0.1.8" @@ -689,6 +1280,17 @@ dependencies = [ "log 0.4.17", ] +[[package]] +name = "ff" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a4d941a5b7c2a75222e2d44fcdf634a67133d9db31e177ae5ff6ecda852bfe" +dependencies = [ + "bitvec", + "rand_core 0.6.3", + "subtle", +] + [[package]] name = "filetime" version = "0.2.16" @@ -701,6 +1303,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flate2" version = "1.0.24" @@ -763,6 +1371,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + [[package]] name = "futures-channel" version = "0.3.21" @@ -823,6 +1437,15 @@ dependencies = [ "slab", ] +[[package]] +name = "generational-arena" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d3b771574f62d0548cee0ad9057857e9fc25d7a3335f140c84f6acd0bf601" +dependencies = [ + "cfg-if 0.1.10", +] + [[package]] name = "generic-array" version = "0.14.5" @@ -840,8 +1463,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -851,8 +1476,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.10.2+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -860,6 +1487,11 @@ name = "gimli" version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] [[package]] name = "graphql-introspection-query" @@ -922,6 +1554,17 @@ dependencies = [ "syn", ] +[[package]] +name = "group" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b3c1e8b4f1ca07e6605ea1be903a5f6956aec5c8a67fd44d56076631675ed8" +dependencies = [ + "ff", + "rand_core 0.6.3", + "subtle", +] + [[package]] name = "h2" version = "0.3.13" @@ -953,7 +1596,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ - "ahash", + "ahash 0.4.7", ] [[package]] @@ -962,6 +1605,15 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +[[package]] +name = "hashbrown" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022" +dependencies = [ + "ahash 0.7.6", +] + [[package]] name = "hashlink" version = "0.6.0" @@ -1002,7 +1654,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac 0.10.1", - "digest", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", ] [[package]] @@ -1068,7 +1730,7 @@ dependencies = [ "log 0.3.9", "mime 0.2.6", "num_cpus", - "time", + "time 0.1.43", "traitobject", "typeable", "unicase 1.4.2", @@ -1112,6 +1774,22 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "idea" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcdd4b114cf2265123bbdc5d32a39f96a343fbdf141267d2b5232b7e14caacb3" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.1.5" @@ -1140,8 +1818,21 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ - "autocfg", + "autocfg 1.1.0", "hashbrown 0.11.2", + "serde", +] + +[[package]] +name = "indicatif" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" +dependencies = [ + "console 0.15.0", + "lazy_static", + "number_prefix", + "regex", ] [[package]] @@ -1159,6 +1850,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -1180,6 +1880,34 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lalrpop" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30455341b0e18f276fa64540aff54deafb54c589de6aca68659c63dd2d5d823" +dependencies = [ + "ascii-canvas", + "atty", + "bit-set", + "diff", + "ena", + "itertools", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax", + "string_cache", + "term 0.7.0", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf796c978e9b4d983414f4caedc9273aa33ee214c5b887bd55fde84c85d2dc4" + [[package]] name = "language-tags" version = "0.2.2" @@ -1191,6 +1919,9 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin", +] [[package]] name = "leb128" @@ -1211,12 +1942,27 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "lexical-sort" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c09e4591611e231daf4d4c685a66cb0410cc1e502027a20ae55f2bb9e997207a" +dependencies = [ + "any_ascii", +] + [[package]] name = "libc" version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +[[package]] +name = "libm" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" + [[package]] name = "libsqlite3-sys" version = "0.20.1" @@ -1246,7 +1992,7 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ - "autocfg", + "autocfg 1.1.0", "scopeguard", ] @@ -1268,6 +2014,15 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "maplit" version = "1.0.2" @@ -1286,12 +2041,47 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "md-5" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "memsec" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac78937f19a0c7807e45a931eac41f766f210173ec664ec046d58e6d388a5cb" + [[package]] name = "mime" version = "0.2.6" @@ -1362,9 +2152,15 @@ dependencies = [ "libc", "log 0.4.17", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.36.1", ] +[[package]] +name = "more-asserts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" + [[package]] name = "native-tls" version = "0.2.10" @@ -1383,6 +2179,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + [[package]] name = "nom" version = "5.1.2" @@ -1394,13 +2196,54 @@ dependencies = [ "version_check 0.9.4", ] +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d51546d704f52ef14b3c962b5776e53d5b862e5790e40a350d366c209bd7f7a" +dependencies = [ + "autocfg 0.1.8", + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.7.3", + "serde", + "smallvec", + "zeroize", +] + [[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg", + "autocfg 1.1.0", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg 1.1.0", + "num-integer", "num-traits", ] @@ -1410,7 +2253,7 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "autocfg", + "autocfg 1.1.0", ] [[package]] @@ -1423,6 +2266,12 @@ dependencies = [ "libc", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.28.4" @@ -1491,7 +2340,7 @@ version = "0.9.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" dependencies = [ - "autocfg", + "autocfg 1.1.0", "cc", "libc", "openssl-src", @@ -1499,6 +2348,17 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "p256" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f05f5287453297c4c16af5e2b04df8fd2a3008d70f252729650bc6d7ace5844" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.9.9", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1519,9 +2379,15 @@ dependencies = [ "libc", "redox_syscall 0.2.13", "smallvec", - "windows-sys", + "windows-sys 0.36.1", ] +[[package]] +name = "path-clean" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" + [[package]] name = "pbkdf2" version = "0.6.0" @@ -1531,6 +2397,17 @@ dependencies = [ "crypto-mac 0.10.1", ] +[[package]] +name = "pem" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +dependencies = [ + "base64 0.13.0", + "once_cell", + "regex", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -1552,6 +2429,25 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "petgraph" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -1564,6 +2460,25 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pirita" +version = "0.1.0" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10#a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +dependencies = [ + "webc", + "webc-runner", +] + +[[package]] +name = "pkcs8" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9c2f795bc591cb3384cb64082a578b89207ac92bb89c9d98c1ea2ace7cd8110" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.25" @@ -1576,6 +2491,12 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "prettytable-rs" version = "0.8.0" @@ -1586,7 +2507,7 @@ dependencies = [ "csv", "encode_unicode", "lazy_static", - "term", + "term 0.5.2", "unicode-width", ] @@ -1614,6 +2535,12 @@ dependencies = [ "version_check 0.9.4", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + [[package]] name = "proc-macro2" version = "1.0.39" @@ -1623,6 +2550,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "quote" version = "1.0.18" @@ -1632,6 +2579,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + [[package]] name = "rand" version = "0.4.6" @@ -1731,6 +2684,30 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rayon" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +dependencies = [ + "autocfg 1.1.0", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -1777,6 +2754,17 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regalloc" +version = "0.0.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" +dependencies = [ + "log 0.4.17", + "rustc-hash", + "smallvec", +] + [[package]] name = "regex" version = "1.5.6" @@ -1800,13 +2788,34 @@ version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +[[package]] +name = "region" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" +dependencies = [ + "bitflags", + "libc", + "mach", + "winapi", +] + [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "rend" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95" dependencies = [ - "winapi", + "bytecheck", ] [[package]] @@ -1849,6 +2858,43 @@ dependencies = [ "winreg", ] +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "rkyv" +version = "0.7.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" +dependencies = [ + "bytecheck", + "hashbrown 0.12.2", + "indexmap", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "rpassword" version = "5.0.1" @@ -1871,6 +2917,28 @@ dependencies = [ "winapi", ] +[[package]] +name = "rsa" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3648b669b10afeab18972c105e284a7b953a669b0be3514c27f9b17acab2f9cd" +dependencies = [ + "byteorder", + "digest 0.9.0", + "lazy_static", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pem", + "rand 0.7.3", + "sha2 0.9.9", + "simple_asn1", + "subtle", + "thiserror", + "zeroize", +] + [[package]] name = "rusqlite" version = "0.24.2" @@ -1904,15 +2972,36 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver", + "semver 0.11.0", ] +[[package]] +name = "rustversion" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" + [[package]] name = "ryu" version = "1.0.10" @@ -1941,7 +3030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1956,12 +3045,18 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da492dab03f925d977776a0b7233d7b934d6dc2b94faead48928e2e9bacedb9" dependencies = [ - "hmac", + "hmac 0.10.1", "pbkdf2", "salsa20", - "sha2", + "sha2 0.9.9", ] +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + [[package]] name = "security-framework" version = "2.6.1" @@ -1985,16 +3080,31 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser", + "semver-parser 0.10.2", "serde", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "semver-parser" version = "0.10.2" @@ -2051,7 +3161,7 @@ dependencies = [ "lazy_static", "libc", "regex", - "rustc_version", + "rustc_version 0.3.3", "sentry-core", "uname", ] @@ -2094,6 +3204,56 @@ dependencies = [ "uuid", ] +[[package]] +name = "sequoia-openpgp" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee32fced98917f2c03d571658934aadae9b1527133ae9c7ac3cadb9d8252a05" +dependencies = [ + "aes", + "anyhow", + "base64 0.12.3", + "block-modes", + "block-padding", + "blowfish", + "buffered-reader", + "cast5", + "chrono", + "cipher", + "des", + "digest 0.9.0", + "dyn-clone", + "eax", + "ecdsa", + "ed25519-dalek", + "generic-array", + "getrandom 0.2.6", + "idea", + "idna 0.2.3", + "lalrpop", + "lalrpop-util", + "lazy_static", + "libc", + "md-5", + "memsec", + "num-bigint-dig", + "p256", + "rand 0.7.3", + "rand_core 0.6.3", + "regex", + "regex-syntax", + "ripemd160", + "rsa", + "sha-1", + "sha1collisiondetection", + "sha2 0.9.9", + "thiserror", + "twofish", + "typenum", + "x25519-dalek", + "xxhash-rust", +] + [[package]] name = "serde" version = "1.0.137" @@ -2103,6 +3263,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + [[package]] name = "serde_cbor" version = "0.11.2" @@ -2159,19 +3328,68 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + +[[package]] +name = "sha1collisiondetection" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31bf4e9fe5cd8cea8e0887e2e4eb1b4d736ff11b776c8537bf0912a4b381285" +dependencies = [ + "digest 0.9.0", + "generic-array", +] + [[package]] name = "sha2" version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -2181,6 +3399,33 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2807892cfa58e081aa1f1111391c7a0649d4fa127a4ffbe34bcbfb35a1171a4" +dependencies = [ + "digest 0.9.0", + "rand_core 0.6.3", +] + +[[package]] +name = "simple_asn1" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" +dependencies = [ + "chrono", + "num-bigint", + "num-traits", +] + +[[package]] +name = "siphasher" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" + [[package]] name = "slab" version = "0.4.6" @@ -2203,12 +3448,104 @@ dependencies = [ "winapi", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dae7e047abc519c96350e9484a96c6bf1492348af912fd3446dd2dc323f6268" +dependencies = [ + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check 0.9.4", +] + [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version 0.2.3", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "string_cache" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + [[package]] name = "strsim" version = "0.8.0" @@ -2268,6 +3605,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tar" version = "0.4.38" @@ -2290,6 +3633,12 @@ dependencies = [ "xattr", ] +[[package]] +name = "target-lexicon" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" + [[package]] name = "tempdir" version = "0.3.7" @@ -2325,6 +3674,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + [[package]] name = "term_size" version = "0.3.2" @@ -2360,47 +3720,94 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f8d70cd784ed1dc33106a18998d77758d281dc40dc3e6d050cf0f5286683" dependencies = [ - "base64 0.12.3", - "rand 0.7.3", + "base64 0.12.3", + "rand 0.7.3", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi", ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "time" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" dependencies = [ - "unicode-width", + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check 0.9.4", + "winapi", ] [[package]] -name = "thiserror" -version = "1.0.31" +name = "time-macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" dependencies = [ - "thiserror-impl", + "proc-macro-hack", + "time-macros-impl", ] [[package]] -name = "thiserror-impl" -version = "1.0.31" +name = "time-macros-impl" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" dependencies = [ + "proc-macro-hack", "proc-macro2", "quote", + "standback", "syn", ] [[package]] -name = "time" -version = "0.1.43" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" dependencies = [ - "libc", - "winapi", + "crunchy", ] [[package]] @@ -2559,6 +3966,17 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "twofish" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0028f5982f23ecc9a1bc3008ead4c664f843ed5d78acd3d213b99ff50c441bc2" +dependencies = [ + "byteorder", + "cipher", + "opaque-debug", +] + [[package]] name = "typeable" version = "0.1.2" @@ -2749,17 +4167,19 @@ dependencies = [ "getrandom 0.2.6", "graphql_client", "hex", + "indicatif", "lazy_static", "license-exprs", "log 0.4.17", "maplit", "minisign", + "pirita", "prettytable-rs", "regex", "reqwest", "rpassword-wasi", "rusqlite", - "semver", + "semver 0.11.0", "sentry", "serde", "serde_derive", @@ -2770,15 +4190,15 @@ dependencies = [ "tar-wasi", "tempfile", "thiserror", - "time", + "time 0.1.43", "tokio", "toml", "url 2.2.2", - "wapm-toml", + "wapm-toml 0.1.0", "wasm-bus-process", "wasm-bus-reqwest", "wasmer-wasm-interface", - "wasmparser", + "wasmparser 0.51.4", "whoami 0.5.3", "whoami 1.2.1", ] @@ -2788,7 +4208,23 @@ name = "wapm-toml" version = "0.1.0" dependencies = [ "anyhow", - "semver", + "semver 0.11.0", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "serde_yaml", + "thiserror", + "toml", +] + +[[package]] +name = "wapm-toml" +version = "0.1.0" +source = "git+https://github.com/wasmerio/wapm-cli?rev=0cd12a0b09babdfbc9fc9b65a9881b60fef9f2be#0cd12a0b09babdfbc9fc9b65a9881b60fef9f2be" +dependencies = [ + "anyhow", + "semver 0.11.0", "serde", "serde_cbor", "serde_derive", @@ -2960,6 +4396,213 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d49ff958a0d83cacc3dc470ded238af5e1d316dcdc6d74322d2b7b2a438046d" +[[package]] +name = "wasmer" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "cfg-if 1.0.0", + "indexmap", + "js-sys", + "more-asserts", + "target-lexicon", + "thiserror", + "wasm-bindgen", + "wasmer-compiler", + "wasmer-compiler-cranelift", + "wasmer-derive", + "wasmer-types", + "wasmer-vm", + "wat", + "winapi", +] + +[[package]] +name = "wasmer-compiler" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "backtrace", + "cfg-if 1.0.0", + "enum-iterator", + "enumset", + "lazy_static", + "leb128", + "memmap2", + "more-asserts", + "region", + "rkyv", + "rustc-demangle", + "serde", + "serde_bytes", + "smallvec", + "target-lexicon", + "thiserror", + "wasmer-types", + "wasmer-vm", + "wasmparser 0.83.0", + "winapi", +] + +[[package]] +name = "wasmer-compiler-cranelift" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "gimli", + "more-asserts", + "rayon", + "smallvec", + "target-lexicon", + "tracing", + "wasmer-compiler", + "wasmer-types", +] + +[[package]] +name = "wasmer-derive" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmer-emscripten" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "byteorder", + "getrandom 0.2.6", + "lazy_static", + "libc", + "log 0.4.17", + "time 0.2.27", + "wasmer", +] + +[[package]] +name = "wasmer-types" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "enum-iterator", + "indexmap", + "more-asserts", + "rkyv", + "serde", + "serde_bytes", + "thiserror", +] + +[[package]] +name = "wasmer-vbus" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "thiserror", + "tracing", + "wasmer-vfs", +] + +[[package]] +name = "wasmer-vfs" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "libc", + "slab", + "thiserror", + "tracing", +] + +[[package]] +name = "wasmer-vm" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "backtrace", + "cc", + "cfg-if 1.0.0", + "corosensei", + "enum-iterator", + "indexmap", + "lazy_static", + "libc", + "mach", + "memoffset", + "more-asserts", + "region", + "rkyv", + "scopeguard", + "serde", + "thiserror", + "wasmer-types", + "winapi", +] + +[[package]] +name = "wasmer-vnet" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "bytes", + "thiserror", + "tracing", + "wasmer-vfs", +] + +[[package]] +name = "wasmer-wasi" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "bytes", + "cfg-if 1.0.0", + "derivative", + "generational-arena", + "getrandom 0.2.6", + "libc", + "thiserror", + "tracing", + "wasm-bindgen", + "wasmer", + "wasmer-vbus", + "wasmer-vfs", + "wasmer-vnet", + "wasmer-wasi-local-networking", + "wasmer-wasi-types", + "winapi", +] + +[[package]] +name = "wasmer-wasi-local-networking" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "bytes", + "tracing", + "wasmer-vfs", + "wasmer-vnet", +] + +[[package]] +name = "wasmer-wasi-types" +version = "2.3.0" +source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" +dependencies = [ + "byteorder", + "time 0.2.27", + "wasmer-derive", + "wasmer-types", +] + [[package]] name = "wasmer-wasm-interface" version = "0.1.0" @@ -2968,7 +4611,7 @@ dependencies = [ "either", "nom", "serde", - "wasmparser", + "wasmparser 0.51.4", "wat", ] @@ -2978,6 +4621,12 @@ version = "0.51.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" +[[package]] +name = "wasmparser" +version = "0.83.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" + [[package]] name = "wast" version = "41.0.0" @@ -3008,6 +4657,53 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webc" +version = "0.1.0" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10#a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +dependencies = [ + "anyhow", + "base64 0.13.0", + "indexmap", + "leb128", + "lexical-sort", + "memchr", + "memmap2", + "path-clean", + "rand 0.8.5", + "sequoia-openpgp", + "serde", + "serde_cbor", + "serde_json", + "sha2 0.10.2", + "url 2.2.2", +] + +[[package]] +name = "webc-runner" +version = "0.1.0" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10#a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +dependencies = [ + "anyhow", + "futures-util", + "lazy_static", + "libc", + "log 0.4.17", + "regex", + "reqwest", + "serde", + "serde_cbor", + "serde_derive", + "tokio", + "url 2.2.2", + "wapm-toml 0.1.0 (git+https://github.com/wasmerio/wapm-cli?rev=0cd12a0b09babdfbc9fc9b65a9881b60fef9f2be)", + "wasmer", + "wasmer-emscripten", + "wasmer-vfs", + "wasmer-wasi", + "webc", +] + [[package]] name = "whoami" version = "0.5.3" @@ -3046,43 +4742,86 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +dependencies = [ + "windows_aarch64_msvc 0.33.0", + "windows_i686_gnu 0.33.0", + "windows_i686_msvc 0.33.0", + "windows_x86_64_gnu 0.33.0", + "windows_x86_64_msvc 0.33.0", +] + [[package]] name = "windows-sys" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows_aarch64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_i686_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_x86_64_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" @@ -3098,6 +4837,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "x25519-dalek" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2392b6b94a576b4e2bf3c5b2757d63f10ada8020a2e4d08ac849ebcf6ea8e077" +dependencies = [ + "curve25519-dalek", + "rand_core 0.5.1", + "zeroize", +] + [[package]] name = "xattr" version = "0.2.3" @@ -3107,6 +4863,12 @@ dependencies = [ "libc", ] +[[package]] +name = "xxhash-rust" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "074914ea4eec286eb8d1fd745768504f420a1f7b7919185682a4a267bed7d2e7" + [[package]] name = "yaml-rust" version = "0.4.5" @@ -3115,3 +4877,24 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/Cargo.toml b/Cargo.toml index 904653c2..97b4e0af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ wasmparser = "0.51.4" dialoguer = "0.4.0" hex = { version = "0.4", optional = true } blake3 = { version = "0.3.1", optional = true } +indicatif = "0.16.2" [target.'cfg(not(target_os = "wasi"))'.dependencies] whoami = "1.1.5" @@ -58,6 +59,11 @@ getrandom = "0.2.3" tar = { package = "tar-wasi", version = "0.4" } serde_yaml = { version = "^0.8" } +[dependencies.pirita] +git = "ssh://git@github.com/wasmerio/pirita.git" +rev = "a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +features = ["emscripten", "wasi"] + [dev-dependencies] tempfile = "3" diff --git a/src/commands/install.rs b/src/commands/install.rs index d3139296..8514213e 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -234,6 +234,7 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director use reqwest::{header, ClientBuilder}; use std::fs::OpenOptions; use std::io::Write; + use indicatif::{ProgressBar, ProgressStyle}; let version = semver::Version::parse(version) .map_err(|e| anyhow!("Invalid version for package {name:?}: {version:?}: {e}"))?; @@ -281,10 +282,18 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director Error::DownloadError(key.to_string(), error_message) })?; + let total_size: u64 = response + .headers() + .get("Content-Length") + .and_then(|c| c.to_str().ok()?.parse().ok()) + .unwrap_or(u64::MAX); + let temp_dir = create_temp_dir() .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; + let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); + std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; @@ -299,10 +308,41 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director .open(&temp_tar_gz_path) .map_err(|e| Error::IoCopyError(key.to_string(), e.to_string()))?; + let pb = ProgressBar::new(total_size); + pb.set_style( + ProgressStyle::default_bar() + .template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})") + .progress_chars("#>-") + ); + + let mut downloaded = 0_u64; + + if let Some(first_chunk) = response.chunk().await? { + let new = (downloaded + first_chunk.len() as u64).min(total_size); + downloaded = new; + if !pirita::PiritaFile::check_is_pirita_file(&first_chunk) { + pb.finish_and_clear(); + return Err(anyhow!("Error: remote package is not a PiritaFile")); + } + dest.write_all(&first_chunk)?; + pb.set_position(new); + } + while let Some(chunk) = response.chunk().await? { - println!("writing chunk({}) to file {:?}", chunk.len(), temp_tar_gz_path); + let new = (downloaded + chunk.len() as u64).min(total_size); + downloaded = new; dest.write_all(&chunk)?; + pb.set_position(new); } + pb.finish_and_clear(); + + /* + It checks the commands that the pirita file has, and put them into + wapm_packages/.bin folder (so for example, a new python file will be + created in the .bin folder that calls wasmer run + THE_FULL_PATH/python.webc --run-command python + */ + Ok((key, package_dir, download_url.to_string())) } \ No newline at end of file From fff309b744eec81bd922de25285adefc2298a0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 12:21:00 +0200 Subject: [PATCH 04/74] Generate commands for PiritaFile in .bin directory --- Cargo.lock | 34 ++++++++--- Cargo.toml | 7 ++- src/commands/install.rs | 129 ++++++++++++++++++++++++---------------- src/init.rs | 10 ++-- 4 files changed, 115 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 11e27d76..d489e752 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -919,13 +919,13 @@ dependencies = [ [[package]] name = "dialoguer" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "116f66c4e7b19af0d52857aa4ff710cc3b4781d9c16616e31540bc55ec57ba8c" +version = "0.10.1" +source = "git+https://github.com/mitsuhiko/dialoguer#6a8c08ca2ef24cdc9bb0946fe794cbd977b23e7b" dependencies = [ "console 0.15.0", - "lazy_static", + "fuzzy-matcher", "tempfile", + "zeroize", ] [[package]] @@ -1437,6 +1437,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fuzzy-matcher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" +dependencies = [ + "thread_local", +] + [[package]] name = "generational-arena" version = "0.2.8" @@ -2463,7 +2472,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10#a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0573041d5e6b312ca5bd437fe68ff0fc505ba7d4#0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" dependencies = [ "webc", "webc-runner", @@ -3212,7 +3221,7 @@ checksum = "4ee32fced98917f2c03d571658934aadae9b1527133ae9c7ac3cadb9d8252a05" dependencies = [ "aes", "anyhow", - "base64 0.12.3", + "base64 0.13.0", "block-modes", "block-padding", "blowfish", @@ -3753,6 +3762,15 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + [[package]] name = "time" version = "0.1.43" @@ -4660,7 +4678,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10#a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0573041d5e6b312ca5bd437fe68ff0fc505ba7d4#0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" dependencies = [ "anyhow", "base64 0.13.0", @@ -4682,7 +4700,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10#a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0573041d5e6b312ca5bd437fe68ff0fc505ba7d4#0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" dependencies = [ "anyhow", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 97b4e0af..803f06c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,6 @@ url = "2" wapm-toml = { version = "0.1.0", path = "./wapm-toml" } wasmer-wasm-interface = { version = "0.1.0", path = "lib/wasm-interface" } wasmparser = "0.51.4" -dialoguer = "0.4.0" hex = { version = "0.4", optional = true } blake3 = { version = "0.3.1", optional = true } indicatif = "0.16.2" @@ -59,9 +58,13 @@ getrandom = "0.2.3" tar = { package = "tar-wasi", version = "0.4" } serde_yaml = { version = "^0.8" } +[dependencies.dialoguer] +git = "https://github.com/mitsuhiko/dialoguer" +features = ["default", "editor", "fuzzy-select", "history", "password", "completion"] + [dependencies.pirita] git = "ssh://git@github.com/wasmerio/pirita.git" -rev = "a8d9c1a6c6ba999f9037a9b6e3e9f8205fc3bf10" +rev = "0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" features = ["emscripten", "wasi"] [dev-dependencies] diff --git a/src/commands/install.rs b/src/commands/install.rs index 8514213e..c8143906 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -26,6 +26,11 @@ pub struct InstallOpt { /// Expect the file to be a PiritaFile (experimental flag) #[structopt(long = "pirita")] pirita: bool, + /// If packages already exist, the CLI will throw a prompt whether you'd like to + /// re-download the package. This flag disables the prompt and will re-download + /// the file even if it already exists. + #[structopt(long = "nocache")] + nocache: bool, /// Agree to all prompts. Useful for non-interactive uses. (WARNING: this may cause undesired behavior) #[structopt(long = "force-yes", short = "y")] force_yes: bool, @@ -212,14 +217,19 @@ pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { name: p.name.clone(), version: p.version.clone(), })?; - let file = download_pirita(&p.name, &p.version, &pirita_url, &install_directory).await; - println!("{:#?}", file); + download_pirita( + &p.name, + &p.version, + &pirita_url, + &install_directory, + options.nocache || options.force_yes + ).await?; } Ok(()) }) } -async fn download_pirita(name: &str, version: &str, download_url: &str, directory: &Path) -> Result<(String, PathBuf, String), anyhow::Error> { +async fn download_pirita(name: &str, version: &str, download_url: &str, directory: &Path, nocache: bool) -> Result<(String, PathBuf, String), anyhow::Error> { use crate::util::{ get_package_namespace_and_name, fully_qualified_package_display_name, @@ -235,6 +245,7 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director use std::fs::OpenOptions; use std::io::Write; use indicatif::{ProgressBar, ProgressStyle}; + use dialoguer::Confirm; let version = semver::Version::parse(version) .map_err(|e| anyhow!("Invalid version for package {name:?}: {version:?}: {e}"))?; @@ -247,6 +258,8 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director fully_qualified_package_display_name(pkg_name, &version); let package_dir = create_package_dir(&directory, namespace, &fully_qualified_package_name) .map_err(|err| Error::IoErrorCreatingDirectory(key.to_string(), err.to_string()))?; + let target_file_path = package_dir.join("package.pirita"); + let client = { let builder = ClientBuilder::new().gzip(true); @@ -288,61 +301,77 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director .and_then(|c| c.to_str().ok()?.parse().ok()) .unwrap_or(u64::MAX); - let temp_dir = - create_temp_dir() - .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; + if nocache || ( + target_file_path.exists() && + target_file_path.metadata()?.len() == total_size && + Confirm::new() + .with_prompt(format!("The package {key:?} seems to already have been downloaded. Download again? (no)")) + .default(false) + .interact()? + ) { + + let temp_dir = + create_temp_dir() + .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; + + let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); + + std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) + .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; + + let temp_tar_gz_path = tmp_dir_path + .join("wapm_package_install") + .join("package.pirita"); - let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); + let mut dest = OpenOptions::new() + .read(true) + .write(true) + .create(true) + .open(&temp_tar_gz_path) + .map_err(|e| Error::IoCopyError(key.to_string(), e.to_string()))?; - std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) - .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; + let pb = ProgressBar::new(total_size); + pb.set_style( + ProgressStyle::default_bar() + .template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})") + .progress_chars("#>-") + ); - let temp_tar_gz_path = tmp_dir_path - .join("wapm_package_install") - .join("package.pirita"); - - let mut dest = OpenOptions::new() - .read(true) - .write(true) - .create(true) - .open(&temp_tar_gz_path) - .map_err(|e| Error::IoCopyError(key.to_string(), e.to_string()))?; - - let pb = ProgressBar::new(total_size); - pb.set_style( - ProgressStyle::default_bar() - .template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})") - .progress_chars("#>-") - ); - - let mut downloaded = 0_u64; - - if let Some(first_chunk) = response.chunk().await? { - let new = (downloaded + first_chunk.len() as u64).min(total_size); - downloaded = new; - if !pirita::PiritaFile::check_is_pirita_file(&first_chunk) { - pb.finish_and_clear(); - return Err(anyhow!("Error: remote package is not a PiritaFile")); + let mut downloaded = 0_u64; + + if let Some(first_chunk) = response.chunk().await? { + let new = (downloaded + first_chunk.len() as u64).min(total_size); + downloaded = new; + if !pirita::PiritaFile::check_is_pirita_file(&first_chunk) { + pb.finish_and_clear(); + return Err(anyhow!("Error: remote package is not a PiritaFile")); + } + dest.write_all(&first_chunk)?; + pb.set_position(new); } - dest.write_all(&first_chunk)?; - pb.set_position(new); + + while let Some(chunk) = response.chunk().await? { + let new = (downloaded + chunk.len() as u64).min(total_size); + downloaded = new; + dest.write_all(&chunk)?; + pb.set_position(new); + } + + std::fs::rename(&temp_tar_gz_path, &target_file_path)?; + + pb.finish_and_clear(); } - while let Some(chunk) = response.chunk().await? { - let new = (downloaded + chunk.len() as u64).min(total_size); - downloaded = new; - dest.write_all(&chunk)?; - pb.set_position(new); - } + let parsed_file = pirita::PiritaFile::load_mmap(target_file_path.clone()) + .ok_or(anyhow!("Could not parse {key:?} ({target_file_path:?}): not a PiritaFile"))?; - pb.finish_and_clear(); + std::fs::create_dir_all(directory.join("wapm_packages").join(".bin"))?; - /* - It checks the commands that the pirita file has, and put them into - wapm_packages/.bin folder (so for example, a new python file will be - created in the .bin folder that calls wasmer run - THE_FULL_PATH/python.webc --run-command python - */ + for (command_name, command_data) in parsed_file.get_manifest().commands.iter() { + let command = format!("wasmer run --pirita {target_file_path:?} --command {command_name:?}"); + let command_path = directory.join("wapm_packages").join(".bin").join(&command_name); + std::fs::write(&command_path, command.as_bytes())?; + } Ok((key, package_dir, download_url.to_string())) } \ No newline at end of file diff --git a/src/init.rs b/src/init.rs index 1e8fa80e..c36687ab 100644 --- a/src/init.rs +++ b/src/init.rs @@ -5,7 +5,7 @@ use crate::data::manifest::MANIFEST_FILE_NAME; use crate::data::manifest::{Command, CommandV2, Manifest, Module, Package}; use crate::util; -use dialoguer::{Confirmation, Input, Select}; +use dialoguer::{Confirm, Input, Select}; use semver::Version; use std::{ any::Any, @@ -234,8 +234,8 @@ Press ^C at any time to quit." all_commands.extend(module_commands); } - let continue_loop = Confirmation::new() - .with_text("Add more modules with a different runner? (no)") + let continue_loop = Confirm::new() + .with_prompt("Add more modules with a different runner? (no)") .default(false) .interact()?; @@ -272,8 +272,8 @@ Press ^C at any time to quit." ); if force_yes - || Confirmation::new() - .with_text("Is this OK? (yes)") + || Confirm::new() + .with_prompt("Is this OK? (yes)") .default(true) .interact()? { From 29de844ab19c5c77e4ef0cd8bdd8b8d480c3aaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 12:53:31 +0200 Subject: [PATCH 05/74] Run cargo fmt --- src/commands/install.rs | 190 ++++++++++++++++++++++------------------ 1 file changed, 107 insertions(+), 83 deletions(-) diff --git a/src/commands/install.rs b/src/commands/install.rs index c8143906..b092988f 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -1,8 +1,8 @@ //! Code pertaining to the `install` subcommand use crate::dataflow::{ + resolved_packages::{get_packages_query, GetPackagesQuery}, WapmDistribution, - resolved_packages::{get_packages_query, GetPackagesQuery} }; use crate::graphql::execute_query; @@ -60,7 +60,11 @@ enum InstallError { InvalidPackageIdentifier { name: String }, #[error("Must supply package names to install command when using --global/-g flag.")] MustSupplyPackagesWithGlobalFlag, - #[error("Could not find PiritaFile donwload url for package {0}@{1}", name, version)] + #[error( + "Could not find PiritaFile donwload url for package {0}@{1}", + name, + version + )] NoPiritaFileForPackage { name: String, version: String }, } @@ -100,7 +104,6 @@ pub fn install(options: InstallOpt) -> anyhow::Result<()> { println!("Packages installed to wapm_packages!"); } (_, package_args::SOME_PACKAGES) => { - let installed_packages = get_packages_with_versions(&options.packages)?; // the install directory will determine which wapm.lock we are updating. For now, we @@ -134,7 +137,6 @@ pub fn install(options: InstallOpt) -> anyhow::Result<()> { } fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result> { - let mut result = vec![]; for name in package_args { let name_with_version: Vec<&str> = name.split("@").collect(); @@ -143,49 +145,62 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result Some(package_name), [package_name] => Some(package_name), _ => None, - }.ok_or(InstallError::InvalidPackageIdentifier { - name: name.clone() - })?; + } + .ok_or(InstallError::InvalidPackageIdentifier { name: name.clone() })?; let q = GetPackagesQuery::build_query(get_packages_query::Variables { names: vec![package_name.to_string()], }); let all_package_versions: get_packages_query::ResponseData = execute_query(&q)?; - let packages = all_package_versions.package.first().ok_or(InstallError::PackageNotFound { - name: name.to_string(), - })?; - - let versions = packages.iter().flat_map(|packageversion| { - if &packageversion.name != name { - Vec::new() - } else { - packageversion.versions.iter().flat_map(|v| { - v.into_iter() - .filter_map(|v| { - let v = v.as_ref()?; - Some(WapmDistribution { - name: name.clone(), - version: v.version.clone(), - download_url: v.distribution.download_url.clone(), - pirita_download_url: v.distribution.pirita_download_url.clone(), - is_last_version: v.is_last_version, + let packages = + all_package_versions + .package + .first() + .ok_or(InstallError::PackageNotFound { + name: name.to_string(), + })?; + + let versions = packages + .iter() + .flat_map(|packageversion| { + if &packageversion.name != name { + Vec::new() + } else { + packageversion + .versions + .iter() + .flat_map(|v| { + v.into_iter().filter_map(|v| { + let v = v.as_ref()?; + Some(WapmDistribution { + name: name.clone(), + version: v.version.clone(), + download_url: v.distribution.download_url.clone(), + pirita_download_url: v.distribution.pirita_download_url.clone(), + is_last_version: v.is_last_version, + }) + }) }) - }) - }).collect() - } - }).collect::>(); + .collect() + } + }) + .collect::>(); if versions.is_empty() { - return Err(InstallError::NoVersionsAvailable { name: name.to_string() }.into()); + return Err(InstallError::NoVersionsAvailable { + name: name.to_string(), + } + .into()); } let package_to_download = match &name_with_version[..] { - [_, package_version] => versions.iter().find(|p| p.version.as_str() == *package_version), + [_, package_version] => versions + .iter() + .find(|p| p.version.as_str() == *package_version), [_] => versions.iter().find(|p| p.is_last_version), - _ => None - }.ok_or(InstallError::InvalidPackageIdentifier { - name: name.clone() - })?; + _ => None, + } + .ok_or(InstallError::InvalidPackageIdentifier { name: name.clone() })?; result.push(package_to_download.clone()); } @@ -195,7 +210,6 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result anyhow::Result<()> { - let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); debug_assert!( @@ -207,52 +221,58 @@ pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { let install_directory = Path::new(¤t_directory); let rt = tokio::runtime::Builder::new_current_thread() - .enable_all() - .build() - .unwrap(); + .enable_all() + .build() + .unwrap(); rt.block_on(async { for p in installed_packages { - let pirita_url = p.pirita_download_url.ok_or(InstallError::NoPiritaFileForPackage { - name: p.name.clone(), - version: p.version.clone(), - })?; + let pirita_url = p + .pirita_download_url + .ok_or(InstallError::NoPiritaFileForPackage { + name: p.name.clone(), + version: p.version.clone(), + })?; download_pirita( - &p.name, - &p.version, - &pirita_url, - &install_directory, - options.nocache || options.force_yes - ).await?; + &p.name, + &p.version, + &pirita_url, + &install_directory, + options.nocache || options.force_yes, + ) + .await?; } Ok(()) }) } -async fn download_pirita(name: &str, version: &str, download_url: &str, directory: &Path, nocache: bool) -> Result<(String, PathBuf, String), anyhow::Error> { - use crate::util::{ - get_package_namespace_and_name, - fully_qualified_package_display_name, - create_package_dir, - whoami_distro, - create_temp_dir, - }; +async fn download_pirita( + name: &str, + version: &str, + download_url: &str, + directory: &Path, + nocache: bool, +) -> Result<(String, PathBuf, String), anyhow::Error> { + use crate::dataflow::installed_packages::Error; use crate::graphql::VERSION; #[cfg(not(target_os = "wasi"))] use crate::proxy; - use crate::dataflow::installed_packages::Error; + use crate::util::{ + create_package_dir, create_temp_dir, fully_qualified_package_display_name, + get_package_namespace_and_name, whoami_distro, + }; + use dialoguer::Confirm; + use indicatif::{ProgressBar, ProgressStyle}; use reqwest::{header, ClientBuilder}; use std::fs::OpenOptions; use std::io::Write; - use indicatif::{ProgressBar, ProgressStyle}; - use dialoguer::Confirm; let version = semver::Version::parse(version) - .map_err(|e| anyhow!("Invalid version for package {name:?}: {version:?}: {e}"))?; - + .map_err(|e| anyhow!("Invalid version for package {name:?}: {version:?}: {e}"))?; + let key = format!("{name}@{version}"); let (namespace, pkg_name) = get_package_namespace_and_name(name) - .map_err(|e| Error::FailedToParsePackageName(name.to_string(), e.to_string()))?; + .map_err(|e| Error::FailedToParsePackageName(name.to_string(), e.to_string()))?; let fully_qualified_package_name: String = fully_qualified_package_display_name(pkg_name, &version); @@ -261,11 +281,10 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director let target_file_path = package_dir.join("package.pirita"); let client = { - let builder = ClientBuilder::new().gzip(true); #[cfg(not(target_os = "wasi"))] - let builder = if let Some(proxy) = proxy::maybe_set_up_proxy() - .map_err(|e| Error::IoConnectionError(format!("{}", e)))? + let builder = if let Some(proxy) = + proxy::maybe_set_up_proxy().map_err(|e| Error::IoConnectionError(format!("{}", e)))? { builder.proxy(proxy) } else { @@ -302,8 +321,8 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director .unwrap_or(u64::MAX); if nocache || ( - target_file_path.exists() && - target_file_path.metadata()?.len() == total_size && + target_file_path.exists() && + target_file_path.metadata()?.len() == total_size && Confirm::new() .with_prompt(format!("The package {key:?} seems to already have been downloaded. Download again? (no)")) .default(false) @@ -313,32 +332,32 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director let temp_dir = create_temp_dir() .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; - + let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); - + std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; - + let temp_tar_gz_path = tmp_dir_path .join("wapm_package_install") .join("package.pirita"); - + let mut dest = OpenOptions::new() .read(true) .write(true) .create(true) .open(&temp_tar_gz_path) .map_err(|e| Error::IoCopyError(key.to_string(), e.to_string()))?; - + let pb = ProgressBar::new(total_size); pb.set_style( ProgressStyle::default_bar() .template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({bytes_per_sec}, {eta})") .progress_chars("#>-") ); - + let mut downloaded = 0_u64; - + if let Some(first_chunk) = response.chunk().await? { let new = (downloaded + first_chunk.len() as u64).min(total_size); downloaded = new; @@ -349,29 +368,34 @@ async fn download_pirita(name: &str, version: &str, download_url: &str, director dest.write_all(&first_chunk)?; pb.set_position(new); } - + while let Some(chunk) = response.chunk().await? { let new = (downloaded + chunk.len() as u64).min(total_size); downloaded = new; dest.write_all(&chunk)?; pb.set_position(new); } - + std::fs::rename(&temp_tar_gz_path, &target_file_path)?; - + pb.finish_and_clear(); } - let parsed_file = pirita::PiritaFile::load_mmap(target_file_path.clone()) - .ok_or(anyhow!("Could not parse {key:?} ({target_file_path:?}): not a PiritaFile"))?; + let parsed_file = pirita::PiritaFile::load_mmap(target_file_path.clone()).ok_or(anyhow!( + "Could not parse {key:?} ({target_file_path:?}): not a PiritaFile" + ))?; std::fs::create_dir_all(directory.join("wapm_packages").join(".bin"))?; for (command_name, command_data) in parsed_file.get_manifest().commands.iter() { - let command = format!("wasmer run --pirita {target_file_path:?} --command {command_name:?}"); - let command_path = directory.join("wapm_packages").join(".bin").join(&command_name); + let command = + format!("wasmer run --pirita {target_file_path:?} --command {command_name:?}"); + let command_path = directory + .join("wapm_packages") + .join(".bin") + .join(&command_name); std::fs::write(&command_path, command.as_bytes())?; } Ok((key, package_dir, download_url.to_string())) -} \ No newline at end of file +} From a239a6a783385dc946ecd73e83bbcfa499c47056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 13:12:20 +0200 Subject: [PATCH 06/74] Remove --pirita flag from RunCommand --- Cargo.lock | 22 ++-------------------- Cargo.toml | 5 +---- src/commands/install.rs | 2 +- src/commands/run.rs | 3 --- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d489e752..de1a6069 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -920,10 +920,10 @@ dependencies = [ [[package]] name = "dialoguer" version = "0.10.1" -source = "git+https://github.com/mitsuhiko/dialoguer#6a8c08ca2ef24cdc9bb0946fe794cbd977b23e7b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c8ae48e400addc32a8710c8d62d55cb84249a7d58ac4cd959daecfbaddc545" dependencies = [ "console 0.15.0", - "fuzzy-matcher", "tempfile", "zeroize", ] @@ -1437,15 +1437,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fuzzy-matcher" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" -dependencies = [ - "thread_local", -] - [[package]] name = "generational-arena" version = "0.2.8" @@ -3762,15 +3753,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - [[package]] name = "time" version = "0.1.43" diff --git a/Cargo.toml b/Cargo.toml index 803f06c0..13841606 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ wasmparser = "0.51.4" hex = { version = "0.4", optional = true } blake3 = { version = "0.3.1", optional = true } indicatif = "0.16.2" +dialoguer = "0.10.1" [target.'cfg(not(target_os = "wasi"))'.dependencies] whoami = "1.1.5" @@ -58,10 +59,6 @@ getrandom = "0.2.3" tar = { package = "tar-wasi", version = "0.4" } serde_yaml = { version = "^0.8" } -[dependencies.dialoguer] -git = "https://github.com/mitsuhiko/dialoguer" -features = ["default", "editor", "fuzzy-select", "history", "password", "completion"] - [dependencies.pirita] git = "ssh://git@github.com/wasmerio/pirita.git" rev = "0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" diff --git a/src/commands/install.rs b/src/commands/install.rs index b092988f..97f9db1a 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -387,7 +387,7 @@ async fn download_pirita( std::fs::create_dir_all(directory.join("wapm_packages").join(".bin"))?; - for (command_name, command_data) in parsed_file.get_manifest().commands.iter() { + for (command_name, _) in parsed_file.get_manifest().commands.iter() { let command = format!("wasmer run --pirita {target_file_path:?} --command {command_name:?}"); let command_path = directory diff --git a/src/commands/run.rs b/src/commands/run.rs index e625ef1a..0bb0bea4 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -19,9 +19,6 @@ use wasm_bus_process::prelude::Command; pub struct RunOpt { /// Command name command: String, - /// Expect the file to be a PiritaFile (experimental flag) - #[structopt(long = "pirita")] - pirita: bool, /// WASI pre-opened directory #[structopt(long = "dir", multiple = true, group = "wasi")] pre_opened_directories: Vec, From eb0877c102fff98bb22b799ef352594fa0ff211e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 13:34:08 +0200 Subject: [PATCH 07/74] Fix bug in wapm-cli adding the wrong parameters to the command --- src/commands/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/install.rs b/src/commands/install.rs index 97f9db1a..64fcde62 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -389,7 +389,7 @@ async fn download_pirita( for (command_name, _) in parsed_file.get_manifest().commands.iter() { let command = - format!("wasmer run --pirita {target_file_path:?} --command {command_name:?}"); + format!("wasmer run {target_file_path:?} --invoke {command_name:?}"); let command_path = directory .join("wapm_packages") .join(".bin") From 4c9f8d503025afcc6eab3f769dcad7b8775d1b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 11 Jul 2022 13:47:09 +0200 Subject: [PATCH 08/74] Use git binary for fetching dependencies in CI --- .github/workflows/main.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 65586259..d07ea806 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -79,7 +79,9 @@ jobs: # that are needed during the build process. Additionally, this works # around a bug in the 'cache' action that causes directories outside of # the workspace dir to be saved/restored incorrectly. - run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV + run: | + echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV + echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV # - name: Install sccache # run: | # echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin" From 46739a7399b92734b85fcc60ab70233ffd1bbf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 12 Jul 2022 13:14:15 +0200 Subject: [PATCH 09/74] Added support for "wapm run [pirita-command]" --- Cargo.lock | 11 ++++++++ Cargo.toml | 1 + src/commands/run.rs | 66 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index de1a6069..b8078e1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3390,6 +3390,16 @@ dependencies = [ "digest 0.10.3", ] +[[package]] +name = "shellwords" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e515aa4699a88148ed5ef96413ceef0048ce95b43fbc955a33bde0a70fcae6" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -4185,6 +4195,7 @@ dependencies = [ "serde_derive", "serde_json", "serde_yaml", + "shellwords", "structopt", "tar", "tar-wasi", diff --git a/Cargo.toml b/Cargo.toml index 13841606..b86b278e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ hex = { version = "0.4", optional = true } blake3 = { version = "0.3.1", optional = true } indicatif = "0.16.2" dialoguer = "0.10.1" +shellwords = "1.1.0" [target.'cfg(not(target_os = "wasi"))'.dependencies] whoami = "1.1.5" diff --git a/src/commands/run.rs b/src/commands/run.rs index 0bb0bea4..2bd042d1 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -27,7 +27,73 @@ pub struct RunOpt { args: Vec, } +#[derive(Debug)] +pub enum PiritaRunError { + Initialize(PiritaInitializeError), + Run(anyhow::Error), +} + +#[derive(Debug)] +pub enum PiritaInitializeError { + CannotGetCurrentDir(std::io::Error), + CouldNotFindCommandInDotBin(std::io::Error), +} + +pub fn try_run_pirita(run_options: &RunOpt) -> Result<(), PiritaRunError> { + + let command_name = run_options.command.as_str(); + let args = &run_options.args; + let current_dir = crate::config::Config::get_current_dir() + .map_err(|e| PiritaRunError::Initialize(PiritaInitializeError::CannotGetCurrentDir(e)))?; + + let cmd = std::fs::read_to_string(current_dir.join("wapm_packages").join(".bin").join(command_name)) + .map_err(|e| PiritaRunError::Initialize(PiritaInitializeError::CouldNotFindCommandInDotBin(e)))?; + + let mut sw = shellwords::split(&cmd) + .map_err(|e| PiritaRunError::Run(e.into()))?; + + if sw.get(0).map(|s| s.as_str()) != Some("wasmer") || sw.get(1).map(|s| s.as_str()) != Some("run") { + return Err(PiritaRunError::Run(anyhow!( + "Expected \"wasmer run\" command in command for {command_name:?}, got: {sw:?}" + ))); + } + + sw.remove(0); + sw.remove(0); + + run_pirita(&sw) + .map_err(|e| PiritaRunError::Run(e)) +} + +fn run_pirita(args: &[String]) -> Result<(), anyhow::Error> { + + let mut command = std::process::Command::new("wasmer"); + + command.arg("run"); + + for arg in args { + command.arg(arg); + } + + let output = command.output()?; + if !output.stderr.is_empty() { + Err(anyhow!("{}", String::from_utf8_lossy(&output.stderr))) + } else if !output.stdout.is_empty() { + println!("{}", String::from_utf8_lossy(&output.stdout)); + Ok(()) + } else { + Ok(()) + } +} + pub fn run(run_options: RunOpt) -> anyhow::Result<()> { + + match try_run_pirita(&run_options) { + Ok(()) => return Ok(()), + Err(PiritaRunError::Initialize(_)) => { }, + Err(PiritaRunError::Run(e)) => return Err(e), + } + let command_name = run_options.command.as_str(); let args = &run_options.args; let current_dir = crate::config::Config::get_current_dir()?; From ee6b90dd6840fc8dead034af0b8799de053d3ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 14 Jul 2022 13:30:29 +0200 Subject: [PATCH 10/74] Add support for "wapm execute [pirita-cmd]" and test "wapm run" --- src/commands/execute.rs | 8 +++ src/commands/install.rs | 5 +- src/commands/run.rs | 108 ++++++++++++++++++---------- src/dataflow/find_command_result.rs | 44 +++++++++--- src/dataflow/mod.rs | 1 + src/dataflow/pirita_packages.rs | 19 +++++ 6 files changed, 134 insertions(+), 51 deletions(-) create mode 100644 src/dataflow/pirita_packages.rs diff --git a/src/commands/execute.rs b/src/commands/execute.rs index e050ea07..fcddae10 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -266,6 +266,10 @@ pub fn execute(opt: ExecuteOpt) -> anyhow::Result<()> { // first search for locally installed command match FindCommandResult::find_command_in_directory(¤t_dir, &command_name) { + FindCommandResult::CommandFoundPirita(cmd) => { + crate::commands::run::try_run_pirita_cmd(&cmd, command_name, &opt.args.as_ref())?; + return Ok(()); + }, FindCommandResult::CommandNotFound(_) => { // go to normal wax flow debug!( @@ -549,6 +553,10 @@ fn run( prehashed_cache_key, ); } + FindCommandResult::CommandFoundPirita(cmd) => { + crate::commands::run::try_run_pirita_cmd(&cmd, command_name, args)?; + return Ok(()); + }, FindCommandResult::Error(e) => return Err(e), }; } diff --git a/src/commands/install.rs b/src/commands/install.rs index 64fcde62..83e902e5 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -23,9 +23,6 @@ pub struct InstallOpt { /// Install the package(s) globally #[structopt(short = "g", long = "global")] global: bool, - /// Expect the file to be a PiritaFile (experimental flag) - #[structopt(long = "pirita")] - pirita: bool, /// If packages already exist, the CLI will throw a prompt whether you'd like to /// re-download the package. This flag disables the prompt and will re-download /// the file even if it already exists. @@ -81,7 +78,7 @@ mod package_args { /// Run the install command pub fn install(options: InstallOpt) -> anyhow::Result<()> { - if options.pirita { + if std::env::var("USE_PIRITA").ok() == Some("1".to_string()) { return install_pirita(options); } let current_directory = crate::config::Config::get_current_dir()?; diff --git a/src/commands/run.rs b/src/commands/run.rs index 2bd042d1..b5984114 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -49,37 +49,55 @@ pub fn try_run_pirita(run_options: &RunOpt) -> Result<(), PiritaRunError> { let cmd = std::fs::read_to_string(current_dir.join("wapm_packages").join(".bin").join(command_name)) .map_err(|e| PiritaRunError::Initialize(PiritaInitializeError::CouldNotFindCommandInDotBin(e)))?; - let mut sw = shellwords::split(&cmd) - .map_err(|e| PiritaRunError::Run(e.into()))?; + try_run_pirita_cmd(&cmd, command_name, args.as_ref()) + .map_err(|e| PiritaRunError::Run(e)) +} + +pub(crate) fn try_run_pirita_cmd(cmd: &str, command_name: &str, args: &[OsString]) -> Result<(), anyhow::Error> { + + let mut sw = shellwords::split(&cmd)?; if sw.get(0).map(|s| s.as_str()) != Some("wasmer") || sw.get(1).map(|s| s.as_str()) != Some("run") { - return Err(PiritaRunError::Run(anyhow!( + return Err(anyhow!( "Expected \"wasmer run\" command in command for {command_name:?}, got: {sw:?}" - ))); + )); } sw.remove(0); sw.remove(0); - run_pirita(&sw) - .map_err(|e| PiritaRunError::Run(e)) + run_pirita(&sw, args) } -fn run_pirita(args: &[String]) -> Result<(), anyhow::Error> { - - let mut command = std::process::Command::new("wasmer"); +fn run_pirita(args: &[String], rt_args: &[OsString]) -> Result<(), anyhow::Error> { + + let (runtime, runtime_args) = get_runtime_with_args(); + let mut command = std::process::Command::new(runtime); + for arg in runtime_args { + command.arg(arg); + } + command.arg("run"); for arg in args { command.arg(arg); } - let output = command.output()?; + for arg in rt_args { + command.arg(arg); + } + + let output = command.spawn()?; + + let output = output + .wait_with_output() + .expect("failed to wait on child"); + if !output.stderr.is_empty() { Err(anyhow!("{}", String::from_utf8_lossy(&output.stderr))) } else if !output.stdout.is_empty() { - println!("{}", String::from_utf8_lossy(&output.stdout)); + println!("{}", String::from_utf8_lossy(&output.stderr)); Ok(()) } else { Ok(()) @@ -106,14 +124,9 @@ pub fn run(run_options: RunOpt) -> anyhow::Result<()> { .map_err(|e| RunError::CannotRegenLockfile(command_name.to_string(), e))?, } - let find_command_result::Command { - source: source_path_buf, - manifest_dir, - args: _, - module_name, - is_global, - prehashed_cache_key, - } = match get_command_from_anywhere(command_name) { + let found_command = get_command_from_anywhere(command_name); + + let command = match found_command { Err(find_command_result::Error::CommandNotFound(command)) => { let package_info = find_command_result::PackageInfoFromCommand::get(command)?; return Err(anyhow!("Command {} not found, but package {} version {} has this command. You can install it with `wapm install {}@{}`", @@ -123,28 +136,45 @@ pub fn run(run_options: RunOpt) -> anyhow::Result<()> { &package_info.namespaced_package_name, &package_info.version, )); - } - otherwise => otherwise?, + }, + Err(e) => { return Err(e.into()); }, + Ok(o) => o, }; - let run_dir = if is_global { - Config::get_globals_directory().unwrap() - } else { - current_dir.clone() - }; - - let manifest_dir = run_dir.join(manifest_dir); - - do_run( - run_dir, - source_path_buf, - manifest_dir, - command_name, - &module_name, - &run_options.pre_opened_directories, - &args, - prehashed_cache_key, - ) + match command { + find_command_result::Command::TarGz(find_command_result::TarGzCommand { + source: source_path_buf, + manifest_dir, + args: _, + module_name, + is_global, + prehashed_cache_key, + }) => { + let run_dir = if is_global { + Config::get_globals_directory().unwrap() + } else { + current_dir.clone() + }; + + let manifest_dir = run_dir.join(manifest_dir); + + do_run( + run_dir, + source_path_buf, + manifest_dir, + command_name, + &module_name, + &run_options.pre_opened_directories, + &args, + prehashed_cache_key, + ) + }, + find_command_result::Command::Pirita(find_command_result::PiritaCommand { + cmd + }) => { + crate::commands::run::try_run_pirita_cmd(&cmd, command_name, args) + } + } } pub(crate) fn do_run( diff --git a/src/dataflow/find_command_result.rs b/src/dataflow/find_command_result.rs index b6221474..7fc75b1a 100644 --- a/src/dataflow/find_command_result.rs +++ b/src/dataflow/find_command_result.rs @@ -3,6 +3,7 @@ use crate::data::lock::lockfile::{Lockfile, LockfileError}; use crate::data::manifest::Manifest; use crate::dataflow::lockfile_packages::LockfileResult; use crate::dataflow::manifest_packages::ManifestResult; +use crate::dataflow::pirita_packages::PiritaResult; use std::path::{Path, PathBuf}; use thiserror::Error; @@ -81,6 +82,7 @@ pub enum FindCommandResult { module_name: String, prehashed_cache_key: Option, }, + CommandFoundPirita(String), Error(anyhow::Error), } @@ -197,8 +199,17 @@ impl FindCommandResult { } pub fn find_command_in_directory>(directory: &Path, command_name: S) -> Self { + + let command_name = command_name.as_ref(); + + let pirita_result = PiritaResult::find_in_directory(&directory, command_name); + if let PiritaResult::Ok(o) = pirita_result { + return FindCommandResult::CommandFoundPirita(o); + } + let manifest_result = ManifestResult::find_in_directory(&directory); let lockfile_result = LockfileResult::find_in_directory(&directory); + match (manifest_result, lockfile_result) { (ManifestResult::ManifestError(e), _) => return FindCommandResult::Error(e.into()), (_, LockfileResult::LockfileError(e)) => return FindCommandResult::Error(e.into()), @@ -219,12 +230,23 @@ impl FindCommandResult { return Self::find_command_in_manifest_and_lockfile(command_name, m, l, directory); } }; - FindCommandResult::CommandNotFound(command_name.as_ref().to_string()) + FindCommandResult::CommandNotFound(command_name.to_string()) } } #[derive(Debug)] -pub struct Command { +pub enum Command { + Pirita(PiritaCommand), + TarGz(TarGzCommand) +} + +#[derive(Debug)] +pub struct PiritaCommand { + pub cmd: String, +} + +#[derive(Debug)] +pub struct TarGzCommand { // PathBuf, Option, String, bool pub source: PathBuf, pub manifest_dir: PathBuf, @@ -253,15 +275,18 @@ pub fn get_command_from_anywhere>(command_name: S) -> Result { - return Ok(Command { + return Ok(Command::TarGz(TarGzCommand { source, manifest_dir, args, module_name, is_global: false, prehashed_cache_key, - }); - } + })); + }, + FindCommandResult::CommandFoundPirita(cmd) => { + return Ok(Command::Pirita(PiritaCommand { cmd })); + }, FindCommandResult::Error(e) => { return Err(Error::ErrorReadingLocalDirectory( command_name.as_ref().to_string(), @@ -287,15 +312,18 @@ pub fn get_command_from_anywhere>(command_name: S) -> Result { - return Ok(Command { + return Ok(Command::TarGz(TarGzCommand { source, manifest_dir, args, module_name, is_global: true, prehashed_cache_key, - }); - } + })); + }, + FindCommandResult::CommandFoundPirita(cmd) => { + return Ok(Command::Pirita(PiritaCommand { cmd })); + }, FindCommandResult::Error(e) => { return Err( Error::CommandNotFoundInLocalDirectoryAndErrorReadingGlobalDirectory( diff --git a/src/dataflow/mod.rs b/src/dataflow/mod.rs index 482b2415..440b9ce8 100644 --- a/src/dataflow/mod.rs +++ b/src/dataflow/mod.rs @@ -26,6 +26,7 @@ pub mod local_package; pub mod lockfile_packages; pub mod manifest_packages; pub mod merged_lockfile_packages; +pub mod pirita_packages; pub mod removed_lockfile_packages; pub mod removed_packages; pub mod resolved_packages; diff --git a/src/dataflow/pirita_packages.rs b/src/dataflow/pirita_packages.rs new file mode 100644 index 00000000..b0b523bf --- /dev/null +++ b/src/dataflow/pirita_packages.rs @@ -0,0 +1,19 @@ +use std::path::Path; +use std::io::Error as IoError; + +/// A ternary for a manifest: Some, None, Error. +#[derive(Debug)] +pub enum PiritaResult { + Ok(String), + Error(IoError) +} + +impl PiritaResult { + pub fn find_in_directory>(directory: P, command: &str) -> Self { + let directory = directory.as_ref(); + match std::fs::read_to_string(directory.join("wapm_packages").join(".bin").join(command)) { + Ok(o) => Self::Ok(o), + Err(e) => Self::Error(e), + } + } +} \ No newline at end of file From 0134b850f20af5b10dbd5b5958351dd64431c957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 15 Jul 2022 10:53:34 +0200 Subject: [PATCH 11/74] Add wapm-resolve-url package to unify GraphQL API across multiple packages This splits the GraphQL code for querying the file URL for downloading a package into a separate crate, so that the code doesn't have to be duplicated across packages. --- src/util.rs | 3 +- wapm-resolve-url/.gitignore | 1 + wapm-resolve-url/Cargo.lock | 2116 +++++++++++++++++ wapm-resolve-url/Cargo.toml | 21 + .../graphql/query-url-of-file-pirita.graphql | 19 + .../graphql/query-url-of-file-targz.graphql | 19 + wapm-resolve-url/graphql/schema.graphql | 1384 +++++++++++ wapm-resolve-url/src/graphql.rs | 91 + wapm-resolve-url/src/lib.rs | 86 + wapm-resolve-url/src/proxy.rs | 58 + 10 files changed, 3797 insertions(+), 1 deletion(-) create mode 100644 wapm-resolve-url/.gitignore create mode 100644 wapm-resolve-url/Cargo.lock create mode 100644 wapm-resolve-url/Cargo.toml create mode 100644 wapm-resolve-url/graphql/query-url-of-file-pirita.graphql create mode 100644 wapm-resolve-url/graphql/query-url-of-file-targz.graphql create mode 100644 wapm-resolve-url/graphql/schema.graphql create mode 100644 wapm-resolve-url/src/graphql.rs create mode 100644 wapm-resolve-url/src/lib.rs create mode 100644 wapm-resolve-url/src/proxy.rs diff --git a/src/util.rs b/src/util.rs index 7950c23d..3e042209 100644 --- a/src/util.rs +++ b/src/util.rs @@ -313,7 +313,8 @@ pub fn create_temp_dir() -> Result { #[cfg(target_os = "wasi")] pub fn create_temp_dir() -> Result { let mut buf = [0u8; 4]; - getrandom::getrandom(&mut buf)?; + getrandom::getrandom(&mut buf) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, format!("{e}")))?; let path = format!("/tmp/{:#10x}", u32::from_be_bytes(buf)); let ret: std::path::PathBuf = path.into(); Ok(ret) diff --git a/wapm-resolve-url/.gitignore b/wapm-resolve-url/.gitignore new file mode 100644 index 00000000..9f970225 --- /dev/null +++ b/wapm-resolve-url/.gitignore @@ -0,0 +1 @@ +target/ \ No newline at end of file diff --git a/wapm-resolve-url/Cargo.lock b/wapm-resolve-url/Cargo.lock new file mode 100644 index 00000000..12ac15c6 --- /dev/null +++ b/wapm-resolve-url/Cargo.lock @@ -0,0 +1,2116 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + +[[package]] +name = "async-compression" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345fd392ab01f746c717b1357165b76f0b67a60192007b234058c9045fdcf695" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" +dependencies = [ + "byteorder", + "safemem", +] + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "buf-read-ext" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e2c71c44e5bbc64de4ecfac946e05f9bba5cc296ea7bab4d3eda242a3ffa73c" + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "combine" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +dependencies = [ + "ascii", + "byteorder", + "either", + "memchr", + "unreachable", +] + +[[package]] +name = "convert_case" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" + +[[package]] +name = "cooked-waker" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147be55d677052dabc6b22252d5dd0fd4c29c8c27aa4f2fbef0f94aa003b406f" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "dummy-waker" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea6672d73216c05740850c789368d371ca226dc8104d5f2e30c74252d5d6e5e" + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +dependencies = [ + "encoding-index-japanese", + "encoding-index-korean", + "encoding-index-simpchinese", + "encoding-index-singlebyte", + "encoding-index-tradchinese", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" + +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "failure" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +dependencies = [ + "backtrace", + "failure_derive", +] + +[[package]] +name = "failure_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + +[[package]] +name = "flate2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding 2.1.0", +] + +[[package]] +name = "formdata" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2e172b694029467db935166c398f911adce5373d63bb1149740cd9182a3eee" +dependencies = [ + "encoding", + "httparse", + "hyper 0.10.16", + "log 0.4.17", + "mime 0.2.6", + "mime_multipart", + "textnonce", +] + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + +[[package]] +name = "futures-channel" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" + +[[package]] +name = "futures-io" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" + +[[package]] +name = "futures-macro" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" + +[[package]] +name = "futures-task" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" + +[[package]] +name = "futures-util" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "typenum", + "version_check 0.9.4", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" + +[[package]] +name = "graphql-introspection-query" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "610aac641dbd2a457ad4cef34aa2827dae3f035fd214cb38c2d62d8543f3973f" +dependencies = [ + "serde", +] + +[[package]] +name = "graphql-parser" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5613c31f18676f164112732202124f373bb2103ff017b3b85ca954ea6a66ada" +dependencies = [ + "combine", + "failure", +] + +[[package]] +name = "graphql_client" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bb4f09181e4f80018d01c612125b07e0156f3753bfac37055fe2a25e031ca8" +dependencies = [ + "doc-comment", + "graphql_query_derive", + "serde", + "serde_json", +] + +[[package]] +name = "graphql_client_codegen" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e304c223c809b3bff4614018f8e6d9edb176b31d64ed9ea48b6ae8b1a03abb9" +dependencies = [ + "failure", + "graphql-introspection-query", + "graphql-parser", + "heck", + "lazy_static", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn", +] + +[[package]] +name = "graphql_query_derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f6b14d5ce549227aa9e649cd9d36d008b91021275a8e0a67d71cef815adc2f" +dependencies = [ + "failure", + "graphql_client_codegen", + "proc-macro2", + "syn", +] + +[[package]] +name = "h2" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.10.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" +dependencies = [ + "base64 0.9.3", + "httparse", + "language-tags", + "log 0.3.9", + "mime 0.2.6", + "num_cpus", + "time", + "traitobject", + "typeable", + "unicase 1.4.2", + "url 1.7.2", +] + +[[package]] +name = "hyper" +version = "0.14.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +dependencies = [ + "http", + "hyper 0.14.20", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.20", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +dependencies = [ + "log 0.4.17", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "mime" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +dependencies = [ + "log 0.3.9", +] + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime 0.3.16", + "unicase 2.6.0", +] + +[[package]] +name = "mime_multipart" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ce67bf6bb7fd272b2b6dad85be2ad1dadeb717e3336beda9470b44feb978c1" +dependencies = [ + "buf-read-ext", + "encoding", + "httparse", + "hyper 0.10.16", + "log 0.4.17", + "mime 0.2.6", + "tempdir", + "textnonce", +] + +[[package]] +name = "miniz_oxide" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +dependencies = [ + "libc", + "log 0.4.17", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +dependencies = [ + "lazy_static", + "libc", + "log 0.4.17", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "openssl" +version = "0.10.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +dependencies = [ + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +dependencies = [ + "async-compression", + "base64 0.13.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper 0.14.20", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log 0.4.17", + "mime 0.3.16", + "mime_guess", + "native-tls", + "percent-encoding 2.1.0", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-socks", + "tokio-util", + "tower-service", + "url 2.2.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rmp" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44519172358fd6d58656c86ab8e7fbc9e1490c3e8f14d35ed78ca0dd07403c9f" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + +[[package]] +name = "rustls" +version = "0.20.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" +dependencies = [ + "log 0.4.17", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" +dependencies = [ + "base64 0.13.0", +] + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys", +] + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-xml-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65162e9059be2f6a3421ebbb4fef3e74b7d9e7c60c50a0e292c6239f19f1edfa" +dependencies = [ + "log 0.4.17", + "serde", + "thiserror", + "xml-rs", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec0091e1f5aa338283ce049bd9dfefd55e1f168ac233e85c1ffe0038fb48cbe" +dependencies = [ + "indexmap", + "ryu", + "serde", + "yaml-rust", +] + +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "slab" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" + +[[package]] +name = "socket2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "tempdir" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +dependencies = [ + "rand 0.4.6", + "remove_dir_all", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "textnonce" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f8d70cd784ed1dc33106a18998d77758d281dc40dc3e6d050cf0f5286683" +dependencies = [ + "base64 0.12.3", + "rand 0.7.3", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57aec3cfa4c296db7255446efb4928a6be304b431a806216105542a67b6ca82e" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "pin-project-lite", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-socks" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0" +dependencies = [ + "either", + "futures-util", + "thiserror", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" +dependencies = [ + "cfg-if", + "log 0.4.17", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" +dependencies = [ + "once_cell", +] + +[[package]] +name = "traitobject" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "typeable" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicase" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" +dependencies = [ + "version_check 0.1.5", +] + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check 0.9.4", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + +[[package]] +name = "unicode-normalization" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "unicode-xid" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +dependencies = [ + "idna 0.1.5", + "matches", + "percent-encoding 1.0.1", +] + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna 0.2.3", + "matches", + "percent-encoding 2.1.0", +] + +[[package]] +name = "urlencoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log 0.4.17", + "try-lock", +] + +[[package]] +name = "wapm-resolve-url" +version = "0.1.0" +dependencies = [ + "anyhow", + "graphql_client", + "reqwest", + "serde", + "serde_json", + "thiserror", + "url 2.2.2", + "wasm-bus-process", + "wasm-bus-reqwest", + "whoami 0.5.3", + "whoami 1.2.1", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasix" +version = "0.11.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3fb76de32c72156fd25fa56776b4ed3d02fcafddfa36d24fac6b135bc7e9bca" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log 0.4.17", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "wasm-bus" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "async-trait", + "base64 0.13.0", + "cooked-waker", + "derivative", + "once_cell", + "serde", + "sha2", + "tokio", + "tracing", + "wasix", + "wasm-bus-macros", + "wasm-bus-types", +] + +[[package]] +name = "wasm-bus-macros" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "convert_case", + "derivative", + "proc-macro2", + "quote", + "syn", + "wasm-bus-types", +] + +[[package]] +name = "wasm-bus-process" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "async-trait", + "bytes", + "dummy-waker", + "serde", + "tokio", + "tracing", + "wasm-bus", +] + +[[package]] +name = "wasm-bus-reqwest" +version = "1.2.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "async-trait", + "bytes", + "formdata", + "futures-core", + "futures-util", + "http", + "http-body", + "mime_guess", + "pin-project-lite", + "serde", + "serde_json", + "tokio", + "tracing", + "url 2.2.2", + "urlencoding", + "wasm-bus", +] + +[[package]] +name = "wasm-bus-types" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "bincode", + "rmp-serde", + "serde", + "serde-xml-rs", + "serde_json", + "serde_yaml", +] + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" +dependencies = [ + "webpki", +] + +[[package]] +name = "whoami" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7154f3f4488071a38189dfd63633df444e7be43b731cc12c41505308fc4972f3" + +[[package]] +name = "whoami" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524b58fa5a20a2fb3014dd6358b70e6579692a56ef6fce928834e488f42f65e8" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] diff --git a/wapm-resolve-url/Cargo.toml b/wapm-resolve-url/Cargo.toml new file mode 100644 index 00000000..1b588429 --- /dev/null +++ b/wapm-resolve-url/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "wapm-resolve-url" +version = "0.1.0" +edition = "2021" + +[dependencies] +url = "2" +graphql_client = "0.9" +serde = { version = "1.0", default-features = false, features = ["derive"] } +thiserror = "1.0" +anyhow = "1.0" +serde_json = "1.0.81" + +[target.'cfg(not(target_os = "wasi"))'.dependencies] +whoami = "1.1.5" +reqwest = { version = "0.11.0", features = ["rustls-tls", "blocking", "json", "gzip","socks", "multipart"] } + +[target.'cfg(target_os = "wasi")'.dependencies] +whoami = "0.5" +wasm-bus-reqwest = { git = "https://github.com/tokera-com/ate", rev = "77b2bca4264e1fcb3d977650c09bb228a782b6f2" } +wasm-bus-process = { git = "https://github.com/tokera-com/ate", rev = "77b2bca4264e1fcb3d977650c09bb228a782b6f2" } diff --git a/wapm-resolve-url/graphql/query-url-of-file-pirita.graphql b/wapm-resolve-url/graphql/query-url-of-file-pirita.graphql new file mode 100644 index 00000000..419e78c1 --- /dev/null +++ b/wapm-resolve-url/graphql/query-url-of-file-pirita.graphql @@ -0,0 +1,19 @@ +# Given a package id (namespace/package), returns all the .webc URLs +# - may fail on older registries +query GetPackageQueryPirita ($name: String!) { + package: getPackage(name:$name) { + name + versions { + version + distribution { + piritaDownloadUrl + } + } + lastVersion { + version + distribution { + piritaDownloadUrl + } + } + } +} \ No newline at end of file diff --git a/wapm-resolve-url/graphql/query-url-of-file-targz.graphql b/wapm-resolve-url/graphql/query-url-of-file-targz.graphql new file mode 100644 index 00000000..159efeb9 --- /dev/null +++ b/wapm-resolve-url/graphql/query-url-of-file-targz.graphql @@ -0,0 +1,19 @@ +# Given a package id (namespace/package), returns all the .tar.gz URLs +# - may fail on older registries +query GetPackageQueryTarGz ($name: String!) { + package: getPackage(name:$name) { + name + versions { + version + distribution { + downloadUrl + } + } + lastVersion { + version + distribution { + downloadUrl + } + } + } +} \ No newline at end of file diff --git a/wapm-resolve-url/graphql/schema.graphql b/wapm-resolve-url/graphql/schema.graphql new file mode 100644 index 00000000..f8213c13 --- /dev/null +++ b/wapm-resolve-url/graphql/schema.graphql @@ -0,0 +1,1384 @@ +type APIToken { + createdAt: DateTime! + id: ID! + identifier: String + lastUsedAt: DateTime + revokedAt: DateTime + user: User! +} + +type APITokenConnection { + # Contains the nodes in this connection. + edges: [APITokenEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `APIToken` and its cursor. +type APITokenEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: APIToken +} + +input AcceptNamespaceCollaboratorInviteInput { + clientMutationId: String + inviteId: ID! +} + +type AcceptNamespaceCollaboratorInvitePayload { + clientMutationId: String + namespaceCollaboratorInvite: NamespaceCollaboratorInvite! +} + +input AcceptPackageCollaboratorInviteInput { + clientMutationId: String + inviteId: ID! +} + +type AcceptPackageCollaboratorInvitePayload { + clientMutationId: String + packageCollaboratorInvite: PackageCollaboratorInvite! +} + +input AcceptPackageTransferRequestInput { + clientMutationId: String + packageTransferRequestId: ID! +} + +type AcceptPackageTransferRequestPayload { + clientMutationId: String + package: Package! + packageTransferRequest: PackageTransferRequest! +} + +type ActivityEvent implements Node { + actorIcon: String! + body: ActivityEventBody! + createdAt: DateTime! + + # The ID of the object + id: ID! +} + +type ActivityEventBody { + ranges: [NodeBodyRange!]! + text: String! +} + +type ActivityEventConnection { + # Contains the nodes in this connection. + edges: [ActivityEventEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `ActivityEvent` and its cursor. +type ActivityEventEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: ActivityEvent +} + +input ArchivePackageInput { + clientMutationId: String + packageId: ID! +} + +type ArchivePackagePayload { + clientMutationId: String + package: Package! +} + +input ChangePackageVersionArchivedStatusInput { + clientMutationId: String + isArchived: Boolean + packageVersionId: ID! +} + +type ChangePackageVersionArchivedStatusPayload { + clientMutationId: String + packageVersion: PackageVersion! +} + +input ChangeUserEmailInput { + clientMutationId: String + newEmail: String! +} + +type ChangeUserEmailPayload { + clientMutationId: String + user: User! +} + +input ChangeUserPasswordInput { + clientMutationId: String + password: String! + + # The token associated to change the password. If not existing it will use the request user by default + token: String +} + +type ChangeUserPasswordPayload { + clientMutationId: String + token: String +} + +input ChangeUserUsernameInput { + clientMutationId: String + + # The new user username + username: String! +} + +type ChangeUserUsernamePayload { + clientMutationId: String + token: String + user: User +} + +input CheckUserExistsInput { + clientMutationId: String + + # The user + user: String! +} + +type CheckUserExistsPayload { + clientMutationId: String + exists: Boolean! + + # The user is only returned if the user input was the username + user: User +} + +type Command { + command: String! + module: PackageVersionModule! + packageVersion: PackageVersion! +} + +input CreateNamespaceInput { + # The namespace avatar + avatar: String + clientMutationId: String + + # The namespace description + description: String + + # The namespace display name + displayName: String + name: String! +} + +type CreateNamespacePayload { + clientMutationId: String + namespace: Namespace! + user: User! +} + +# The `DateTime` scalar type represents a DateTime +# value as specified by +# [iso8601](https://en.wikipedia.org/wiki/ISO_8601). +scalar DateTime + +input DeleteNamespaceInput { + clientMutationId: String + namespaceId: ID! +} + +type DeleteNamespacePayload { + clientMutationId: String + success: Boolean! +} + +type ErrorType { + field: String! + messages: [String!]! +} + +input GenerateAPITokenInput { + clientMutationId: String + identifier: String +} + +type GenerateAPITokenPayload { + clientMutationId: String + token: APIToken + tokenRaw: String + user: User +} + +# The `GenericScalar` scalar type represents a generic +# GraphQL scalar value that could be: +# String, Boolean, Int, Float, List or Object. +scalar GenericScalar + +type GetPasswordResetToken { + user: User + valid: Boolean! +} + +union GlobalObject = Namespace | User + +input InputSignature { + data: String! + publicKeyKeyId: String! +} + +type Interface implements Node { + createdAt: DateTime! + description: String! + displayName: String! + homepage: String + icon: String + + # The ID of the object + id: ID! + lastVersion: InterfaceVersion + name: String! + updatedAt: DateTime! + versions(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): InterfaceVersionConnection! +} + +type InterfaceVersion implements Node { + content: String! + createdAt: DateTime! + + # The ID of the object + id: ID! + interface: Interface! + packageVersions(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): PackageVersionConnection! + publishedBy: User! + updatedAt: DateTime! + version: String! +} + +type InterfaceVersionConnection { + # Contains the nodes in this connection. + edges: [InterfaceVersionEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `InterfaceVersion` and its cursor. +type InterfaceVersionEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: InterfaceVersion +} + +input InviteNamespaceCollaboratorInput { + clientMutationId: String + email: String + namespaceId: ID! + role: Role! + username: String +} + +type InviteNamespaceCollaboratorPayload { + clientMutationId: String + invite: NamespaceCollaboratorInvite! + namespace: Namespace! +} + +input InvitePackageCollaboratorInput { + clientMutationId: String + email: String + packageName: String! + role: Role! + username: String +} + +type InvitePackageCollaboratorPayload { + clientMutationId: String + invite: PackageCollaboratorInvite! + package: Package! +} + +input LikePackageInput { + clientMutationId: String + packageId: ID! +} + +type LikePackagePayload { + clientMutationId: String + package: Package! +} + +interface Likeable { + id: ID! + likersCount: Int! + viewerHasLiked: Boolean! +} + +type Mutation { + acceptNamespaceCollaboratorInvite(input: AcceptNamespaceCollaboratorInviteInput!): AcceptNamespaceCollaboratorInvitePayload + acceptPackageCollaboratorInvite(input: AcceptPackageCollaboratorInviteInput!): AcceptPackageCollaboratorInvitePayload + acceptPackageTransferRequest(input: AcceptPackageTransferRequestInput!): AcceptPackageTransferRequestPayload + archivePackage(input: ArchivePackageInput!): ArchivePackagePayload + changePackageVersionArchivedStatus(input: ChangePackageVersionArchivedStatusInput!): ChangePackageVersionArchivedStatusPayload + changeUserEmail(input: ChangeUserEmailInput!): ChangeUserEmailPayload + changeUserPassword(input: ChangeUserPasswordInput!): ChangeUserPasswordPayload + changeUserUsername(input: ChangeUserUsernameInput!): ChangeUserUsernamePayload + checkUserExists(input: CheckUserExistsInput!): CheckUserExistsPayload + createNamespace(input: CreateNamespaceInput!): CreateNamespacePayload + deleteNamespace(input: DeleteNamespaceInput!): DeleteNamespacePayload + generateApiToken(input: GenerateAPITokenInput!): GenerateAPITokenPayload + inviteNamespaceCollaborator(input: InviteNamespaceCollaboratorInput!): InviteNamespaceCollaboratorPayload + invitePackageCollaborator(input: InvitePackageCollaboratorInput!): InvitePackageCollaboratorPayload + likePackage(input: LikePackageInput!): LikePackagePayload + publishPackage(input: PublishPackageInput!): PublishPackagePayload + publishPublicKey(input: PublishPublicKeyInput!): PublishPublicKeyPayload + readNotification(input: ReadNotificationInput!): ReadNotificationPayload + refreshToken(input: RefreshInput!): RefreshPayload + registerUser(input: RegisterUserInput!): RegisterUserPayload + removeNamespaceCollaborator(input: RemoveNamespaceCollaboratorInput!): RemoveNamespaceCollaboratorPayload + removeNamespaceCollaboratorInvite(input: RemoveNamespaceCollaboratorInviteInput!): RemoveNamespaceCollaboratorInvitePayload + removePackageCollaborator(input: RemovePackageCollaboratorInput!): RemovePackageCollaboratorPayload + removePackageCollaboratorInvite(input: RemovePackageCollaboratorInviteInput!): RemovePackageCollaboratorInvitePayload + removePackageTransferRequest(input: RemovePackageTransferRequestInput!): RemovePackageTransferRequestPayload + requestPackageTransfer(input: RequestPackageTransferInput!): RequestPackageTransferPayload + requestPasswordReset(input: RequestPasswordResetInput!): RequestPasswordResetPayload + requestValidationEmail(input: RequestValidationEmailInput!): RequestValidationEmailPayload + revokeApiToken(input: RevokeAPITokenInput!): RevokeAPITokenPayload + seePendingNotifications(input: SeePendingNotificationsInput!): SeePendingNotificationsPayload + + # Social Auth for JSON Web Token (JWT) + socialAuth(input: SocialAuthJWTInput!): SocialAuthJWTPayload + + # Obtain JSON Web Token mutation + tokenAuth(input: ObtainJSONWebTokenInput!): ObtainJSONWebTokenPayload + unlikePackage(input: UnlikePackageInput!): UnlikePackagePayload + unwatchPackage(input: UnwatchPackageInput!): UnwatchPackagePayload + updateNamespace(input: UpdateNamespaceInput!): UpdateNamespacePayload + updateNamespaceCollaboratorRole(input: UpdateNamespaceCollaboratorRoleInput!): UpdateNamespaceCollaboratorRolePayload + updatePackage(input: UpdatePackageInput!): UpdatePackagePayload + updatePackageCollaboratorRole(input: UpdatePackageCollaboratorRoleInput!): UpdatePackageCollaboratorRolePayload + updateUserInfo(input: UpdateUserInfoInput!): UpdateUserInfoPayload + validateUserEmail(input: ValidateUserEmailInput!): ValidateUserEmailPayload + validateUserPassword(input: ValidateUserPasswordInput!): ValidateUserPasswordPayload + verifyToken(input: VerifyInput!): VerifyPayload + watchPackage(input: WatchPackageInput!): WatchPackagePayload +} + +type Namespace implements Node & PackageOwner { + avatar: String! + avatarUpdatedAt: DateTime + collaborators(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceCollaboratorConnection + createdAt: DateTime! + description: String! + displayName: String + globalName: String! + + # The ID of the object + id: ID! + maintainerInvites: [NamespaceCollaboratorInvite!]! + maintainersWithRoles(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): NamespaceMaintainerConnection! + name: String! + packageVersions(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageVersionConnection + packages(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageConnection + pendingInvites(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceCollaboratorInviteConnection + publicActivity(after: String = null, before: String = null, first: Int = null, last: Int = null): ActivityEventConnection! + updatedAt: DateTime! + userSet(after: String = null, before: String = null, first: Int = null, last: Int = null, offset: Int = null): UserConnection! + viewerHasRole(role: Role!): Boolean! +} + +type NamespaceCollaborator { + createdAt: DateTime! + id: ID! + invite: NamespaceCollaboratorInvite + namespace: Namespace! + role: RegistryNamespaceMaintainerRoleChoices! + updatedAt: DateTime! + user: User! +} + +type NamespaceCollaboratorConnection { + # Contains the nodes in this connection. + edges: [NamespaceCollaboratorEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `NamespaceCollaborator` and its cursor. +type NamespaceCollaboratorEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: NamespaceCollaborator +} + +type NamespaceCollaboratorInvite { + accepted: NamespaceMaintainer + approvedBy: User + closedAt: DateTime + createdAt: DateTime! + declinedBy: User + expiresAt: DateTime! + id: ID! + inviteEmail: String + namespace: Namespace! + requestedBy: User! + role: RegistryNamespaceMaintainerInviteRoleChoices! + user: User +} + +type NamespaceCollaboratorInviteConnection { + # Contains the nodes in this connection. + edges: [NamespaceCollaboratorInviteEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `NamespaceCollaboratorInvite` and its cursor. +type NamespaceCollaboratorInviteEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: NamespaceCollaboratorInvite +} + +type NamespaceConnection { + # Contains the nodes in this connection. + edges: [NamespaceEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `Namespace` and its cursor. +type NamespaceEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: Namespace +} + +type NamespaceMaintainer implements Node { + createdAt: DateTime! + + # The ID of the object + id: ID! + invite: NamespaceCollaboratorInvite + namespace: Namespace! + role: RegistryNamespaceMaintainerRoleChoices! + updatedAt: DateTime! + user: User! +} + +type NamespaceMaintainerConnection { + # Contains the nodes in this connection. + edges: [NamespaceMaintainerEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `NamespaceMaintainer` and its cursor. +type NamespaceMaintainerEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: NamespaceMaintainer +} + +# An object with an ID +interface Node { + # The ID of the object + id: ID! +} + +type NodeBodyRange { + entity: Node! + length: Int! + offset: Int! +} + +input ObtainJSONWebTokenInput { + clientMutationId: String + password: String! + username: String! +} + +# Obtain JSON Web Token mutation +type ObtainJSONWebTokenPayload { + clientMutationId: String + payload: GenericScalar! + refreshExpiresIn: Int! + refreshToken: String! + token: String! +} + +type Package implements Likeable & Node & PackageOwner { + alias: String + + # The app icon. It should be formatted in the same way as Apple icons + appIcon: String! @deprecated(reason: "Please use icon instead") + collaborators(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageCollaboratorConnection + createdAt: DateTime! + curated: Boolean! + displayName: String! + + # The total number of downloads of the package + downloadsCount: Int + globalName: String! + + # The app icon. It should be formatted in the same way as Apple icons + icon: String! + iconUpdatedAt: DateTime + + # The ID of the object + id: ID! + isTransferring: Boolean! + lastVersion: PackageVersion + likeCount: Int! + likersCount: Int! + maintainers: [User]! @deprecated(reason: "Please use collaborators instead") + name: String! + namespace: String + owner: PackageOwner + ownerObjectId: Int! + + # The name of the package without the owner + packageName: String! + pendingInvites(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageCollaboratorInviteConnection + private: Boolean! + + # The public keys for all the published versions + publicKeys: [PublicKey!]! + updatedAt: DateTime! + versions: [PackageVersion] + viewerHasLiked: Boolean! + viewerHasRole(role: Role!): Boolean! + viewerIsWatching: Boolean! + watchCount: Int! +} + +type PackageCollaborator implements Node { + createdAt: DateTime! + + # The ID of the object + id: ID! + invite: PackageCollaboratorInvite + package: Package! + role: RegistryPackageMaintainerRoleChoices! + updatedAt: DateTime! + user: User! +} + +type PackageCollaboratorConnection { + # Contains the nodes in this connection. + edges: [PackageCollaboratorEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `PackageCollaborator` and its cursor. +type PackageCollaboratorEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: PackageCollaborator +} + +type PackageCollaboratorInvite implements Node { + accepted: PackageCollaborator + approvedBy: User + closedAt: DateTime + createdAt: DateTime! + declinedBy: User + expiresAt: DateTime! + + # The ID of the object + id: ID! + inviteEmail: String + package: Package! + requestedBy: User! + role: RegistryPackageMaintainerInviteRoleChoices! + user: User +} + +type PackageCollaboratorInviteConnection { + # Contains the nodes in this connection. + edges: [PackageCollaboratorInviteEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `PackageCollaboratorInvite` and its cursor. +type PackageCollaboratorInviteEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: PackageCollaboratorInvite +} + +type PackageConnection { + # Contains the nodes in this connection. + edges: [PackageEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +type PackageDistribution { + downloadUrl: String! + size: Int! + piritaDownloadUrl: String + piritaSize: Int +} + +# A Relay edge containing a `Package` and its cursor. +type PackageEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: Package +} + +interface PackageOwner { + globalName: String! +} + +type PackageTransferRequest implements Node { + approvedBy: User + closedAt: DateTime + createdAt: DateTime! + declinedBy: User + expiresAt: DateTime! + + # The ID of the object + id: ID! + newOwnerObjectId: Int! + package: Package! + previousOwnerObjectId: Int! + requestedBy: User! +} + +type PackageTransferRequestConnection { + # Contains the nodes in this connection. + edges: [PackageTransferRequestEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `PackageTransferRequest` and its cursor. +type PackageTransferRequestEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: PackageTransferRequest +} + +type PackageVersion implements Node { + commands: [Command!]! + createdAt: DateTime! + description: String! + distribution: PackageDistribution! + file: String! + fileSize: Int! + filesystem: [PackageVersionFilesystem]! + homepage: String + + # The ID of the object + id: ID! + isArchived: Boolean! + isLastVersion: Boolean! + isSigned: Boolean! + license: String + licenseFile: String + manifest: String! + moduleInterfaces: [InterfaceVersion!]! + modules: [PackageVersionModule!]! + package: Package! + publishedBy: User! + readme: String + repository: String + signature: Signature + updatedAt: DateTime! + version: String! +} + +type PackageVersionConnection { + # Contains the nodes in this connection. + edges: [PackageVersionEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `PackageVersion` and its cursor. +type PackageVersionEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: PackageVersion +} + +type PackageVersionFilesystem { + host: String! + wasm: String! +} + +type PackageVersionModule { + abi: String + name: String! + publicUrl: String! + source: String! +} + +# The Relay compliant `PageInfo` type, containing data necessary to paginate this connection. +type PageInfo { + # When paginating forwards, the cursor to continue. + endCursor: String + + # When paginating forwards, are there more items? + hasNextPage: Boolean! + + # When paginating backwards, are there more items? + hasPreviousPage: Boolean! + + # When paginating backwards, the cursor to continue. + startCursor: String +} + +type PublicKey implements Node { + # The ID of the object + id: ID! + key: String! + keyId: String! + owner: User! + revoked: Boolean! + revokedAt: DateTime + uploadedAt: DateTime! + verifyingSignature: Signature +} + +input PublishPackageInput { + clientMutationId: String + description: String! + file: String + homepage: String + + # The package icon + icon: String + license: String + licenseFile: String + manifest: String! + name: String! + readme: String + repository: String + signature: InputSignature + version: String! +} + +type PublishPackagePayload { + clientMutationId: String + packageVersion: PackageVersion! + success: Boolean! +} + +input PublishPublicKeyInput { + clientMutationId: String + key: String! + keyId: String! + verifyingSignatureId: String +} + +type PublishPublicKeyPayload { + clientMutationId: String + publicKey: PublicKey! + success: Boolean! +} + +type Query { + getCommand(name: String!): Command + getCommands(names: [String!]!): [Command] + getContract(name: String!): Interface @deprecated(reason: "Please use getInterface instead") + getContractVersion(name: String!, version: String = null): InterfaceVersion @deprecated(reason: "Please use getInterfaceVersion instead") + getContracts(names: [String!]!): [Interface]! @deprecated(reason: "Please use getInterfaces instead") + getGlobalObject(slug: String!): GlobalObject + getInterface(name: String!): Interface + getInterfaceVersion(name: String!, version: String = "latest"): InterfaceVersion + getInterfaces(names: [String!]!): [Interface]! + getNamespace(name: String!): Namespace + getPackage(name: String!): Package + getPackageVersion(name: String!, version: String = "latest"): PackageVersion + getPackageVersions(names: [String!]!): [PackageVersion] + getPackages(names: [String!]!): [Package]! + getPasswordResetToken(token: String!): GetPasswordResetToken + getUser(username: String!): User + node( + # The ID of the object + id: ID! + ): Node + packages(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageConnection + recentPackageVersions(after: String = null, before: String = null, curated: Boolean = null, first: Int = null, last: Int = null, offset: Int = null): PackageVersionConnection + search(after: String = null, before: String = null, curated: Boolean = null, first: Int = null, hasBindings: Boolean = null, isStandalone: Boolean = null, kind: [SearchKind!] = null, last: Int = null, orderBy: SearchOrderBy = null, publishDate: SearchPublishDate = null, query: String!, sort: SearchOrderSort = null, withInterfaces: [String!] = null): SearchConnection! + searchAutocomplete(after: String = null, before: String = null, first: Int = null, kind: [SearchKind!] = null, last: Int = null, query: String!): SearchConnection! + viewer: User +} + +input ReadNotificationInput { + clientMutationId: String + notificationId: ID! +} + +type ReadNotificationPayload { + clientMutationId: String + notification: UserNotification +} + +input RefreshInput { + clientMutationId: String + refreshToken: String +} + +type RefreshPayload { + clientMutationId: String + payload: GenericScalar! + refreshExpiresIn: Int! + refreshToken: String! + token: String! +} + +input RegisterUserInput { + clientMutationId: String + email: String! + fullName: String! + password: String! + username: String! +} + +type RegisterUserPayload { + clientMutationId: String + token: String +} + +# An enumeration. +enum RegistryNamespaceMaintainerInviteRoleChoices { + # Admin + ADMIN + + # Editor + EDITOR + + # Viewer + VIEWER +} + +# An enumeration. +enum RegistryNamespaceMaintainerRoleChoices { + # Admin + ADMIN + + # Editor + EDITOR + + # Viewer + VIEWER +} + +# An enumeration. +enum RegistryPackageMaintainerInviteRoleChoices { + # Admin + ADMIN + + # Editor + EDITOR + + # Viewer + VIEWER +} + +# An enumeration. +enum RegistryPackageMaintainerRoleChoices { + # Admin + ADMIN + + # Editor + EDITOR + + # Viewer + VIEWER +} + +input RemoveNamespaceCollaboratorInput { + clientMutationId: String + namespaceCollaboratorId: ID! +} + +input RemoveNamespaceCollaboratorInviteInput { + clientMutationId: String + inviteId: ID! +} + +type RemoveNamespaceCollaboratorInvitePayload { + clientMutationId: String + namespace: Namespace! +} + +type RemoveNamespaceCollaboratorPayload { + clientMutationId: String + namespace: Namespace! +} + +input RemovePackageCollaboratorInput { + clientMutationId: String + packageCollaboratorId: ID! +} + +input RemovePackageCollaboratorInviteInput { + clientMutationId: String + inviteId: ID! +} + +type RemovePackageCollaboratorInvitePayload { + clientMutationId: String + package: Package! +} + +type RemovePackageCollaboratorPayload { + clientMutationId: String + package: Package! +} + +input RemovePackageTransferRequestInput { + clientMutationId: String + packageTransferRequestId: ID! +} + +type RemovePackageTransferRequestPayload { + clientMutationId: String + package: Package! +} + +input RequestPackageTransferInput { + clientMutationId: String + newOwnerId: ID! + packageId: ID! +} + +type RequestPackageTransferPayload { + clientMutationId: String + package: Package! +} + +input RequestPasswordResetInput { + clientMutationId: String + email: String! +} + +type RequestPasswordResetPayload { + clientMutationId: String + email: String! + errors: [ErrorType] +} + +input RequestValidationEmailInput { + clientMutationId: String + + # The user id + userId: ID +} + +type RequestValidationEmailPayload { + clientMutationId: String + success: Boolean! + user: User +} + +input RevokeAPITokenInput { + clientMutationId: String + + # The API token ID + tokenId: ID! +} + +type RevokeAPITokenPayload { + clientMutationId: String + success: Boolean + token: APIToken +} + +enum Role { + ADMIN + EDITOR + VIEWER +} + +type SearchConnection { + # Contains the nodes in this connection. + edges: [SearchEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `Search` and its cursor. +type SearchEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: SearchResult +} + +enum SearchKind { + NAMESPACE + PACKAGE + USER +} + +enum SearchOrderBy { + ALPHABETICALLY + PUBLISHED_DATE + SIZE + TOTAL_DOWNLOADS +} + +enum SearchOrderSort { + ASC + DESC +} + +enum SearchPublishDate { + LAST_DAY + LAST_MONTH + LAST_WEEK + LAST_YEAR +} + +union SearchResult = Namespace | PackageVersion | User + +input SeePendingNotificationsInput { + clientMutationId: String +} + +type SeePendingNotificationsPayload { + clientMutationId: String + success: Boolean +} + +type Signature { + createdAt: DateTime! + data: String! + id: ID! + publicKey: PublicKey! +} + +input SocialAuthJWTInput { + accessToken: String! + clientMutationId: String + provider: String! +} + +# Social Auth for JSON Web Token (JWT) +type SocialAuthJWTPayload { + clientMutationId: String + social: SocialNode + token: String +} + +scalar SocialCamelJSON + +type SocialNode implements Node { + created: DateTime! + extraData: SocialCamelJSON + + # The ID of the object + id: ID! + modified: DateTime! + provider: String! + uid: String! + user: User! +} + +type Subscription { + packageVersionCreated(ownerId: ID = null, publishedBy: ID = null): PackageVersion! + userNotificationCreated(userId: ID!): UserNotificationCreated! +} + +input UnlikePackageInput { + clientMutationId: String + packageId: ID! +} + +type UnlikePackagePayload { + clientMutationId: String + package: Package! +} + +input UnwatchPackageInput { + clientMutationId: String + packageId: ID! +} + +type UnwatchPackagePayload { + clientMutationId: String + package: Package! +} + +input UpdateNamespaceCollaboratorRoleInput { + clientMutationId: String + namespaceCollaboratorId: ID! + role: Role! +} + +type UpdateNamespaceCollaboratorRolePayload { + clientMutationId: String + collaborator: NamespaceCollaborator! +} + +input UpdateNamespaceInput { + # The namespace avatar + avatar: String + clientMutationId: String + + # The namespace description + description: String + + # The namespace display name + displayName: String + + # The namespace slug name + name: String + namespaceId: ID! +} + +type UpdateNamespacePayload { + clientMutationId: String + namespace: Namespace! +} + +input UpdatePackageCollaboratorRoleInput { + clientMutationId: String + packageCollaboratorId: ID! + role: Role! +} + +type UpdatePackageCollaboratorRolePayload { + clientMutationId: String + collaborator: PackageCollaborator! +} + +input UpdatePackageInput { + clientMutationId: String + + # The package icon + icon: String + packageId: ID! +} + +type UpdatePackagePayload { + clientMutationId: String + package: Package! +} + +input UpdateUserInfoInput { + # The user avatar + avatar: String + + # The user bio + bio: String + clientMutationId: String + + # The user full name + fullName: String + + # The user Github (it can be the url, or the handle with or without the @) + github: String + + # The user location + location: String + + # The user Twitter (it can be the url, or the handle with or without the @) + twitter: String + + # The user id + userId: ID + + # The user website (it must be a valid url) + websiteUrl: String +} + +type UpdateUserInfoPayload { + clientMutationId: String + user: User +} + +type User implements Node & PackageOwner { + apiTokens(after: String = null, before: String = null, first: Int = null, last: Int = null): APITokenConnection + avatar(size: Int = 80): String! + bio: String + dateJoined: DateTime! + email: String! + firstName: String! + fullName: String! + githubUrl: String + globalName: String! + + # The ID of the object + id: ID! + isEmailValidated: Boolean! + isViewer: Boolean! + lastName: String! + location: String + namespaceInvitesIncoming(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceCollaboratorInviteConnection + namespaces(after: String = null, before: String = null, first: Int = null, last: Int = null): NamespaceConnection + notifications(after: String = null, before: String = null, first: Int = null, last: Int = null): UserNotificationConnection + packageInvitesIncoming(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageCollaboratorInviteConnection + packageTransfersIncoming(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageTransferRequestConnection + packageVersions(after: String = null, before: String = null, first: Int = null, last: Int = null): PackageVersionConnection + packages(after: String = null, before: String = null, collaborating: Boolean = null, first: Int = null, last: Int = null): PackageConnection + publicActivity(after: String = null, before: String = null, first: Int = null, last: Int = null): ActivityEventConnection! + twitterUrl: String + + # Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. + username: String! + websiteUrl: String +} + +type UserConnection { + # Contains the nodes in this connection. + edges: [UserEdge]! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +# A Relay edge containing a `User` and its cursor. +type UserEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: User +} + +type UserNotification implements Node { + body: UserNotificationBody! + createdAt: DateTime! + icon: String + + # The ID of the object + id: ID! + kind: UserNotificationKind + seenState: UserNotificationSeenState! +} + +type UserNotificationBody { + ranges: [NodeBodyRange]! + text: String! +} + +type UserNotificationConnection { + # Contains the nodes in this connection. + edges: [UserNotificationEdge]! + hasPendingNotifications: Boolean! + + # Pagination data for this connection. + pageInfo: PageInfo! +} + +type UserNotificationCreated { + notification: UserNotification + notificationDeletedId: ID +} + +# A Relay edge containing a `UserNotification` and its cursor. +type UserNotificationEdge { + # A cursor for use in pagination + cursor: String! + + # The item at the end of the edge + node: UserNotification +} + +union UserNotificationKind = UserNotificationKindIncomingPackageInvite | UserNotificationKindIncomingPackageTransfer | UserNotificationKindPublishedPackageVersion + +type UserNotificationKindIncomingPackageInvite { + packageInvite: PackageCollaboratorInvite! +} + +type UserNotificationKindIncomingPackageTransfer { + packageTransferRequest: PackageTransferRequest! +} + +type UserNotificationKindPublishedPackageVersion { + packageVersion: PackageVersion! +} + +enum UserNotificationSeenState { + SEEN + SEEN_AND_READ + UNSEEN +} + +input ValidateUserEmailInput { + challenge: String! + clientMutationId: String + + # The user id + userId: ID +} + +type ValidateUserEmailPayload { + clientMutationId: String + user: User +} + +input ValidateUserPasswordInput { + clientMutationId: String + password: String! +} + +type ValidateUserPasswordPayload { + clientMutationId: String + success: Boolean +} + +input VerifyInput { + clientMutationId: String + token: String +} + +type VerifyPayload { + clientMutationId: String + payload: GenericScalar! +} + +input WatchPackageInput { + clientMutationId: String + packageId: ID! +} + +type WatchPackagePayload { + clientMutationId: String + package: Package! +} diff --git a/wapm-resolve-url/src/graphql.rs b/wapm-resolve-url/src/graphql.rs new file mode 100644 index 00000000..48cd8cd9 --- /dev/null +++ b/wapm-resolve-url/src/graphql.rs @@ -0,0 +1,91 @@ +use graphql_client::{QueryBody, Response}; +use serde; +use std::env; +use std::string::ToString; +use thiserror::Error; +use crate::whoami_distro; +use url::Url; + +#[cfg(not(target_os = "wasi"))] +use { + crate::proxy, + reqwest::{ + blocking::{multipart::Form, Client}, + header::USER_AGENT, + }, +}; +#[cfg(target_os = "wasi")] +use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; + +#[derive(Debug, Error)] +enum GraphQLError { + #[error("{message}")] + Error { message: String }, +} + +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + +pub fn execute_query_modifier(registry: &Url, query: &QueryBody, form_modifier: F) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, + F: FnOnce(Form) -> Form, +{ + let client = { + let builder = Client::builder(); + + #[cfg(not(target_os = "wasi"))] + let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { + builder.proxy(proxy) + } else { + builder + }; + builder.build()? + }; + + let registry_url = registry; + + let vars = serde_json::to_string(&query.variables).unwrap(); + + let form = Form::new() + .text("query", query.query.to_string()) + .text("operationName", query.operation_name.to_string()) + .text("variables", vars); + + let form = form_modifier(form); + + let user_agent = format!( + "wapm/{} {} {}", + VERSION, + whoami::platform(), + whoami_distro(), + ); + + let res = client + .post(registry_url.clone()) + .multipart(form) + .bearer_auth( + env::var("WAPM_REGISTRY_TOKEN") + .unwrap_or_default() + ) + .header(USER_AGENT, user_agent) + .send()?; + + let response_body: Response = res.json()?; + if let Some(errors) = response_body.errors { + let error_messages: Vec = errors.into_iter().map(|err| err.message).collect(); + return Err(GraphQLError::Error { + message: error_messages.join(", "), + } + .into()); + } + Ok(response_body.data.expect("missing response data")) +} + +pub fn execute_query(registry: &Url, query: &QueryBody) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, +{ + execute_query_modifier(registry, query, |f| f) +} diff --git a/wapm-resolve-url/src/lib.rs b/wapm-resolve-url/src/lib.rs new file mode 100644 index 00000000..19e8e5f1 --- /dev/null +++ b/wapm-resolve-url/src/lib.rs @@ -0,0 +1,86 @@ +use url::Url; +use graphql_client::GraphQLQuery; + +mod graphql; +#[cfg(not(target_arch = "wasm32"))] +mod proxy; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/query-url-of-file-targz.graphql", + response_derives = "Debug" +)] +pub struct GetPackageQueryTarGz; + +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/query-url-of-file-pirita.graphql", + response_derives = "Debug" +)] +pub struct GetPackageQueryPirita; + +#[cfg(target_os = "wasi")] +pub fn whoami_distro() -> String { + whoami::os().to_lowercase() +} + +#[cfg(not(target_os = "wasi"))] +pub fn whoami_distro() -> String { + whoami::distro().to_lowercase() +} + +pub fn get_current_wapm_registry() -> Option { + let command = std::process::Command::new("wapm") + .arg("config") + .arg("get") + .arg("registry.url") + .output() + .ok()?; + Some(Url::parse(std::str::from_utf8(&command.stdout).ok()?).ok()?) +} + +pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option { + + let q = GetPackageQueryTarGz::build_query(get_package_query_tar_gz::Variables { + name: package_id.to_string(), + }); + let all_package_versions: get_package_query_tar_gz::ResponseData = crate::graphql::execute_query(registry, &q).ok()?; + + match version { + Some(specific) => { + let url = all_package_versions.package?.versions? + .iter() + .filter_map(|v| v.as_ref()) + .filter(|v| v.version == specific) + .next() + .map(|v| v.distribution.download_url.clone())?; + + Url::parse(&url).ok() + }, + None => Url::parse(&all_package_versions.package?.last_version?.distribution.download_url).ok(), + } +} + +pub fn get_webc_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option { + + let q = GetPackageQueryPirita::build_query(get_package_query_pirita::Variables { + name: package_id.to_string(), + }); + let all_package_versions: get_package_query_pirita::ResponseData = crate::graphql::execute_query(registry, &q).ok()?; + + match version { + Some(specific) => { + let url = all_package_versions.package?.versions? + .iter() + .filter_map(|v| v.as_ref()) + .filter(|v| v.version == specific) + .next() + .map(|v| v.distribution.pirita_download_url.clone())?; + + Url::parse(url.as_ref().map(|s| s.as_str())?).ok() + }, + None => Url::parse(&all_package_versions.package?.last_version?.distribution.pirita_download_url?).ok(), + } +} diff --git a/wapm-resolve-url/src/proxy.rs b/wapm-resolve-url/src/proxy.rs new file mode 100644 index 00000000..4820498d --- /dev/null +++ b/wapm-resolve-url/src/proxy.rs @@ -0,0 +1,58 @@ +//! Code for dealing with setting things up to proxy network requests +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum ProxyError { + #[error("Failed to parse URL from {}: {}", url_location, error_message)] + UrlParseError { + url_location: String, + error_message: String, + }, + + #[error("Could not connect to proxy: {0}")] + ConnectionError(String), +} + +/// Tries to set up a proxy +/// +/// This function reads from wapm config's `proxy.url` first, then checks +/// `ALL_PROXY`, `HTTPS_PROXY`, and `HTTP_PROXY` environment variables, in both +/// upper case and lower case, in that order. +/// +/// If a proxy is specified in wapm config's `proxy.url`, it is assumed +/// to be a general proxy +/// +/// A return value of `Ok(None)` means that there was no attempt to set up a proxy, +/// `Ok(Some(proxy))` means that the proxy was set up successfully, and `Err(e)` that +/// there was a failure while attempting to set up the proxy. +pub fn maybe_set_up_proxy() -> anyhow::Result> { + use std::env; + let proxy = if let Ok(proxy_url) = env::var("ALL_PROXY").or(env::var("all_proxy")) { + reqwest::Proxy::all(&proxy_url).map(|proxy| (proxy_url, proxy, "ALL_PROXY")) + } else if let Ok(https_proxy_url) = env::var("HTTPS_PROXY").or(env::var("https_proxy")) { + reqwest::Proxy::https(&https_proxy_url).map(|proxy| (https_proxy_url, proxy, "HTTPS_PROXY")) + } else if let Ok(http_proxy_url) = env::var("HTTP_PROXY").or(env::var("http_proxy")) { + reqwest::Proxy::http(&http_proxy_url).map(|proxy| (http_proxy_url, proxy, "http_proxy")) + } else { + return Ok(None); + } + .map_err(|e| ProxyError::ConnectionError(e.to_string())) + .and_then( + |(proxy_url_str, proxy, url_location): (String, _, &'static str)| { + url::Url::parse(&proxy_url_str) + .map_err(|e| ProxyError::UrlParseError { + url_location: url_location.to_string(), + error_message: e.to_string(), + }) + .map(|url| { + if !(url.username().is_empty()) && url.password().is_some() { + proxy.basic_auth(url.username(), url.password().unwrap_or_default()) + } else { + proxy + } + }) + }, + )?; + + Ok(Some(proxy)) +} From 5050a7c806a7483b2ecebaede7704f945f44b593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 15 Jul 2022 13:14:18 +0200 Subject: [PATCH 12/74] Add support for auto-downloading PiritaFiles from wapm --- .../queries/wax_get_command-pirita.graphql | 15 +++++ src/commands/execute.rs | 57 +++++++++++++++++++ src/commands/install.rs | 13 +++-- src/commands/run.rs | 6 +- 4 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 graphql/queries/wax_get_command-pirita.graphql diff --git a/graphql/queries/wax_get_command-pirita.graphql b/graphql/queries/wax_get_command-pirita.graphql new file mode 100644 index 00000000..7190e865 --- /dev/null +++ b/graphql/queries/wax_get_command-pirita.graphql @@ -0,0 +1,15 @@ +query WaxGetCommandQueryPirita($command: String!) { + command: getCommand(name: $command) { + command + packageVersion { + version + package { + name + displayName + } + distribution { + piritaDownloadUrl + } + } + } +} diff --git a/src/commands/execute.rs b/src/commands/execute.rs index fcddae10..94d25ec3 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -145,6 +145,14 @@ enum ExecuteArgParsingError { )] struct WaxGetCommandQuery; +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/wax_get_command-pirita.graphql", + response_derives = "Debug" +)] +struct WaxGetCommandQueryPirita; + /// Do the real argument parsing into [`ExecuteOptInner`]. fn transform_args(arg_stream: &[String]) -> Result { let mut idx = 0; @@ -364,6 +372,55 @@ pub fn execute(opt: ExecuteOpt) -> anyhow::Result<()> { } } + // if not found, try querying the server for a PiritaFile first + // (before continuing to query for a regular .tar.gz file) + let q = WaxGetCommandQueryPirita::build_query(wax_get_command_query_pirita::Variables { + command: command_name.to_string(), + }); + + // Try to download and execute the PiritaFile before falling back to .tar.gz + loop { + use crate::commands::run::PiritaRunError; + + if opt.offline { + break; + } + + debug!("Querying server for package info"); + let response: Result = execute_query(&q); + if response.is_err() { + info!("Failed to connect to the wapm registry. Continuning."); + break; + } + let response: wax_get_command_query_pirita::ResponseData = response?; + let command = match response.command { + Some(s) => s, + None => { break; }, + }; + + let package = command.package_version.package.name; + let version = command.package_version.version; + + // run wapm install [package] && wapm run [package] + let install_opts = crate::commands::install::InstallOpt { + packages: vec![format!("{package}@{version}")], + global: false, + nocache: true, + force_yes: true, + }; + crate::commands::install::install_pirita(install_opts)?; + let run_opts = crate::commands::run::RunOpt { + command: command.command.clone(), + pre_opened_directories: Vec::new(), + args: opt.args.clone(), + }; + match crate::commands::run::try_run_pirita(&run_opts) { + Ok(()) => return Ok(()), + Err(PiritaRunError::Run(e)) => { return Err(e); }, + Err(PiritaRunError::Initialize(_)) => { break; }, + } + } + // if not found, query the server and check if we already have it installed let q = WaxGetCommandQuery::build_query(wax_get_command_query::Variables { command: command_name.to_string(), diff --git a/src/commands/install.rs b/src/commands/install.rs index 83e902e5..85f34ad7 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -19,18 +19,18 @@ use thiserror::Error; /// Options for the `install` subcommand #[derive(StructOpt, Debug)] pub struct InstallOpt { - packages: Vec, + pub(crate) packages: Vec, /// Install the package(s) globally #[structopt(short = "g", long = "global")] - global: bool, + pub(crate) global: bool, /// If packages already exist, the CLI will throw a prompt whether you'd like to /// re-download the package. This flag disables the prompt and will re-download /// the file even if it already exists. #[structopt(long = "nocache")] - nocache: bool, + pub(crate) nocache: bool, /// Agree to all prompts. Useful for non-interactive uses. (WARNING: this may cause undesired behavior) #[structopt(long = "force-yes", short = "y")] - force_yes: bool, + pub(crate) force_yes: bool, } #[derive(Debug, Error)] @@ -160,7 +160,7 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result anyhow::Result<()> { "this function should only be called once!" ); - let installed_packages = get_packages_with_versions(&options.packages)?; + let installed_packages = get_packages_with_versions(&options.packages); + let installed_packages = installed_packages?; let install_directory = Path::new(¤t_directory); let rt = tokio::runtime::Builder::new_current_thread() diff --git a/src/commands/run.rs b/src/commands/run.rs index b5984114..72bba673 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -18,13 +18,13 @@ use wasm_bus_process::prelude::Command; #[derive(StructOpt, Debug)] pub struct RunOpt { /// Command name - command: String, + pub(crate) command: String, /// WASI pre-opened directory #[structopt(long = "dir", multiple = true, group = "wasi")] - pre_opened_directories: Vec, + pub(crate) pre_opened_directories: Vec, /// Application arguments #[structopt(multiple = true, parse(from_os_str))] - args: Vec, + pub(crate) args: Vec, } #[derive(Debug)] From 26d062e70fbadb155ae19c9b33c209f209dd60ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 18 Jul 2022 18:07:58 +0200 Subject: [PATCH 13/74] Add access to private repositories to wapm-cli CI --- .github/workflows/main.yaml | 4 +- Cargo.lock | 279 ++++++++++++++++++++++++++++++++++-- Cargo.toml | 2 +- 3 files changed, 271 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d07ea806..b2e8a58d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -73,7 +73,7 @@ jobs: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} override: true - - name: Configure cargo data directory + - name: Configure cargo data directory + private access tokens # After this point, all cargo registry and crate data is stored in # $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files # that are needed during the build process. Additionally, this works @@ -82,6 +82,8 @@ jobs: run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + echo https://wasmer:${{ secrets.GH_PAT }}@github.com > .creds + git config --global credential.helper "store --file .creds" # - name: Install sccache # run: | # echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin" diff --git a/Cargo.lock b/Cargo.lock index b8078e1a..3dd9dde1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1761,6 +1761,19 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +dependencies = [ + "http", + "hyper 0.14.19", + "rustls", + "tokio", + "tokio-rustls", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -2382,6 +2395,12 @@ dependencies = [ "windows-sys 0.36.1", ] +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + [[package]] name = "path-clean" version = "0.1.0" @@ -2463,7 +2482,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0573041d5e6b312ca5bd437fe68ff0fc505ba7d4#0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" dependencies = [ "webc", "webc-runner", @@ -2834,6 +2853,7 @@ dependencies = [ "http", "http-body", "hyper 0.14.19", + "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -2844,20 +2864,39 @@ dependencies = [ "native-tls", "percent-encoding 2.1.0", "pin-project-lite", + "rustls", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", + "tokio-rustls", "tokio-socks", "tokio-util 0.6.10", "url 2.2.2", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "ripemd160" version = "0.9.1" @@ -2895,6 +2934,28 @@ dependencies = [ "syn", ] +[[package]] +name = "rmp" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44519172358fd6d58656c86ab8e7fbc9e1490c3e8f14d35ed78ca0dd07403c9f" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + [[package]] name = "rpassword" version = "5.0.1" @@ -2996,6 +3057,27 @@ dependencies = [ "semver 0.11.0", ] +[[package]] +name = "rustls" +version = "0.20.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" +dependencies = [ + "log 0.4.17", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "rustversion" version = "1.0.7" @@ -3051,6 +3133,16 @@ dependencies = [ "sha2 0.9.9", ] +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "seahash" version = "4.1.0" @@ -3263,6 +3355,18 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-xml-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65162e9059be2f6a3421ebbb4fef3e74b7d9e7c60c50a0e292c6239f19f1edfa" +dependencies = [ + "log 0.4.17", + "serde", + "thiserror", + "xml-rs", +] + [[package]] name = "serde_bytes" version = "0.11.6" @@ -3876,6 +3980,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + [[package]] name = "tokio-socks" version = "0.5.1" @@ -4080,6 +4195,12 @@ dependencies = [ "void", ] +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "1.7.2" @@ -4206,14 +4327,32 @@ dependencies = [ "toml", "url 2.2.2", "wapm-toml 0.1.0", - "wasm-bus-process", - "wasm-bus-reqwest", + "wasm-bus-process 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bus-reqwest 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-wasm-interface", "wasmparser 0.51.4", "whoami 0.5.3", "whoami 1.2.1", ] +[[package]] +name = "wapm-resolve-url" +version = "0.1.0" +source = "git+https://github.com/wasmerio/wapm-cli?rev=0134b850f20af5b10dbd5b5958351dd64431c957#0134b850f20af5b10dbd5b5958351dd64431c957" +dependencies = [ + "anyhow", + "graphql_client", + "reqwest", + "serde", + "serde_json", + "thiserror", + "url 2.2.2", + "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "whoami 0.5.3", + "whoami 1.2.1", +] + [[package]] name = "wapm-toml" version = "0.1.0" @@ -4232,7 +4371,7 @@ dependencies = [ [[package]] name = "wapm-toml" version = "0.1.0" -source = "git+https://github.com/wasmerio/wapm-cli?rev=0cd12a0b09babdfbc9fc9b65a9881b60fef9f2be#0cd12a0b09babdfbc9fc9b65a9881b60fef9f2be" +source = "git+https://github.com/wasmerio/wapm-cli#902ee5de1cf6a8baed3079625f8f9ab7d7fc1ef7" dependencies = [ "anyhow", "semver 0.11.0", @@ -4263,6 +4402,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasix" +version = "0.11.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3fb76de32c72156fd25fa56776b4ed3d02fcafddfa36d24fac6b135bc7e9bca" + [[package]] name = "wasm-bindgen" version = "0.2.80" @@ -4344,8 +4489,27 @@ dependencies = [ "serde_json", "tokio", "tracing", - "wasm-bus-macros", - "wasm-bus-types", + "wasm-bus-macros 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bus-types 1.0.0", +] + +[[package]] +name = "wasm-bus" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "async-trait", + "base64 0.13.0", + "cooked-waker", + "derivative", + "once_cell", + "serde", + "sha2 0.10.2", + "tokio", + "tracing", + "wasix", + "wasm-bus-macros 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus-types 1.1.0", ] [[package]] @@ -4359,7 +4523,20 @@ dependencies = [ "proc-macro2", "quote", "syn", - "wasm-bus-types", + "wasm-bus-types 1.0.0", +] + +[[package]] +name = "wasm-bus-macros" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "convert_case", + "derivative", + "proc-macro2", + "quote", + "syn", + "wasm-bus-types 1.1.0", ] [[package]] @@ -4374,7 +4551,21 @@ dependencies = [ "serde", "tokio", "tracing", - "wasm-bus", + "wasm-bus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bus-process" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "async-trait", + "bytes", + "dummy-waker", + "serde", + "tokio", + "tracing", + "wasm-bus 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", ] [[package]] @@ -4398,7 +4589,30 @@ dependencies = [ "tracing", "url 2.2.2", "urlencoding", - "wasm-bus", + "wasm-bus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bus-reqwest" +version = "1.2.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "async-trait", + "bytes", + "formdata", + "futures-core", + "futures-util", + "http", + "http-body", + "mime_guess", + "pin-project-lite", + "serde", + "serde_json", + "tokio", + "tracing", + "url 2.2.2", + "urlencoding", + "wasm-bus 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", ] [[package]] @@ -4407,6 +4621,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d49ff958a0d83cacc3dc470ded238af5e1d316dcdc6d74322d2b7b2a438046d" +[[package]] +name = "wasm-bus-types" +version = "1.1.0" +source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" +dependencies = [ + "bincode", + "rmp-serde", + "serde", + "serde-xml-rs", + "serde_json", + "serde_yaml", +] + [[package]] name = "wasmer" version = "2.3.0" @@ -4671,7 +4898,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0573041d5e6b312ca5bd437fe68ff0fc505ba7d4#0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" dependencies = [ "anyhow", "base64 0.13.0", @@ -4693,7 +4920,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0573041d5e6b312ca5bd437fe68ff0fc505ba7d4#0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" dependencies = [ "anyhow", "futures-util", @@ -4707,7 +4934,10 @@ dependencies = [ "serde_derive", "tokio", "url 2.2.2", - "wapm-toml 0.1.0 (git+https://github.com/wasmerio/wapm-cli?rev=0cd12a0b09babdfbc9fc9b65a9881b60fef9f2be)", + "wapm-resolve-url", + "wapm-toml 0.1.0 (git+https://github.com/wasmerio/wapm-cli)", + "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "wasmer", "wasmer-emscripten", "wasmer-vfs", @@ -4715,6 +4945,25 @@ dependencies = [ "webc", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" +dependencies = [ + "webpki", +] + [[package]] name = "whoami" version = "0.5.3" @@ -4874,6 +5123,12 @@ dependencies = [ "libc", ] +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + [[package]] name = "xxhash-rust" version = "0.8.5" diff --git a/Cargo.toml b/Cargo.toml index b86b278e..e98ceb8a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ serde_yaml = { version = "^0.8" } [dependencies.pirita] git = "ssh://git@github.com/wasmerio/pirita.git" -rev = "0573041d5e6b312ca5bd437fe68ff0fc505ba7d4" +rev = "b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" features = ["emscripten", "wasi"] [dev-dependencies] From 9783af3cdb7aeda7215fbb2bb876d31ce2c8c8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 18 Jul 2022 18:44:10 +0200 Subject: [PATCH 14/74] Use ssh-add --- .cargo/config | 2 ++ .github/workflows/main.yaml | 1 + 2 files changed, 3 insertions(+) create mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 00000000..656e08b0 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,2 @@ +[net] +git-fetch-with-cli = true \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b2e8a58d..b8d6c052 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -82,6 +82,7 @@ jobs: run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV + ssh-add echo https://wasmer:${{ secrets.GH_PAT }}@github.com > .creds git config --global credential.helper "store --file .creds" # - name: Install sccache From 909dfd5b7774503aa5dfa37e0b49066b64b78d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 18 Jul 2022 18:48:44 +0200 Subject: [PATCH 15/74] Test cloning private repo --- .github/workflows/main.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b8d6c052..66099e3b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -67,6 +67,11 @@ jobs: # SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} steps: - uses: actions/checkout@v2 + - name: Clone private repo + run: | + echo https://wasmer:${{secrets.GH_PAT}}@github.com > .creds + git config --global credential.helper "store --file .creds" + git clone https://github.com/wasmerio/pirita.git - name: Install Rust ${{ matrix.rust }} uses: actions-rs/toolchain@v1 with: @@ -82,7 +87,6 @@ jobs: run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV - ssh-add echo https://wasmer:${{ secrets.GH_PAT }}@github.com > .creds git config --global credential.helper "store --file .creds" # - name: Install sccache From 7b9d01a10ba26c17d5de7285e2f48d00b295daca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 18 Jul 2022 18:53:23 +0200 Subject: [PATCH 16/74] Try using HTTPS url instead of SSH --- .cargo/config | 2 -- .github/workflows/main.yaml | 6 ------ Cargo.lock | 6 +++--- Cargo.toml | 3 ++- 4 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index 656e08b0..00000000 --- a/.cargo/config +++ /dev/null @@ -1,2 +0,0 @@ -[net] -git-fetch-with-cli = true \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 66099e3b..960bfd70 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -67,11 +67,6 @@ jobs: # SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }} steps: - uses: actions/checkout@v2 - - name: Clone private repo - run: | - echo https://wasmer:${{secrets.GH_PAT}}@github.com > .creds - git config --global credential.helper "store --file .creds" - git clone https://github.com/wasmerio/pirita.git - name: Install Rust ${{ matrix.rust }} uses: actions-rs/toolchain@v1 with: @@ -86,7 +81,6 @@ jobs: # the workspace dir to be saved/restored incorrectly. run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV - echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV echo https://wasmer:${{ secrets.GH_PAT }}@github.com > .creds git config --global credential.helper "store --file .creds" # - name: Install sccache diff --git a/Cargo.lock b/Cargo.lock index 3dd9dde1..e767d0c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2482,7 +2482,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" +source = "git+https://github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" dependencies = [ "webc", "webc-runner", @@ -4898,7 +4898,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" +source = "git+https://github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" dependencies = [ "anyhow", "base64 0.13.0", @@ -4920,7 +4920,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" +source = "git+https://github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" dependencies = [ "anyhow", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index e98ceb8a..c026fa0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,8 +60,9 @@ getrandom = "0.2.3" tar = { package = "tar-wasi", version = "0.4" } serde_yaml = { version = "^0.8" } +# Due to issues with SSH [dependencies.pirita] -git = "ssh://git@github.com/wasmerio/pirita.git" +git = "https://github.com/wasmerio/pirita.git" rev = "b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" features = ["emscripten", "wasi"] From 87f7ebdd375e68103870e7eed02f5b426acb1cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 18 Jul 2022 19:22:53 +0200 Subject: [PATCH 17/74] Try enabling git fetch with cli again --- .github/workflows/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 960bfd70..a5dfcd51 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -81,8 +81,8 @@ jobs: # the workspace dir to be saved/restored incorrectly. run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV - echo https://wasmer:${{ secrets.GH_PAT }}@github.com > .creds - git config --global credential.helper "store --file .creds" + echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt + git config --global credential.helper "store --file creds.txt" # - name: Install sccache # run: | # echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin" From ede513b4449e476b78949ff20c419cc3561bbeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 18 Jul 2022 21:33:52 +0200 Subject: [PATCH 18/74] Update pirita --- Cargo.lock | 877 ++--------------------------------------------------- Cargo.toml | 6 +- 2 files changed, 31 insertions(+), 852 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e767d0c9..89769dda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,12 +196,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base-x" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" - [[package]] name = "base64" version = "0.9.3" @@ -381,27 +375,6 @@ version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" -[[package]] -name = "bytecheck" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a31f923c2db9513e4298b72df143e6e655a759b3d6a0966df18f81223fff54f" -dependencies = [ - "bytecheck_derive", - "ptr_meta", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb17c862a905d912174daa27ae002326fff56dc8b8ada50a0a5f0976cb174f0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "byteorder" version = "1.4.3" @@ -454,7 +427,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.43", + "time", "wasm-bindgen", "winapi", ] @@ -566,12 +539,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "279bc8fc53f788a75c7804af68237d1fce02cde1e275a886a4b320604dc2aeda" -[[package]] -name = "const_fn" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -606,19 +573,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" -[[package]] -name = "corosensei" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 1.0.0", - "libc", - "scopeguard", - "windows-sys 0.33.0", -] - [[package]] name = "cpufeatures" version = "0.2.2" @@ -628,65 +582,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cranelift-bforest" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" -dependencies = [ - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "gimli", - "log 0.4.17", - "regalloc", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" - -[[package]] -name = "cranelift-entity" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" - -[[package]] -name = "cranelift-frontend" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" -dependencies = [ - "cranelift-codegen", - "log 0.4.17", - "smallvec", - "target-lexicon", -] - [[package]] name = "crc32fast" version = "1.3.2" @@ -696,41 +591,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 1.0.0", - "crossbeam-utils", - "memoffset", - "once_cell", - "scopeguard", -] - [[package]] name = "crossbeam-utils" version = "0.8.8" @@ -832,40 +692,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "dbl" version = "0.3.2" @@ -1005,12 +831,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "doc-comment" version = "0.3.3" @@ -1186,47 +1006,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "enum-iterator" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "enumset" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "failure" version = "0.1.8" @@ -1437,15 +1216,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generational-arena" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d3b771574f62d0548cee0ad9057857e9fc25d7a3335f140c84f6acd0bf601" -dependencies = [ - "cfg-if 0.1.10", -] - [[package]] name = "generic-array" version = "0.14.5" @@ -1487,11 +1257,6 @@ name = "gimli" version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] [[package]] name = "graphql-introspection-query" @@ -1604,14 +1369,9 @@ name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - -[[package]] -name = "hashbrown" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022" dependencies = [ "ahash 0.7.6", + "serde", ] [[package]] @@ -1730,7 +1490,7 @@ dependencies = [ "log 0.3.9", "mime 0.2.6", "num_cpus", - "time 0.1.43", + "time", "traitobject", "typeable", "unicase 1.4.2", @@ -1797,12 +1557,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.1.5" @@ -2027,15 +1781,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "maplit" version = "1.0.2" @@ -2080,15 +1825,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "memsec" version = "0.6.2" @@ -2165,15 +1901,9 @@ dependencies = [ "libc", "log 0.4.17", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "windows-sys", ] -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - [[package]] name = "native-tls" version = "0.2.10" @@ -2392,7 +2122,7 @@ dependencies = [ "libc", "redox_syscall 0.2.13", "smallvec", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] @@ -2482,7 +2212,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+https://github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0967fda8971b0e2b0757c40d656f6ed5cad8d2e9#0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" dependencies = [ "webc", "webc-runner", @@ -2554,12 +2284,6 @@ dependencies = [ "version_check 0.9.4", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - [[package]] name = "proc-macro2" version = "1.0.39" @@ -2569,26 +2293,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "quote" version = "1.0.18" @@ -2703,30 +2407,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg 1.1.0", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "rdrand" version = "0.4.0" @@ -2773,17 +2453,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "regalloc" -version = "0.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" -dependencies = [ - "log 0.4.17", - "rustc-hash", - "smallvec", -] - [[package]] name = "regex" version = "1.5.6" @@ -2807,18 +2476,6 @@ version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" -[[package]] -name = "region" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - [[package]] name = "remove_dir_all" version = "0.5.3" @@ -2828,15 +2485,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rend" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95" -dependencies = [ - "bytecheck", -] - [[package]] name = "reqwest" version = "0.11.10" @@ -2908,32 +2556,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "rkyv" -version = "0.7.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" -dependencies = [ - "bytecheck", - "hashbrown 0.12.2", - "indexmap", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "rmp" version = "0.8.11" @@ -3033,28 +2655,13 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" -version = "0.2.3" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", + "semver", ] [[package]] @@ -3112,7 +2719,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] @@ -3143,12 +2750,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "security-framework" version = "2.6.1" @@ -3172,31 +2773,16 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser 0.7.0", -] - [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser 0.10.2", + "semver-parser", "serde", ] -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "semver-parser" version = "0.10.2" @@ -3253,7 +2839,7 @@ dependencies = [ "lazy_static", "libc", "regex", - "rustc_version 0.3.3", + "rustc_version", "sentry-core", "uname", ] @@ -3367,15 +2953,6 @@ dependencies = [ "xml-rs", ] -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - [[package]] name = "serde_cbor" version = "0.11.2" @@ -3445,21 +3022,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "sha1" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" -dependencies = [ - "sha1_smol", -] - -[[package]] -name = "sha1_smol" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" - [[package]] name = "sha1collisiondetection" version = "0.2.5" @@ -3577,76 +3139,12 @@ dependencies = [ "der", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check 0.9.4", -] - [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "string_cache" version = "0.8.4" @@ -3747,12 +3245,6 @@ dependencies = [ "xattr", ] -[[package]] -name = "target-lexicon" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" - [[package]] name = "tempdir" version = "0.3.7" @@ -3877,44 +3369,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check 0.9.4", - "winapi", -] - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - [[package]] name = "tiny-keccak" version = "2.0.2" @@ -4283,7 +3737,7 @@ dependencies = [ [[package]] name = "wapm-cli" -version = "0.5.4" +version = "0.5.5" dependencies = [ "anyhow", "atty", @@ -4310,7 +3764,7 @@ dependencies = [ "reqwest", "rpassword-wasi", "rusqlite", - "semver 0.11.0", + "semver", "sentry", "serde", "serde_derive", @@ -4322,15 +3776,15 @@ dependencies = [ "tar-wasi", "tempfile", "thiserror", - "time 0.1.43", + "time", "tokio", "toml", "url 2.2.2", - "wapm-toml 0.1.0", + "wapm-toml", "wasm-bus-process 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bus-reqwest 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-wasm-interface", - "wasmparser 0.51.4", + "wasmparser", "whoami 0.5.3", "whoami 1.2.1", ] @@ -4358,23 +3812,7 @@ name = "wapm-toml" version = "0.1.0" dependencies = [ "anyhow", - "semver 0.11.0", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "serde_yaml", - "thiserror", - "toml", -] - -[[package]] -name = "wapm-toml" -version = "0.1.0" -source = "git+https://github.com/wasmerio/wapm-cli#902ee5de1cf6a8baed3079625f8f9ab7d7fc1ef7" -dependencies = [ - "anyhow", - "semver 0.11.0", + "semver", "serde", "serde_cbor", "serde_derive", @@ -4634,213 +4072,6 @@ dependencies = [ "serde_yaml", ] -[[package]] -name = "wasmer" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "cfg-if 1.0.0", - "indexmap", - "js-sys", - "more-asserts", - "target-lexicon", - "thiserror", - "wasm-bindgen", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-derive", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-compiler" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "backtrace", - "cfg-if 1.0.0", - "enum-iterator", - "enumset", - "lazy_static", - "leb128", - "memmap2", - "more-asserts", - "region", - "rkyv", - "rustc-demangle", - "serde", - "serde_bytes", - "smallvec", - "target-lexicon", - "thiserror", - "wasmer-types", - "wasmer-vm", - "wasmparser 0.83.0", - "winapi", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "gimli", - "more-asserts", - "rayon", - "smallvec", - "target-lexicon", - "tracing", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-derive" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasmer-emscripten" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "byteorder", - "getrandom 0.2.6", - "lazy_static", - "libc", - "log 0.4.17", - "time 0.2.27", - "wasmer", -] - -[[package]] -name = "wasmer-types" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "enum-iterator", - "indexmap", - "more-asserts", - "rkyv", - "serde", - "serde_bytes", - "thiserror", -] - -[[package]] -name = "wasmer-vbus" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "thiserror", - "tracing", - "wasmer-vfs", -] - -[[package]] -name = "wasmer-vfs" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "libc", - "slab", - "thiserror", - "tracing", -] - -[[package]] -name = "wasmer-vm" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "corosensei", - "enum-iterator", - "indexmap", - "lazy_static", - "libc", - "mach", - "memoffset", - "more-asserts", - "region", - "rkyv", - "scopeguard", - "serde", - "thiserror", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmer-vnet" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "bytes", - "thiserror", - "tracing", - "wasmer-vfs", -] - -[[package]] -name = "wasmer-wasi" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "bytes", - "cfg-if 1.0.0", - "derivative", - "generational-arena", - "getrandom 0.2.6", - "libc", - "thiserror", - "tracing", - "wasm-bindgen", - "wasmer", - "wasmer-vbus", - "wasmer-vfs", - "wasmer-vnet", - "wasmer-wasi-local-networking", - "wasmer-wasi-types", - "winapi", -] - -[[package]] -name = "wasmer-wasi-local-networking" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "bytes", - "tracing", - "wasmer-vfs", - "wasmer-vnet", -] - -[[package]] -name = "wasmer-wasi-types" -version = "2.3.0" -source = "git+https://github.com/wasmerio/wasmer#e32ecdf126e4b43e44f82e540aa3a847d0d3a694" -dependencies = [ - "byteorder", - "time 0.2.27", - "wasmer-derive", - "wasmer-types", -] - [[package]] name = "wasmer-wasm-interface" version = "0.1.0" @@ -4849,7 +4080,7 @@ dependencies = [ "either", "nom", "serde", - "wasmparser 0.51.4", + "wasmparser", "wat", ] @@ -4859,12 +4090,6 @@ version = "0.51.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" -[[package]] -name = "wasmparser" -version = "0.83.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" - [[package]] name = "wast" version = "41.0.0" @@ -4898,10 +4123,11 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+https://github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0967fda8971b0e2b0757c40d656f6ed5cad8d2e9#0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" dependencies = [ "anyhow", "base64 0.13.0", + "hashbrown 0.11.2", "indexmap", "leb128", "lexical-sort", @@ -4920,7 +4146,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+https://github.com/wasmerio/pirita.git?rev=b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea#b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0967fda8971b0e2b0757c40d656f6ed5cad8d2e9#0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" dependencies = [ "anyhow", "futures-util", @@ -4930,18 +4156,12 @@ dependencies = [ "regex", "reqwest", "serde", - "serde_cbor", "serde_derive", "tokio", "url 2.2.2", "wapm-resolve-url", - "wapm-toml 0.1.0 (git+https://github.com/wasmerio/wapm-cli)", "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "wasmer", - "wasmer-emscripten", - "wasmer-vfs", - "wasmer-wasi", "webc", ] @@ -5002,86 +4222,43 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" -dependencies = [ - "windows_aarch64_msvc 0.33.0", - "windows_i686_gnu 0.33.0", - "windows_i686_msvc 0.33.0", - "windows_x86_64_gnu 0.33.0", - "windows_x86_64_msvc 0.33.0", -] - [[package]] name = "windows-sys" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" - [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" -[[package]] -name = "windows_i686_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" - [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" -[[package]] -name = "windows_i686_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" - [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" -[[package]] -name = "windows_x86_64_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" - [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" -[[package]] -name = "windows_x86_64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" - [[package]] name = "windows_x86_64_msvc" version = "0.36.1" diff --git a/Cargo.toml b/Cargo.toml index 9ad2d935..ca8c6977 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,8 +63,9 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH [dependencies.pirita] git = "https://github.com/wasmerio/pirita.git" -rev = "b20cf5dfadb82e5fe0fcc0a77bf901b58da31dea" -features = ["emscripten", "wasi"] +rev = "0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" +default-features = false +optional = true [dev-dependencies] tempfile = "3" @@ -79,6 +80,7 @@ members = [ default = ["full","packagesigning", "sqlite-bundled"] sqlite-bundled = ["rusqlite/bundled"] telemetry = ["sentry"] +pirita_file = ["pirita"] update-notifications= ["billboard", "colored"] prehash-module = ["hex", "blake3"] packagesigning = []#[cfg(feature = "full")] From c8eb04e95bb0825fad5e50fed73d11aa5cf1d75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 11:06:17 +0200 Subject: [PATCH 19/74] Fix issues with PiritaFile being used without the proper feature flags --- Cargo.toml | 2 +- src/commands/execute.rs | 4 +++- src/commands/install.rs | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ca8c6977..e48ee61b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,7 @@ getrandom = "0.2.3" tar = { package = "tar-wasi", version = "0.4" } serde_yaml = { version = "^0.8" } -# Due to issues with SSH +# Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] git = "https://github.com/wasmerio/pirita.git" rev = "0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" diff --git a/src/commands/execute.rs b/src/commands/execute.rs index 94d25ec3..91c5fd35 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -374,11 +374,13 @@ pub fn execute(opt: ExecuteOpt) -> anyhow::Result<()> { // if not found, try querying the server for a PiritaFile first // (before continuing to query for a regular .tar.gz file) + #[cfg(feature = "pirita_file")] let q = WaxGetCommandQueryPirita::build_query(wax_get_command_query_pirita::Variables { command: command_name.to_string(), }); - // Try to download and execute the PiritaFile before falling back to .tar.gz + // Try to download and execute the PiritaFile before falling back to .tar. + #[cfg(feature = "pirita_file")] loop { use crate::commands::run::PiritaRunError; diff --git a/src/commands/install.rs b/src/commands/install.rs index 85f34ad7..8dd1fb54 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -12,7 +12,9 @@ use crate::config::Config; use crate::dataflow; use crate::util; use std::borrow::Cow; -use std::path::{Path, PathBuf}; +use std::path::Path; +#[cfg(feature = "pirita_file")] +use std::path::PathBuf; use structopt::StructOpt; use thiserror::Error; @@ -57,6 +59,7 @@ enum InstallError { InvalidPackageIdentifier { name: String }, #[error("Must supply package names to install command when using --global/-g flag.")] MustSupplyPackagesWithGlobalFlag, + #[cfg(feature = "pirita_file")] #[error( "Could not find PiritaFile donwload url for package {0}@{1}", name, @@ -78,6 +81,7 @@ mod package_args { /// Run the install command pub fn install(options: InstallOpt) -> anyhow::Result<()> { + #[cfg(feature = "pirita_file")] if std::env::var("USE_PIRITA").ok() == Some("1".to_string()) { return install_pirita(options); } @@ -206,6 +210,7 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result anyhow::Result<()> { let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); @@ -244,6 +249,7 @@ pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { }) } +#[cfg(feature = "pirita_file")] async fn download_pirita( name: &str, version: &str, From f8b7f0b10fa807e657b9b94ea7078d993fff923b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 12:26:44 +0200 Subject: [PATCH 20/74] Try fixing Cargo.toml directly --- .github/workflows/main.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d8f27d02..fe30d009 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -83,6 +83,10 @@ jobs: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt git config --global credential.helper "store --file creds.txt" + test="git = \"https://wasmer:${{ secrets.GH_PAT }}@github.com/wasmerio/pirita\"" + sed -i "s/git = \"https:\/\/github.com\/wasmerio\/pirita.git\"/$(cat replace.txt)/g" Cargo.toml + echo "cargo toml:" + cat Cargo.toml # - name: Install sccache # run: | # echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin" From eb061de9ae6996ba267c31e71d1cd8985a3544ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 12:28:31 +0200 Subject: [PATCH 21/74] Use bash shell --- .github/workflows/main.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fe30d009..bae9ee9a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -79,12 +79,13 @@ jobs: # that are needed during the build process. Additionally, this works # around a bug in the 'cache' action that causes directories outside of # the workspace dir to be saved/restored incorrectly. + shell: bash run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt git config --global credential.helper "store --file creds.txt" - test="git = \"https://wasmer:${{ secrets.GH_PAT }}@github.com/wasmerio/pirita\"" - sed -i "s/git = \"https:\/\/github.com\/wasmerio\/pirita.git\"/$(cat replace.txt)/g" Cargo.toml + test="git = \"https:\/\/wasmer:${{ secrets.GH_PAT }}@github.com\/wasmerio\/pirita.git\"" + sed -i "s/git = \"https:\/\/github.com\/wasmerio\/pirita.git\"/$test/g" Cargo.toml echo "cargo toml:" cat Cargo.toml # - name: Install sccache From 9467ab0f7e68654438416bf573b52bc31cd93d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 12:35:33 +0200 Subject: [PATCH 22/74] Use Cargo.toml substitution only on Windows --- .github/workflows/main.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bae9ee9a..68647942 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -79,15 +79,16 @@ jobs: # that are needed during the build process. Additionally, this works # around a bug in the 'cache' action that causes directories outside of # the workspace dir to be saved/restored incorrectly. - shell: bash run: | echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt git config --global credential.helper "store --file creds.txt" + - name: Configure git credentials on Windows + if: matrix.os == 'windows-latest' + shell: bash + run: | test="git = \"https:\/\/wasmer:${{ secrets.GH_PAT }}@github.com\/wasmerio\/pirita.git\"" sed -i "s/git = \"https:\/\/github.com\/wasmerio\/pirita.git\"/$test/g" Cargo.toml - echo "cargo toml:" - cat Cargo.toml # - name: Install sccache # run: | # echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin" From 7e46a93bb902d2ca325c82bb60888b105d0c59b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 13:32:20 +0200 Subject: [PATCH 23/74] Fixed error with .bin commands being executed in Pirita mode --- src/commands/execute.rs | 6 ++++-- src/commands/run.rs | 36 +++++++++++++++++++++++++++------ src/dataflow/pirita_packages.rs | 9 ++++++++- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/commands/execute.rs b/src/commands/execute.rs index 91c5fd35..b7e543ee 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -275,7 +275,8 @@ pub fn execute(opt: ExecuteOpt) -> anyhow::Result<()> { // first search for locally installed command match FindCommandResult::find_command_in_directory(¤t_dir, &command_name) { FindCommandResult::CommandFoundPirita(cmd) => { - crate::commands::run::try_run_pirita_cmd(&cmd, command_name, &opt.args.as_ref())?; + crate::commands::run::try_run_pirita_cmd(&cmd, command_name, &opt.args.as_ref()) + .map_err(|e| anyhow::anyhow!("Error running PiritaFile command: {e}"))?; return Ok(()); }, FindCommandResult::CommandNotFound(_) => { @@ -613,7 +614,8 @@ fn run( ); } FindCommandResult::CommandFoundPirita(cmd) => { - crate::commands::run::try_run_pirita_cmd(&cmd, command_name, args)?; + crate::commands::run::try_run_pirita_cmd(&cmd, command_name, args) + .map_err(|e| anyhow::anyhow!("Error running PiritaFile command: {e}"))?; return Ok(()); }, FindCommandResult::Error(e) => return Err(e), diff --git a/src/commands/run.rs b/src/commands/run.rs index 72bba673..501a6921 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -7,6 +7,7 @@ use crate::dataflow::find_command_result::get_command_from_anywhere; use crate::dataflow::manifest_packages::ManifestResult; use crate::util::get_runtime_with_args; use std::ffi::OsString; +use std::fmt; use std::path::{Path, PathBuf}; #[cfg(not(target_os = "wasi"))] use std::process::Command; @@ -32,13 +33,36 @@ pub enum PiritaRunError { Initialize(PiritaInitializeError), Run(anyhow::Error), } +impl fmt::Display for PiritaRunError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::PiritaRunError::*; + match self { + Initialize(i) => write!(f, "initialize: {i}"), + Run(r) => write!(f, "run: {r}"), + } + } +} #[derive(Debug)] pub enum PiritaInitializeError { + NotAWasmerRunCommand, + InvalidCommand(anyhow::Error), CannotGetCurrentDir(std::io::Error), CouldNotFindCommandInDotBin(std::io::Error), } +impl fmt::Display for PiritaInitializeError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::PiritaInitializeError::*; + match self { + NotAWasmerRunCommand => write!(f, "not a wasmer run command"), + InvalidCommand(e) => write!(f, "invalid command: {e}"), + CannotGetCurrentDir(e) => write!(f, "cannot get current dir: {e}"), + CouldNotFindCommandInDotBin(e) => write!(f, "could not find command in .bin directory: {e}"), + } + } +} + pub fn try_run_pirita(run_options: &RunOpt) -> Result<(), PiritaRunError> { let command_name = run_options.command.as_str(); @@ -50,23 +74,22 @@ pub fn try_run_pirita(run_options: &RunOpt) -> Result<(), PiritaRunError> { .map_err(|e| PiritaRunError::Initialize(PiritaInitializeError::CouldNotFindCommandInDotBin(e)))?; try_run_pirita_cmd(&cmd, command_name, args.as_ref()) - .map_err(|e| PiritaRunError::Run(e)) } -pub(crate) fn try_run_pirita_cmd(cmd: &str, command_name: &str, args: &[OsString]) -> Result<(), anyhow::Error> { +pub(crate) fn try_run_pirita_cmd(cmd: &str, command_name: &str, args: &[OsString]) -> Result<(), PiritaRunError> { - let mut sw = shellwords::split(&cmd)?; + let mut sw = shellwords::split(&cmd) + .map_err(|e| PiritaRunError::Initialize(PiritaInitializeError::InvalidCommand(e.into())))?; if sw.get(0).map(|s| s.as_str()) != Some("wasmer") || sw.get(1).map(|s| s.as_str()) != Some("run") { - return Err(anyhow!( - "Expected \"wasmer run\" command in command for {command_name:?}, got: {sw:?}" - )); + return Err(PiritaRunError::Initialize(PiritaInitializeError::NotAWasmerRunCommand)); } sw.remove(0); sw.remove(0); run_pirita(&sw, args) + .map_err(|e| PiritaRunError::Run(e)) } fn run_pirita(args: &[String], rt_args: &[OsString]) -> Result<(), anyhow::Error> { @@ -173,6 +196,7 @@ pub fn run(run_options: RunOpt) -> anyhow::Result<()> { cmd }) => { crate::commands::run::try_run_pirita_cmd(&cmd, command_name, args) + .map_err(|e| anyhow::anyhow!("Error running PiritaFile command: {e}")) } } } diff --git a/src/dataflow/pirita_packages.rs b/src/dataflow/pirita_packages.rs index b0b523bf..7abfc284 100644 --- a/src/dataflow/pirita_packages.rs +++ b/src/dataflow/pirita_packages.rs @@ -1,5 +1,6 @@ use std::path::Path; use std::io::Error as IoError; +use std::io::ErrorKind as IoErrorKind; /// A ternary for a manifest: Some, None, Error. #[derive(Debug)] @@ -12,7 +13,13 @@ impl PiritaResult { pub fn find_in_directory>(directory: P, command: &str) -> Self { let directory = directory.as_ref(); match std::fs::read_to_string(directory.join("wapm_packages").join(".bin").join(command)) { - Ok(o) => Self::Ok(o), + Ok(o) =>{ + if o.starts_with("wasmer run") { + Self::Ok(o) + } else { + Self::Error(IoError::new(IoErrorKind::Other, format!("Command {command:?} does not start with \"wasmer run\""))) + } + }, Err(e) => Self::Error(e), } } From 9a1d72a1cda76a60a51c27914cbc2c0fb5a18e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 14:32:45 +0200 Subject: [PATCH 24/74] Fix error in installation function, use external wapm-resolve-url crate --- Cargo.lock | 20 +++++++++- Cargo.toml | 4 +- src/commands/install.rs | 78 ++++++++++++------------------------- wapm-resolve-url/Cargo.toml | 3 +- wapm-resolve-url/src/lib.rs | 40 +++++++++++++------ 5 files changed, 74 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89769dda..10b3033e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3780,12 +3780,28 @@ dependencies = [ "tokio", "toml", "url 2.2.2", + "wapm-resolve-url 0.1.0", "wapm-toml", "wasm-bus-process 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bus-reqwest 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-wasm-interface", "wasmparser", - "whoami 0.5.3", + "whoami 1.2.1", +] + +[[package]] +name = "wapm-resolve-url" +version = "0.1.0" +dependencies = [ + "anyhow", + "graphql_client", + "reqwest", + "serde", + "serde_json", + "thiserror", + "url 2.2.2", + "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "whoami 1.2.1", ] @@ -4159,7 +4175,7 @@ dependencies = [ "serde_derive", "tokio", "url 2.2.2", - "wapm-resolve-url", + "wapm-resolve-url 0.1.0 (git+https://github.com/wasmerio/wapm-cli?rev=0134b850f20af5b10dbd5b5958351dd64431c957)", "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "webc", diff --git a/Cargo.toml b/Cargo.toml index e48ee61b..0de69452 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,16 +44,16 @@ blake3 = { version = "0.3.1", optional = true } indicatif = "0.16.2" dialoguer = "0.10.1" shellwords = "1.1.0" +whoami = "1.2.1" +wapm-resolve-url = { version = "0.1.0", path = "./wapm-resolve-url" } [target.'cfg(not(target_os = "wasi"))'.dependencies] -whoami = "1.1.5" atty = "0.2" reqwest = { version = "0.11.0", features = ["native-tls-vendored", "blocking", "json", "gzip","socks","multipart"], optional = true } tar = { version = "0.4" } tokio = { version = "1.19.2", features = ["full"] } [target.'cfg(target_os = "wasi")'.dependencies] -whoami = "0.5" wasm-bus-reqwest = "1.0" wasm-bus-process = "1.0" getrandom = "0.2.3" diff --git a/src/commands/install.rs b/src/commands/install.rs index 8dd1fb54..18966cb1 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -7,6 +7,7 @@ use crate::dataflow::{ use crate::graphql::execute_query; use graphql_client::*; +use wapm_resolve_url::get_webc_url_of_package; use crate::config::Config; use crate::dataflow; @@ -40,9 +41,6 @@ enum InstallError { #[error("Package not found in the registry: {name}")] PackageNotFound { name: String }, - #[error("No package versions available for package {name}")] - NoVersionsAvailable { name: String }, - #[error("Failed to install packages. {0}")] CannotRegenLockFile(dataflow::Error), @@ -138,8 +136,16 @@ pub fn install(options: InstallOpt) -> anyhow::Result<()> { } fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result> { + + use wapm_resolve_url::get_tar_gz_url_of_package; + use url::Url; + + let config = Config::from_file()?; + let registry_url = Url::parse(&config.registry.get_graphql_url())?; + let mut result = vec![]; for name in package_args { + let name_with_version: Vec<&str> = name.split("@").collect(); let package_name = match &name_with_version[..] { @@ -149,59 +155,25 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result Some(version.clone()), + _ => None, + }; - let versions = packages - .iter() - .flat_map(|packageversion| { - if &packageversion.name != package_name { - Vec::new() - } else { - packageversion - .versions - .iter() - .flat_map(|v| { - v.into_iter().filter_map(|v| { - let v = v.as_ref()?; - Some(WapmDistribution { - name: name.clone(), - version: v.version.clone(), - download_url: v.distribution.download_url.clone(), - pirita_download_url: v.distribution.pirita_download_url.clone(), - is_last_version: v.is_last_version, - }) - }) - }) - .collect() - } - }) - .collect::>(); + let (targz_url, version) = get_tar_gz_url_of_package(®istry_url, &package_name, package_version) + .ok_or(InstallError::PackageNotFound { + name: name.to_string(), + })?; - if versions.is_empty() { - return Err(InstallError::NoVersionsAvailable { - name: name.to_string(), - } - .into()); - } + let pirita_url = get_webc_url_of_package(®istry_url, &package_name, Some(&version)); - let package_to_download = match &name_with_version[..] { - [_, package_version] => versions - .iter() - .find(|p| p.version.as_str() == *package_version), - [_] => versions.iter().find(|p| p.is_last_version), - _ => None, - } - .ok_or(InstallError::InvalidPackageIdentifier { name: name.clone() })?; + let package_to_download = WapmDistribution { + name: package_name.to_string(), + version: version.to_string(), + download_url: format!("{targz_url}"), + pirita_download_url: pirita_url.map(|(u, _)| format!("{u}")), + is_last_version: package_version.is_none(), + }; result.push(package_to_download.clone()); } diff --git a/wapm-resolve-url/Cargo.toml b/wapm-resolve-url/Cargo.toml index 1b588429..8ae9bfb2 100644 --- a/wapm-resolve-url/Cargo.toml +++ b/wapm-resolve-url/Cargo.toml @@ -10,12 +10,11 @@ serde = { version = "1.0", default-features = false, features = ["derive"] } thiserror = "1.0" anyhow = "1.0" serde_json = "1.0.81" +whoami = "1.2.1" [target.'cfg(not(target_os = "wasi"))'.dependencies] -whoami = "1.1.5" reqwest = { version = "0.11.0", features = ["rustls-tls", "blocking", "json", "gzip","socks", "multipart"] } [target.'cfg(target_os = "wasi")'.dependencies] -whoami = "0.5" wasm-bus-reqwest = { git = "https://github.com/tokera-com/ate", rev = "77b2bca4264e1fcb3d977650c09bb228a782b6f2" } wasm-bus-process = { git = "https://github.com/tokera-com/ate", rev = "77b2bca4264e1fcb3d977650c09bb228a782b6f2" } diff --git a/wapm-resolve-url/src/lib.rs b/wapm-resolve-url/src/lib.rs index 19e8e5f1..25405a7c 100644 --- a/wapm-resolve-url/src/lib.rs +++ b/wapm-resolve-url/src/lib.rs @@ -41,7 +41,7 @@ pub fn get_current_wapm_registry() -> Option { Some(Url::parse(std::str::from_utf8(&command.stdout).ok()?).ok()?) } -pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option { +pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option<(Url, String)> { let q = GetPackageQueryTarGz::build_query(get_package_query_tar_gz::Variables { name: package_id.to_string(), @@ -50,20 +50,28 @@ pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Opti match version { Some(specific) => { - let url = all_package_versions.package?.versions? + let last_package = all_package_versions.package?.versions?; + + let last_package = last_package .iter() .filter_map(|v| v.as_ref()) .filter(|v| v.version == specific) - .next() - .map(|v| v.distribution.download_url.clone())?; + .next()?; - Url::parse(&url).ok() + Url::parse(&last_package.distribution.download_url) + .ok() + .map(|u| (u, last_package.version.clone())) + }, + None => { + let last_version = all_package_versions.package?.last_version?; + Url::parse(&last_version.distribution.download_url) + .ok() + .map(|u| (u, last_version.version.clone())) }, - None => Url::parse(&all_package_versions.package?.last_version?.distribution.download_url).ok(), } } -pub fn get_webc_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option { +pub fn get_webc_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option<(Url, String)> { let q = GetPackageQueryPirita::build_query(get_package_query_pirita::Variables { name: package_id.to_string(), @@ -72,15 +80,23 @@ pub fn get_webc_url_of_package(registry: &Url, package_id: &str, version: Option match version { Some(specific) => { - let url = all_package_versions.package?.versions? + let last_package = all_package_versions.package?.versions?; + + let last_package = last_package .iter() .filter_map(|v| v.as_ref()) .filter(|v| v.version == specific) - .next() - .map(|v| v.distribution.pirita_download_url.clone())?; + .next()?; - Url::parse(url.as_ref().map(|s| s.as_str())?).ok() + Url::parse(&last_package.distribution.pirita_download_url.as_ref().map(|s| s.as_str())?) + .ok() + .map(|u| (u, last_package.version.clone())) + }, + None =>{ + let last_version = all_package_versions.package?.last_version?; + Url::parse(&last_version.distribution.pirita_download_url.as_ref().map(|s| s.as_str())?) + .ok() + .map(|u| (u, last_version.version.clone())) }, - None => Url::parse(&all_package_versions.package?.last_version?.distribution.pirita_download_url?).ok(), } } From 57588a2731c294b1bae6a13596fd05aa298539af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 14:56:51 +0200 Subject: [PATCH 25/74] Update pirita version --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/commands/install.rs | 4 ++-- wapm-resolve-url/src/lib.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10b3033e..44f20877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2212,7 +2212,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0967fda8971b0e2b0757c40d656f6ed5cad8d2e9#0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=4518275fa2abb28e9b930a32b99c5e5f9cb33470#4518275fa2abb28e9b930a32b99c5e5f9cb33470" dependencies = [ "webc", "webc-runner", @@ -4139,7 +4139,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0967fda8971b0e2b0757c40d656f6ed5cad8d2e9#0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=4518275fa2abb28e9b930a32b99c5e5f9cb33470#4518275fa2abb28e9b930a32b99c5e5f9cb33470" dependencies = [ "anyhow", "base64 0.13.0", @@ -4162,7 +4162,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=0967fda8971b0e2b0757c40d656f6ed5cad8d2e9#0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=4518275fa2abb28e9b930a32b99c5e5f9cb33470#4518275fa2abb28e9b930a32b99c5e5f9cb33470" dependencies = [ "anyhow", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 0de69452..07447953 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] git = "https://github.com/wasmerio/pirita.git" -rev = "0967fda8971b0e2b0757c40d656f6ed5cad8d2e9" +rev = "4518275fa2abb28e9b930a32b99c5e5f9cb33470" default-features = false optional = true diff --git a/src/commands/install.rs b/src/commands/install.rs index 18966cb1..3b30433a 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -7,7 +7,7 @@ use crate::dataflow::{ use crate::graphql::execute_query; use graphql_client::*; -use wapm_resolve_url::get_webc_url_of_package; +use wapm_resolve_url::get_pirita_url_of_package; use crate::config::Config; use crate::dataflow; @@ -165,7 +165,7 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result) -> Option<(Url, String)> { +pub fn get_pirita_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option<(Url, String)> { let q = GetPackageQueryPirita::build_query(get_package_query_pirita::Variables { name: package_id.to_string(), From 820d68555f301a55719ad80bce1b4f8b9f62c50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 15:05:55 +0200 Subject: [PATCH 26/74] Update whoami: use ::distro() to get distro version --- src/util.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/util.rs b/src/util.rs index 3e042209..1b3aecd4 100644 --- a/src/util.rs +++ b/src/util.rs @@ -320,12 +320,6 @@ pub fn create_temp_dir() -> Result { Ok(ret) } -#[cfg(target_os = "wasi")] -pub fn whoami_distro() -> String { - whoami::os().to_lowercase() -} - -#[cfg(not(target_os = "wasi"))] pub fn whoami_distro() -> String { whoami::distro().to_lowercase() } From 0394dcaea797db58299f46eab1cde7f8329cf700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 15:57:03 +0200 Subject: [PATCH 27/74] Update pirita version again --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- wapm-resolve-url/src/lib.rs | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44f20877..fb61c389 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2212,7 +2212,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=4518275fa2abb28e9b930a32b99c5e5f9cb33470#4518275fa2abb28e9b930a32b99c5e5f9cb33470" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=dc448b936147fe7db3cbfad785ab5581487d312d#dc448b936147fe7db3cbfad785ab5581487d312d" dependencies = [ "webc", "webc-runner", @@ -4139,7 +4139,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=4518275fa2abb28e9b930a32b99c5e5f9cb33470#4518275fa2abb28e9b930a32b99c5e5f9cb33470" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=dc448b936147fe7db3cbfad785ab5581487d312d#dc448b936147fe7db3cbfad785ab5581487d312d" dependencies = [ "anyhow", "base64 0.13.0", @@ -4162,7 +4162,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=4518275fa2abb28e9b930a32b99c5e5f9cb33470#4518275fa2abb28e9b930a32b99c5e5f9cb33470" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=dc448b936147fe7db3cbfad785ab5581487d312d#dc448b936147fe7db3cbfad785ab5581487d312d" dependencies = [ "anyhow", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 07447953..92dd49e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] git = "https://github.com/wasmerio/pirita.git" -rev = "4518275fa2abb28e9b930a32b99c5e5f9cb33470" +rev = "dc448b936147fe7db3cbfad785ab5581487d312d" default-features = false optional = true diff --git a/wapm-resolve-url/src/lib.rs b/wapm-resolve-url/src/lib.rs index 56ea5183..fd4694ed 100644 --- a/wapm-resolve-url/src/lib.rs +++ b/wapm-resolve-url/src/lib.rs @@ -21,9 +21,8 @@ pub struct GetPackageQueryTarGz; )] pub struct GetPackageQueryPirita; -#[cfg(target_os = "wasi")] pub fn whoami_distro() -> String { - whoami::os().to_lowercase() + whoami::distro().to_lowercase() } #[cfg(not(target_os = "wasi"))] From b1d22e0158e0565152db597313313815a4dfaa4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 19 Jul 2022 17:15:00 +0200 Subject: [PATCH 28/74] Fix bug with duplicate whoami_distro --- wapm-resolve-url/src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wapm-resolve-url/src/lib.rs b/wapm-resolve-url/src/lib.rs index fd4694ed..998fdf9e 100644 --- a/wapm-resolve-url/src/lib.rs +++ b/wapm-resolve-url/src/lib.rs @@ -25,11 +25,6 @@ pub fn whoami_distro() -> String { whoami::distro().to_lowercase() } -#[cfg(not(target_os = "wasi"))] -pub fn whoami_distro() -> String { - whoami::distro().to_lowercase() -} - pub fn get_current_wapm_registry() -> Option { let command = std::process::Command::new("wapm") .arg("config") From a854e6a9eb9bbf887ccdb07e129593778389f904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 20 Jul 2022 13:09:40 +0200 Subject: [PATCH 29/74] Increase maximum timeout to 500 seconds --- src/graphql.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graphql.rs b/src/graphql.rs index 5af52dd9..7e561209 100644 --- a/src/graphql.rs +++ b/src/graphql.rs @@ -34,7 +34,8 @@ where F: FnOnce(Form) -> Form, { let client = { - let builder = Client::builder(); + let builder = Client::builder() + .timeout(std::time::Duration::from_secs(500)); #[cfg(not(target_os = "wasi"))] let builder = if let Some(proxy) = proxy::maybe_set_up_proxy()? { From c91a30a0e0a18b9b2bcbee489af30a967a61429d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 21 Jul 2022 13:52:16 +0200 Subject: [PATCH 30/74] Do not error in registry has no piritaDownloadUrl --- .gitignore | 1 + Cargo.toml | 2 +- end-to-end-tests/ci/direct-execution.sh | 0 end-to-end-tests/direct_execute.sh | 0 graphql/queries/get_package.graphql | 13 ------------- graphql/queries/get_packages.graphql | 1 - 6 files changed, 2 insertions(+), 15 deletions(-) mode change 100644 => 100755 end-to-end-tests/ci/direct-execution.sh mode change 100644 => 100755 end-to-end-tests/direct_execute.sh delete mode 100644 graphql/queries/get_package.graphql diff --git a/.gitignore b/.gitignore index 10b369e0..d27e698f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /wapm_packages package dist +wax \.idea/ \.vscode/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 92dd49e4..d5fb17ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "https://github.com/wasmerio/pirita.git" +git = "ssh://git@github.com/wasmerio/pirita.git" rev = "dc448b936147fe7db3cbfad785ab5581487d312d" default-features = false optional = true diff --git a/end-to-end-tests/ci/direct-execution.sh b/end-to-end-tests/ci/direct-execution.sh old mode 100644 new mode 100755 diff --git a/end-to-end-tests/direct_execute.sh b/end-to-end-tests/direct_execute.sh old mode 100644 new mode 100755 diff --git a/graphql/queries/get_package.graphql b/graphql/queries/get_package.graphql deleted file mode 100644 index 43a953d2..00000000 --- a/graphql/queries/get_package.graphql +++ /dev/null @@ -1,13 +0,0 @@ -query GetPackageQuery ($name: String!) { - package: getPackage(name:$name) { - name - private - lastVersion { - version - distribution { - downloadUrl - } - manifest - } - } -} diff --git a/graphql/queries/get_packages.graphql b/graphql/queries/get_packages.graphql index 60459118..a3b75b8c 100644 --- a/graphql/queries/get_packages.graphql +++ b/graphql/queries/get_packages.graphql @@ -6,7 +6,6 @@ query GetPackagesQuery ($names: [String!]!) { isLastVersion distribution { downloadUrl - piritaDownloadUrl } signature { publicKey { From a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 21 Jul 2022 15:08:30 +0200 Subject: [PATCH 31/74] Make wapm-toml [[command.module]] optional The "module" field is optional, since it isn't required by some runners (some runners may store the module name in the annotations instead of the module field). --- src/init.rs | 2 +- wapm-toml/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.rs b/src/init.rs index a35fd493..8b77b15e 100644 --- a/src/init.rs +++ b/src/init.rs @@ -248,7 +248,7 @@ Press ^C at any time to quit." Command::V2(CommandV2 { name: command_string, runner: runner_for_modules.clone(), - module: module.name.clone(), + module: Some(module.name.clone()), annotations: None, }) }); diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index dc3e6055..436cf285 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -154,7 +154,7 @@ pub struct CommandV1 { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CommandV2 { pub name: String, - pub module: String, + pub module: Option, pub runner: String, pub annotations: Option, } From 476714f355e279eb13603708be563017eebe488a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 22 Jul 2022 12:29:10 +0200 Subject: [PATCH 32/74] Add functions for parsing wapm.toml files to wapm-toml --- Cargo.lock | 17 ++++ src/commands/install.rs | 40 ++++++-- wapm-toml/Cargo.toml | 2 + wapm-toml/src/lib.rs | 208 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 260 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb61c389..eaae3b55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3695,6 +3695,21 @@ dependencies = [ "serde", ] +[[package]] +name = "validator" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f07b0a1390e01c0fc35ebb26b28ced33c9a3808f7f9fbe94d3cc01e233bfeed5" +dependencies = [ + "idna 0.2.3", + "lazy_static", + "regex", + "serde", + "serde_derive", + "serde_json", + "url 2.2.2", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -3828,6 +3843,7 @@ name = "wapm-toml" version = "0.1.0" dependencies = [ "anyhow", + "indexmap", "semver", "serde", "serde_cbor", @@ -3836,6 +3852,7 @@ dependencies = [ "serde_yaml", "thiserror", "toml", + "validator", ] [[package]] diff --git a/src/commands/install.rs b/src/commands/install.rs index 3b30433a..d600ae77 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -59,7 +59,7 @@ enum InstallError { MustSupplyPackagesWithGlobalFlag, #[cfg(feature = "pirita_file")] #[error( - "Could not find PiritaFile donwload url for package {0}@{1}", + "Could not find PiritaFile download url for package {0}@{1}", name, version )] @@ -81,7 +81,7 @@ mod package_args { pub fn install(options: InstallOpt) -> anyhow::Result<()> { #[cfg(feature = "pirita_file")] if std::env::var("USE_PIRITA").ok() == Some("1".to_string()) { - return install_pirita(options); + return install_pirita(&options); } let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); @@ -183,7 +183,7 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result anyhow::Result<()> { +pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); debug_assert!( @@ -202,20 +202,35 @@ pub fn install_pirita(options: InstallOpt) -> anyhow::Result<()> { rt.block_on(async { for p in installed_packages { + let pirita_url = p .pirita_download_url .ok_or(InstallError::NoPiritaFileForPackage { name: p.name.clone(), version: p.version.clone(), })?; - download_pirita( + + let pirita_download_result = download_pirita( &p.name, &p.version, &pirita_url, + false, &install_directory, options.nocache || options.force_yes, ) - .await?; + .await; + + if pirita_download_result.is_err() { + download_pirita( + &p.name, + &p.version, + &pirita_url, + true, // autoconvert .tar.gz -> .pirita + &install_directory, + options.nocache || options.force_yes, + ) + .await? + } } Ok(()) }) @@ -226,6 +241,7 @@ async fn download_pirita( name: &str, version: &str, download_url: &str, + autoconvert: bool, directory: &Path, nocache: bool, ) -> Result<(String, PathBuf, String), anyhow::Error> { @@ -337,7 +353,7 @@ async fn download_pirita( if let Some(first_chunk) = response.chunk().await? { let new = (downloaded + first_chunk.len() as u64).min(total_size); downloaded = new; - if !pirita::PiritaFile::check_is_pirita_file(&first_chunk) { + if !pirita::PiritaFile::check_is_pirita_file(&first_chunk) && !autoconvert { pb.finish_and_clear(); return Err(anyhow!("Error: remote package is not a PiritaFile")); } @@ -352,9 +368,19 @@ async fn download_pirita( pb.set_position(new); } + pb.finish_and_clear(); + std::fs::rename(&temp_tar_gz_path, &target_file_path)?; - pb.finish_and_clear(); + if !pirita::PiritaFile::check_is_pirita_file(&temp_tar_gz_path) { + if !autoconvert { + std::fs::remove_file(&target_file_path)?; + return Err(anyhow!("Error: remote package is not a PiritaFile")); + } + + // autoconvert .tar.gz => .pirita after download + let _ = pirita::autoconvert_to_pirita(&temp_tar_gz_path, &target_file_path); + } } let parsed_file = pirita::PiritaFile::load_mmap(target_file_path.clone()).ok_or(anyhow!( diff --git a/wapm-toml/Cargo.toml b/wapm-toml/Cargo.toml index 671f287c..1c5f9201 100644 --- a/wapm-toml/Cargo.toml +++ b/wapm-toml/Cargo.toml @@ -15,6 +15,8 @@ semver = { version = "0.11", features = ["serde"] } serde_json = "1.0.81" serde_yaml = "0.8.24" serde_cbor = "0.11.2" +indexmap = { version = "1.6", features = ["serde"] } +validator = "0.15.0" [features] integration_tests = [] diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index 436cf285..f3be9907 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -6,6 +6,8 @@ use std::collections::hash_map::HashMap; use std::path::{Path, PathBuf}; use std::{fmt, fs}; use thiserror::Error; +use indexmap::IndexMap; +use std::collections::BTreeMap; /// The ABI is a hint to WebAssembly runtimes about what additional imports to insert. /// It currently is only used for validation (in the validation subcommand). The default value is `None`. @@ -58,6 +60,23 @@ impl Default for Abi { pub static MANIFEST_FILE_NAME: &str = "wapm.toml"; pub static PACKAGES_DIR_NAME: &str = "wapm_packages"; +pub fn get_wapm_atom_file_paths( + paths: &BTreeMap<&PathBuf, &Vec> +) -> Result, anyhow::Error> { + + let wapm_toml: Manifest = paths.get(&Path::new(MANIFEST_FILE_NAME).to_path_buf()) + .and_then(|t| toml::from_slice(t).ok()) + .ok_or(anyhow::anyhow!("Could not find wapm.toml in FileMap"))?; + + Ok(wapm_toml.module.clone().unwrap_or_default().into_iter().map(|m| { + (m.name.clone(), Path::new(&m.source).to_path_buf()) + }).collect()) +} + +pub fn get_wapm_manifest_file_name() -> PathBuf { + Path::new(MANIFEST_FILE_NAME).to_path_buf() +} + pub static README_PATHS: &[&'static str; 5] = &[ "README", "README.md", @@ -68,6 +87,79 @@ pub static README_PATHS: &[&'static str; 5] = &[ pub static LICENSE_PATHS: &[&'static str; 3] = &["LICENSE", "LICENSE.md", "COPYING"]; +pub fn get_modules(wapm: &str) -> Vec<(String, String, String)> { + let wapm: Manifest = match toml::from_str(wapm) { + Ok(o) => o, + Err(_) => { return Vec::new(); }, + }; + wapm.module.clone().unwrap_or_default().iter() + .map(|m| ( + m.name.to_string(), + m.abi.to_string(), + m.kind.as_ref().map(|s| s.as_str()).unwrap_or("wasm").to_string(), + )).collect() +} + +pub fn get_package_annotations(wapm: &str) -> serde_cbor::Value { + let wapm: Manifest = match toml::from_str(wapm) { + Ok(o) => o, + Err(_) => { return serde_cbor::Value::Null; }, + }; + transform_package_meta_to_annotations(&wapm.package) +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct PathBufWithVolume { + pub volume: String, + pub path: PathBuf, +} + +#[derive(Debug, Default, Clone, Deserialize, Serialize)] +pub struct InternalPackageMeta { + pub name: String, + pub version: String, + pub description: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub license: Option, + #[serde( + rename = "license-file", + default, + skip_serializing_if = "Option::is_none" + )] + pub license_file: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub readme: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub homepage: Option, +} + +fn transform_package_meta_to_annotations(package: &Package) -> serde_cbor::Value { + let internal_package = InternalPackageMeta { + name: package.name.clone(), + version: format!("{}", package.version), + description: package.description.clone(), + license: package.license.clone(), + license_file: package.license_file.as_ref().map(|path| PathBufWithVolume { + volume: format!("metadata"), + path: path.clone(), + }), + readme: package.readme.as_ref().map(|path| PathBufWithVolume { + volume: format!("metadata"), + path: path.clone(), + }), + repository: package.repository.clone(), + homepage: package.homepage.clone(), + }; + + // convert InternalPackageMeta to a serde_cbor::Value + serde_cbor::to_vec(&internal_package) + .ok() + .and_then(|s| serde_cbor::from_slice(&s).ok()) + .unwrap_or(serde_cbor::Value::Null) +} + /// Describes a command for a wapm module #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Package { @@ -333,6 +425,121 @@ pub struct Manifest { pub base_directory_path: PathBuf, } +// command name => (runner, annotations) +pub type WebcCommand = (String, IndexMap); + +pub fn get_commands( + wapm: &str, + base_path: &PathBuf, + atom_kinds: &BTreeMap +) -> Result, anyhow::Error> { + + let wapm: Manifest = toml::from_str(wapm)?; + let default_commands = Vec::new(); + let mut commands = BTreeMap::new(); + + for command in wapm.command.as_ref().unwrap_or(&default_commands).iter() { + match command { + Command::V1(command) => { + let name = &command.name; + let module = &command.module; + let main_args = command.main_args.as_ref(); + let package = command.package.as_ref(); + + if commands.contains_key(name) { + return Err(anyhow::anyhow!("Command {name} is defined more than once")); + } + + let runner = match atom_kinds.get(module).map(|s| s.as_str()) { + Some("emscripten") => "https://webc.org/runner/emscripten/command@unstable_", + _ => "https://webc.org/runner/wasi/command@unstable_", + }; + + let annotations_str = match atom_kinds.get(module).map(|s| s.as_str()) { + Some("emscripten") => "emscripten", + _ => "wasi", + }; + + let runner = runner.to_string(); + let annotations = { + let mut map = IndexMap::new(); + map.insert( + annotations_str.to_string(), + transform_cmd_args(&TransformCmdArgs { + atom: module.clone(), + main_args: main_args.cloned(), + package: package.cloned(), + }), + ); + map + }; + + commands.insert( + name.clone(), + (runner, annotations) + ); + } + Command::V2(command) => { + + let runner = if validator::validate_url(&command.runner) { + command.runner.to_string() + } else { + format!("https://webc.org/runner/{}", command.runner.to_string()) + }; + + let annotations = { + let mut map = IndexMap::new(); + + let annotations = command + .get_annotations(base_path) + .map_err(|e| anyhow::anyhow!("command {}: {e}", command.name))?; + + if let Some(s) = annotations { + map.insert(command.runner.clone(), s); + } + map + }; + + commands.insert( + command.name.clone(), + (runner, annotations), + ); + } + } + } + + Ok(commands) +} + +pub fn get_manifest_file_names() -> Vec { + vec![Path::new(MANIFEST_FILE_NAME).to_path_buf()] +} + +pub fn get_metadata_paths() -> Vec { + let mut paths = Vec::new(); + for p in README_PATHS.iter() { + paths.push(Path::new(p).to_path_buf()); + } + for p in LICENSE_PATHS.iter() { + paths.push(Path::new(p).to_path_buf()); + } + paths +} + +#[derive(Serialize, Deserialize)] +struct TransformCmdArgs { + atom: String, + main_args: Option, + package: Option, +} + +fn transform_cmd_args(args: &TransformCmdArgs) -> serde_cbor::Value { + serde_cbor::to_vec(&args) + .ok() + .and_then(|s| serde_cbor::from_slice(&s).ok()) + .unwrap_or(serde_cbor::Value::Null) +} + #[cfg(feature = "integration_tests")] pub mod integration_tests { pub mod data { @@ -353,6 +560,7 @@ pub mod integration_tests { } } } + impl Manifest { fn locate_file(path: &Path, candidates: &[&str]) -> Option { for filename in candidates { From b11b8f51cd632a6736cb34eadf2977ec8d919827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 22 Jul 2022 13:29:18 +0200 Subject: [PATCH 33/74] Added autoconvert-on-download functionality to wapm-cli --- Cargo.lock | 227 ++++++++++++++++++++++++++++++++-------- Cargo.toml | 3 +- src/commands/execute.rs | 2 +- src/commands/install.rs | 68 +++++++----- wapm-toml/src/lib.rs | 38 ++++--- 5 files changed, 250 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eaae3b55..89000551 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -54,7 +54,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -297,13 +297,25 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding 0.1.5", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -312,7 +324,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -321,10 +333,19 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" dependencies = [ - "block-padding", + "block-padding 0.2.1", "cipher", ] +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + [[package]] name = "block-padding" version = "0.2.1" @@ -339,7 +360,7 @@ checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b" dependencies = [ "byteorder", "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -375,6 +396,12 @@ version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "byteorder" version = "1.4.3" @@ -395,7 +422,7 @@ checksum = "1285caf81ea1f1ece6b24414c521e625ad0ec94d880625c20f2e65d8d3f78823" dependencies = [ "byteorder", "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -438,7 +465,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -613,7 +640,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" dependencies = [ - "generic-array", + "generic-array 0.14.5", "typenum", ] @@ -623,7 +650,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array", + "generic-array 0.14.5", "subtle", ] @@ -634,7 +661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ "cipher", - "generic-array", + "generic-array 0.14.5", "subtle", ] @@ -644,7 +671,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "generic-array", + "generic-array 0.14.5", "subtle", ] @@ -698,7 +725,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -740,7 +767,7 @@ checksum = "b24e7c748888aa2fa8bce21d8c64a52efc810663285315ac7476f7197a982fae" dependencies = [ "byteorder", "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -760,13 +787,22 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -910,7 +946,7 @@ checksum = "c13e9b0c3c4170dcc2a12783746c4205d98e18957f57854251eea3f9750fe005" dependencies = [ "bitvec", "ff", - "generic-array", + "generic-array 0.14.5", "group", "pkcs8", "rand_core 0.6.3", @@ -1028,6 +1064,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -1216,6 +1258,15 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + [[package]] name = "generic-array" version = "0.14.5" @@ -1554,7 +1605,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcdd4b114cf2265123bbdc5d32a39f96a343fbdf141267d2b5232b7e14caacb3" dependencies = [ "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -1647,6 +1698,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "lalrpop" version = "0.19.8" @@ -1807,7 +1869,7 @@ checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" dependencies = [ "block-buffer 0.9.0", "digest 0.9.0", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -2030,6 +2092,12 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + [[package]] name = "opaque-debug" version = "0.3.0" @@ -2178,6 +2246,40 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1 0.8.2", +] + [[package]] name = "petgraph" version = "0.6.2" @@ -2212,8 +2314,10 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=dc448b936147fe7db3cbfad785ab5581487d312d#dc448b936147fe7db3cbfad785ab5581487d312d" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" dependencies = [ + "anyhow", + "wapm-targz-to-pirita", "webc", "webc-runner", ] @@ -2553,7 +2657,7 @@ checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" dependencies = [ "block-buffer 0.9.0", "digest 0.9.0", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -2892,7 +2996,7 @@ dependencies = [ "anyhow", "base64 0.13.0", "block-modes", - "block-padding", + "block-padding 0.2.1", "blowfish", "buffered-reader", "cast5", @@ -2904,7 +3008,7 @@ dependencies = [ "eax", "ecdsa", "ed25519-dalek", - "generic-array", + "generic-array 0.14.5", "getrandom 0.2.6", "idea", "idna 0.2.3", @@ -2922,7 +3026,7 @@ dependencies = [ "regex-syntax", "ripemd160", "rsa", - "sha-1", + "sha-1 0.9.8", "sha1collisiondetection", "sha2 0.9.9", "thiserror", @@ -3009,6 +3113,18 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -3019,7 +3135,7 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -3029,7 +3145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31bf4e9fe5cd8cea8e0887e2e4eb1b4d736ff11b776c8537bf0912a4b381285" dependencies = [ "digest 0.9.0", - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -3042,7 +3158,7 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -3234,6 +3350,16 @@ dependencies = [ "xattr", ] +[[package]] +name = "tar" +version = "0.4.38" +source = "git+https://github.com/fschutt/tar-rs?rev=04ded46840bb195f6c14ca85c5a6d25b61ca349c#04ded46840bb195f6c14ca85c5a6d25b61ca349c" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "tar-wasi" version = "0.4.38" @@ -3553,7 +3679,7 @@ checksum = "0028f5982f23ecc9a1bc3008ead4c664f843ed5d78acd3d213b99ff50c441bc2" dependencies = [ "byteorder", "cipher", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -3787,7 +3913,7 @@ dependencies = [ "serde_yaml", "shellwords", "structopt", - "tar", + "tar 0.4.38 (registry+https://github.com/rust-lang/crates.io-index)", "tar-wasi", "tempfile", "thiserror", @@ -3801,7 +3927,7 @@ dependencies = [ "wasm-bus-reqwest 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-wasm-interface", "wasmparser", - "whoami 1.2.1", + "whoami", ] [[package]] @@ -3817,13 +3943,13 @@ dependencies = [ "url 2.2.2", "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "whoami 1.2.1", + "whoami", ] [[package]] name = "wapm-resolve-url" version = "0.1.0" -source = "git+https://github.com/wasmerio/wapm-cli?rev=0134b850f20af5b10dbd5b5958351dd64431c957#0134b850f20af5b10dbd5b5958351dd64431c957" +source = "git+https://github.com/wasmerio/wapm-cli?rev=a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e#a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e" dependencies = [ "anyhow", "graphql_client", @@ -3834,8 +3960,29 @@ dependencies = [ "url 2.2.2", "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "whoami 0.5.3", - "whoami 1.2.1", + "whoami", +] + +[[package]] +name = "wapm-targz-to-pirita" +version = "0.1.0" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" +dependencies = [ + "anyhow", + "base64 0.13.0", + "flate2", + "indexmap", + "json5", + "rand 0.8.5", + "sequoia-openpgp", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "sha2 0.10.2", + "tar 0.4.38 (git+https://github.com/fschutt/tar-rs?rev=04ded46840bb195f6c14ca85c5a6d25b61ca349c)", + "validator", + "webc", ] [[package]] @@ -4156,7 +4303,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=dc448b936147fe7db3cbfad785ab5581487d312d#dc448b936147fe7db3cbfad785ab5581487d312d" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" dependencies = [ "anyhow", "base64 0.13.0", @@ -4179,7 +4326,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=dc448b936147fe7db3cbfad785ab5581487d312d#dc448b936147fe7db3cbfad785ab5581487d312d" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" dependencies = [ "anyhow", "futures-util", @@ -4192,7 +4339,7 @@ dependencies = [ "serde_derive", "tokio", "url 2.2.2", - "wapm-resolve-url 0.1.0 (git+https://github.com/wasmerio/wapm-cli?rev=0134b850f20af5b10dbd5b5958351dd64431c957)", + "wapm-resolve-url 0.1.0 (git+https://github.com/wasmerio/wapm-cli?rev=a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e)", "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", "webc", @@ -4217,12 +4364,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "whoami" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7154f3f4488071a38189dfd63633df444e7be43b731cc12c41505308fc4972f3" - [[package]] name = "whoami" version = "1.2.1" diff --git a/Cargo.toml b/Cargo.toml index d5fb17ee..3b0e9b8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,8 +63,9 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] git = "ssh://git@github.com/wasmerio/pirita.git" -rev = "dc448b936147fe7db3cbfad785ab5581487d312d" +rev = "d1dbf285bee48c9d29057791ab34229008f46483" default-features = false +features = ["autoconvert"] optional = true [dev-dependencies] diff --git a/src/commands/execute.rs b/src/commands/execute.rs index b7e543ee..6de9cb45 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -411,7 +411,7 @@ pub fn execute(opt: ExecuteOpt) -> anyhow::Result<()> { nocache: true, force_yes: true, }; - crate::commands::install::install_pirita(install_opts)?; + crate::commands::install::install_pirita(&install_opts)?; let run_opts = crate::commands::run::RunOpt { command: command.command.clone(), pre_opened_directories: Vec::new(), diff --git a/src/commands/install.rs b/src/commands/install.rs index d600ae77..5d3e2db0 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -203,33 +203,29 @@ pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { rt.block_on(async { for p in installed_packages { - let pirita_url = p - .pirita_download_url - .ok_or(InstallError::NoPiritaFileForPackage { - name: p.name.clone(), - version: p.version.clone(), - })?; - - let pirita_download_result = download_pirita( - &p.name, - &p.version, - &pirita_url, - false, - &install_directory, - options.nocache || options.force_yes, - ) - .await; - - if pirita_download_result.is_err() { - download_pirita( - &p.name, - &p.version, - &pirita_url, - true, // autoconvert .tar.gz -> .pirita - &install_directory, - options.nocache || options.force_yes, - ) - .await? + match p.pirita_download_url.as_ref() { + Some(pirita_url) => { + download_pirita( + &p.name, + &p.version, + &pirita_url, + false, + &install_directory, + options.nocache || options.force_yes, + ) + .await?; + }, + None => { + download_pirita( + &p.name, + &p.version, + &p.download_url, + true, // autoconvert .tar.gz -> .pirita + &install_directory, + options.nocache || options.force_yes, + ) + .await?; + } } } Ok(()) @@ -372,14 +368,28 @@ async fn download_pirita( std::fs::rename(&temp_tar_gz_path, &target_file_path)?; - if !pirita::PiritaFile::check_is_pirita_file(&temp_tar_gz_path) { + if !pirita::PiritaFile::load_mmap(temp_tar_gz_path.clone()).is_none() { if !autoconvert { std::fs::remove_file(&target_file_path)?; return Err(anyhow!("Error: remote package is not a PiritaFile")); } // autoconvert .tar.gz => .pirita after download - let _ = pirita::autoconvert_to_pirita(&temp_tar_gz_path, &target_file_path); + let _ = pirita::convert_targz_to_pirita( + &temp_tar_gz_path, + &target_file_path, + None, + &pirita::TransformManifestFunctions { + get_atoms_wapm_toml: wapm_toml::get_wapm_atom_file_paths, + get_dependencies: wapm_toml::get_dependencies, + get_package_annotations: wapm_toml::get_package_annotations, + get_modules: wapm_toml::get_modules, + get_commands: wapm_toml::get_commands, + get_manifest_file_names: wapm_toml::get_manifest_file_names, + get_metadata_paths: wapm_toml::get_metadata_paths, + get_wapm_manifest_file_name: wapm_toml::get_wapm_manifest_file_name, + }, + ); } } diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index f3be9907..4d499a86 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -60,6 +60,16 @@ impl Default for Abi { pub static MANIFEST_FILE_NAME: &str = "wapm.toml"; pub static PACKAGES_DIR_NAME: &str = "wapm_packages"; +pub fn get_dependencies(wapm: &str) -> Vec<(String, String)>{ + let wapm: Manifest = match toml::from_str(wapm) { + Ok(o) => o, + Err(_) => { return Vec::new(); }, + }; + wapm.dependencies + .clone().unwrap_or_default() + .iter().map(|(k, v)| (k.clone(), v.clone())).collect() +} + pub fn get_wapm_atom_file_paths( paths: &BTreeMap<&PathBuf, &Vec> ) -> Result, anyhow::Error> { @@ -426,17 +436,17 @@ pub struct Manifest { } // command name => (runner, annotations) -pub type WebcCommand = (String, IndexMap); +pub type WebcCommand = (String, Vec<(String, serde_cbor::Value)>); pub fn get_commands( wapm: &str, base_path: &PathBuf, atom_kinds: &BTreeMap -) -> Result, anyhow::Error> { +) -> Result, anyhow::Error> { let wapm: Manifest = toml::from_str(wapm)?; let default_commands = Vec::new(); - let mut commands = BTreeMap::new(); + let mut commands = Vec::new(); for command in wapm.command.as_ref().unwrap_or(&default_commands).iter() { match command { @@ -446,7 +456,7 @@ pub fn get_commands( let main_args = command.main_args.as_ref(); let package = command.package.as_ref(); - if commands.contains_key(name) { + if commands.iter().any(|(k, _)| k == name) { return Err(anyhow::anyhow!("Command {name} is defined more than once")); } @@ -462,23 +472,23 @@ pub fn get_commands( let runner = runner.to_string(); let annotations = { - let mut map = IndexMap::new(); - map.insert( + let mut map = Vec::new(); + map.push(( annotations_str.to_string(), transform_cmd_args(&TransformCmdArgs { atom: module.clone(), main_args: main_args.cloned(), package: package.cloned(), }), - ); + )); map }; - commands.insert( + commands.push(( name.clone(), (runner, annotations) - ); - } + )); + }, Command::V2(command) => { let runner = if validator::validate_url(&command.runner) { @@ -488,22 +498,22 @@ pub fn get_commands( }; let annotations = { - let mut map = IndexMap::new(); + let mut map = Vec::new(); let annotations = command .get_annotations(base_path) .map_err(|e| anyhow::anyhow!("command {}: {e}", command.name))?; if let Some(s) = annotations { - map.insert(command.runner.clone(), s); + map.push((command.runner.clone(), s)); } map }; - commands.insert( + commands.push(( command.name.clone(), (runner, annotations), - ); + )); } } } From 4da881b1a10e6f647fda158774d403c1de6e7878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 22 Jul 2022 14:49:24 +0200 Subject: [PATCH 34/74] Update pirita dependency --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89000551..3046ee59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2314,7 +2314,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "wapm-targz-to-pirita", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "base64 0.13.0", @@ -4303,7 +4303,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "base64 0.13.0", @@ -4326,7 +4326,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=d1dbf285bee48c9d29057791ab34229008f46483#d1dbf285bee48c9d29057791ab34229008f46483" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 3b0e9b8c..a972db03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,8 +62,8 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "ssh://git@github.com/wasmerio/pirita.git" -rev = "d1dbf285bee48c9d29057791ab34229008f46483" +git = "https://github.com/wasmerio/pirita.git" +rev = "1f898dca174c1a4effab78c16159a4b5515b8cdb" default-features = false features = ["autoconvert"] optional = true From f4dadbae907d28509df51944edcf3b7848f37783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 22 Jul 2022 19:02:21 +0200 Subject: [PATCH 35/74] Remove package from /tmp/wax on uninstall + add pirita uninstall --- Cargo.toml | 2 +- src/commands/execute.rs | 2 +- src/commands/install.rs | 53 ++++++++++++++++++++++++++++++++------- src/commands/run.rs | 2 +- src/commands/uninstall.rs | 22 ++++++++++++++-- src/data/wax_index.rs | 36 ++++++++++++++++++++++++++ 6 files changed, 103 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a972db03..1a74f969 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "https://github.com/wasmerio/pirita.git" +git = "ssh://git@github.com/wasmerio/pirita.git" rev = "1f898dca174c1a4effab78c16159a4b5515b8cdb" default-features = false features = ["autoconvert"] diff --git a/src/commands/execute.rs b/src/commands/execute.rs index 6de9cb45..9e1c5bce 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -143,7 +143,7 @@ enum ExecuteArgParsingError { query_path = "graphql/queries/wax_get_command.graphql", response_derives = "Debug" )] -struct WaxGetCommandQuery; +pub struct WaxGetCommandQuery; #[derive(GraphQLQuery)] #[graphql( diff --git a/src/commands/install.rs b/src/commands/install.rs index 5d3e2db0..10534f33 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -148,22 +148,53 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result = name.split("@").collect(); - let package_name = match &name_with_version[..] { - [package_name, _] => Some(package_name), - [package_name] => Some(package_name), + let mut package_name = match &name_with_version[..] { + [package_name, _] => Some(package_name.to_string()), + [package_name] => Some(package_name.to_string()), _ => None, } .ok_or(InstallError::InvalidPackageIdentifier { name: name.clone() })?; - let package_version = match &name_with_version[..] { - [_, version] => Some(version.clone()), + let mut package_version = match &name_with_version[..] { + [_, version] => Some(version.to_string()), _ => None, }; - let (targz_url, version) = get_tar_gz_url_of_package(®istry_url, &package_name, package_version) - .ok_or(InstallError::PackageNotFound { - name: name.to_string(), - })?; + use crate::commands::execute::{WaxGetCommandQuery, wax_get_command_query}; + let get_wax_package_name = |name: String| { + let q = WaxGetCommandQuery::build_query(wax_get_command_query::Variables { + command: name, + }); + debug!("Querying server for package info"); + let response: Result = execute_query(&q); + match response { + Ok(o) => Some(( + o.command.as_ref()?.package_version.package.name.to_string(), + o.command.as_ref()?.package_version.version.to_string(), + )), + Err(_) => None, + } + }; + + let pv = package_version.clone(); + let pv = pv.as_ref().map(|s| s.as_str()); + let (targz_url, version) = match get_tar_gz_url_of_package(®istry_url, &package_name, pv) { + Some(s) => s, + None => { + if let Some((wax_package_name, wax_package_version)) = get_wax_package_name(package_name) { + package_name = wax_package_name.clone(); + package_version = Some(wax_package_version.clone()); + get_tar_gz_url_of_package(®istry_url, &wax_package_name, Some(&wax_package_version)) + .ok_or(InstallError::PackageNotFound { + name: name.to_string(), + })? + } else { + return Err(InstallError::PackageNotFound { + name: name.to_string(), + }.into()); + } + } + }; let pirita_url = get_pirita_url_of_package(®istry_url, &package_name, Some(&version)); @@ -184,6 +215,7 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result anyhow::Result<()> { + let current_directory = crate::config::Config::get_current_dir()?; let _value = util::set_wapm_should_accept_all_prompts(options.force_yes); debug_assert!( @@ -287,6 +319,7 @@ async fn download_pirita( whoami::platform(), whoami_distro(), ); + let mut response = client .get(download_url) .header(header::USER_AGENT, user_agent) @@ -374,6 +407,8 @@ async fn download_pirita( return Err(anyhow!("Error: remote package is not a PiritaFile")); } + println!("autoconverting!"); + // autoconvert .tar.gz => .pirita after download let _ = pirita::convert_targz_to_pirita( &temp_tar_gz_path, diff --git a/src/commands/run.rs b/src/commands/run.rs index 501a6921..8811247e 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -163,7 +163,7 @@ pub fn run(run_options: RunOpt) -> anyhow::Result<()> { Err(e) => { return Err(e.into()); }, Ok(o) => o, }; - + match command { find_command_result::Command::TarGz(find_command_result::TarGzCommand { source: source_path_buf, diff --git a/src/commands/uninstall.rs b/src/commands/uninstall.rs index 341fd69b..cf6f6de7 100644 --- a/src/commands/uninstall.rs +++ b/src/commands/uninstall.rs @@ -1,4 +1,6 @@ use crate::config::Config; +use crate::data::wax_index; +use crate::data::manifest::PACKAGES_DIR_NAME; use crate::dataflow; use structopt::StructOpt; use thiserror::Error; @@ -32,9 +34,25 @@ pub fn uninstall(options: UninstallOpt) -> anyhow::Result<()> { // returned bool indicates if there was any to the lockfile. If this pacakge is uninstalled, // there will be a diff created, which causes update to return true. Because no other change // is made, we can assume any change resulted in successfully uninstalled package. - let result = dataflow::update(vec![], uninstalled_package_names, dir)?; + let result = dataflow::update(vec![], uninstalled_package_names, dir.clone())?; - if !result { + // Uninstall the package from /tmp/wax/... + let mut wax_uninstalled = false; + let mut wax_index = wax_index::WaxIndex::open()?; + if wax_index.search_for_entry(options.package.clone()).is_ok() { + wax_index.remove_entry(options.package.as_str())?; + wax_index.save()?; + wax_uninstalled = true; + } + + let mut pirita_uninstalled = false; + let path = dir.join(PACKAGES_DIR_NAME).join(".bin").join(options.package.as_str()); + if path.exists() { + std::fs::remove_file(&path)?; + pirita_uninstalled = true; + } + + if !result && !wax_uninstalled && !pirita_uninstalled { info!("Package \"{}\" is not installed.", options.package); } else { info!("Package \"{}\" uninstalled.", options.package); diff --git a/src/data/wax_index.rs b/src/data/wax_index.rs index 0aad14b8..817b6997 100644 --- a/src/data/wax_index.rs +++ b/src/data/wax_index.rs @@ -134,6 +134,18 @@ impl WaxIndex { .into()); } + pub fn remove_entry(&mut self, entry: &str) -> Result<(), WaxIndexError>{ + let (package_name, version, _) = self.search_for_entry(entry.to_string())?; + let path = self.base_path().join(&format!("{package_name}@{version}")); + if path.exists() && path.is_dir() { + nuke_dir(path) + .map_err(|_| WaxIndexError::EntryCorrupt { entry: entry.to_string() })?; + self.index.remove(entry) + .ok_or(WaxIndexError::EntryNotFound { entry: entry.to_string() })?; + } + Ok(()) + } + /// Package installed, add it to the index. /// /// Returns true if an existing entry was updated. @@ -151,6 +163,30 @@ impl WaxIndex { } } +pub fn nuke_dir>(path: P) -> Result<(), String> { + let path = path.as_ref(); + for entry in fs::read_dir(path) + .map_err(|e| format!("{}: {}", path.display(), e))? { + let entry = entry + .map_err(|e| format!("{}: {}", path.display(), e))?; + let path = entry.path(); + + let file_type = entry.file_type() + .map_err(|e| format!("{}: {}", path.display(), e))?; + + if file_type.is_dir() { + nuke_dir(&path)?; + std::fs::remove_dir(&path) + .map_err(|e| format!("{}: {}", path.display(), e))?; + } else { + std::fs::remove_file(&path) + .map_err(|e| format!("{}: {}", path.display(), e))?; + } + } + + Ok(()) +} + #[derive(Debug, Error)] pub enum WaxIndexError { #[error("Error finding Wax Index: {0}")] From 0a2bc20206d6ee21c82d33bf24cdad72357fb429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 22 Jul 2022 19:29:01 +0200 Subject: [PATCH 36/74] Add fallback .tar.gz download in case pirita sanity check fails --- src/commands/install.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/commands/install.rs b/src/commands/install.rs index 10534f33..5027da57 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -237,7 +237,7 @@ pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { match p.pirita_download_url.as_ref() { Some(pirita_url) => { - download_pirita( + if let Err(_) = download_pirita( &p.name, &p.version, &pirita_url, @@ -245,7 +245,18 @@ pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { &install_directory, options.nocache || options.force_yes, ) - .await?; + .await { + println!("download with autoconversion!"); + download_pirita( + &p.name, + &p.version, + &p.download_url, + true, // autoconvert .tar.gz -> .pirita + &install_directory, + options.nocache || options.force_yes, + ) + .await?; + } }, None => { download_pirita( @@ -341,7 +352,7 @@ async fn download_pirita( .and_then(|c| c.to_str().ok()?.parse().ok()) .unwrap_or(u64::MAX); - if nocache || ( + if nocache || autoconvert || ( target_file_path.exists() && target_file_path.metadata()?.len() == total_size && Confirm::new() @@ -382,7 +393,7 @@ async fn download_pirita( if let Some(first_chunk) = response.chunk().await? { let new = (downloaded + first_chunk.len() as u64).min(total_size); downloaded = new; - if !pirita::PiritaFile::check_is_pirita_file(&first_chunk) && !autoconvert { + if !autoconvert && !pirita::PiritaFile::check_is_pirita_file(&first_chunk) { pb.finish_and_clear(); return Err(anyhow!("Error: remote package is not a PiritaFile")); } @@ -401,13 +412,9 @@ async fn download_pirita( std::fs::rename(&temp_tar_gz_path, &target_file_path)?; - if !pirita::PiritaFile::load_mmap(temp_tar_gz_path.clone()).is_none() { - if !autoconvert { - std::fs::remove_file(&target_file_path)?; - return Err(anyhow!("Error: remote package is not a PiritaFile")); - } + if autoconvert && pirita::PiritaFile::load_mmap(temp_tar_gz_path.clone()).is_none() { - println!("autoconverting!"); + std::fs::remove_file(&target_file_path)?; // autoconvert .tar.gz => .pirita after download let _ = pirita::convert_targz_to_pirita( From 8c8d4f267bd7f680ef45085e9d91701e0a2558c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 10:12:35 +0200 Subject: [PATCH 37/74] Remove PiritaFile support unless USE_PIRITA=1 is set --- src/commands/execute.rs | 2 +- src/commands/run.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/commands/execute.rs b/src/commands/execute.rs index 9e1c5bce..d1676776 100644 --- a/src/commands/execute.rs +++ b/src/commands/execute.rs @@ -385,7 +385,7 @@ pub fn execute(opt: ExecuteOpt) -> anyhow::Result<()> { loop { use crate::commands::run::PiritaRunError; - if opt.offline { + if opt.offline || std::env::var("USE_PIRITA") != Ok("1".to_string()) { break; } diff --git a/src/commands/run.rs b/src/commands/run.rs index 8811247e..303a11f1 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -129,10 +129,12 @@ fn run_pirita(args: &[String], rt_args: &[OsString]) -> Result<(), anyhow::Error pub fn run(run_options: RunOpt) -> anyhow::Result<()> { - match try_run_pirita(&run_options) { - Ok(()) => return Ok(()), - Err(PiritaRunError::Initialize(_)) => { }, - Err(PiritaRunError::Run(e)) => return Err(e), + if std::env::var("USE_PIRITA") == Ok("1".to_string()) { + match try_run_pirita(&run_options) { + Ok(()) => return Ok(()), + Err(PiritaRunError::Initialize(_)) => { }, + Err(PiritaRunError::Run(e)) => return Err(e), + } } let command_name = run_options.command.as_str(); From b985052c43df31cff57fb4f4719895a4e70b0614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 10:55:13 +0200 Subject: [PATCH 38/74] Fix regression tests scripts: use WAPM_EXE to specify path to wapm binary --- end-to-end-tests/ci/direct-execution.sh | 10 ++++-- end-to-end-tests/ci/init-and-add.sh | 5 ++- end-to-end-tests/ci/install.sh | 5 ++- end-to-end-tests/ci/manifest-validation.sh | 5 ++- end-to-end-tests/ci/package-fs-mapping.sh | 5 ++- end-to-end-tests/ci/validate-global.sh | 5 ++- end-to-end-tests/ci/verification.sh | 5 ++- end-to-end-tests/direct_execute.sh | 29 +++++++-------- end-to-end-tests/direct_execute.txt | 1 - end-to-end-tests/init-and-add.sh | 13 +++---- end-to-end-tests/install.sh | 42 +++++++++++----------- end-to-end-tests/manifest-validation.sh | 10 +++--- end-to-end-tests/package-fs-mapping.sh | 16 ++++----- end-to-end-tests/validate-global.sh | 26 +++++++------- end-to-end-tests/verification.sh | 22 ++++++------ 15 files changed, 111 insertions(+), 88 deletions(-) mode change 100644 => 100755 end-to-end-tests/ci/init-and-add.sh mode change 100644 => 100755 end-to-end-tests/ci/install.sh mode change 100644 => 100755 end-to-end-tests/ci/manifest-validation.sh mode change 100644 => 100755 end-to-end-tests/ci/package-fs-mapping.sh mode change 100644 => 100755 end-to-end-tests/ci/validate-global.sh mode change 100644 => 100755 end-to-end-tests/ci/verification.sh mode change 100644 => 100755 end-to-end-tests/manifest-validation.sh diff --git a/end-to-end-tests/ci/direct-execution.sh b/end-to-end-tests/ci/direct-execution.sh index 2435b9be..ecfc3964 100755 --- a/end-to-end-tests/ci/direct-execution.sh +++ b/end-to-end-tests/ci/direct-execution.sh @@ -5,12 +5,16 @@ rm -f $WASMER_DIR/.wax_index.toml # TODO force clear cache rm -f wapm.toml rm -f wapm.lock +WAPM_EXE=target/release/wapm +$WAPM_EXE uninstall base64 chmod +x end-to-end-tests/direct_execute.sh echo "RUNNING SCRIPT..." -./end-to-end-tests/direct_execute.sh &> /tmp/direct_execute.txt -echo "GENERATED OUTPUT:" +WAPM=$WAPM_EXE ./end-to-end-tests/direct_execute.sh &> /tmp/direct_execute.txt +echo "GENERATED OUTPUT: ----" cat /tmp/direct_execute.txt -echo "COMPARING..." +echo "EXPECTED OUTPUT: ----" +cat end-to-end-tests/direct_execute.txt +echo "COMPARING... ----" diff -Bba end-to-end-tests/direct_execute.txt /tmp/direct_execute.txt export OUT=$? if ( [ -d globals ] || [ -f wapm.log ] ) then diff --git a/end-to-end-tests/ci/init-and-add.sh b/end-to-end-tests/ci/init-and-add.sh old mode 100644 new mode 100755 index 54e2cd31..89859663 --- a/end-to-end-tests/ci/init-and-add.sh +++ b/end-to-end-tests/ci/init-and-add.sh @@ -6,11 +6,14 @@ rm -f $WASMER_DIR/globals/wapm.lock rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock +WAPM_EXE=../target/release/wapm chmod +x end-to-end-tests/init-and-add.sh echo "RUNNING SCRIPT..." -./end-to-end-tests/init-and-add.sh &> /tmp/init-and-add-out.txt +WAPM=$WAPM_EXE ./end-to-end-tests/init-and-add.sh &> /tmp/init-and-add-out.txt echo "GENERATED OUTPUT:" cat /tmp/init-and-add-out.txt +echo "EXPECTED OUTPUT:" +cat end-to-end-tests/init-and-add.txt echo "ADJUSTING OUTPUT" # removes the absolute path tail -n +3 /tmp/init-and-add-out.txt > /tmp/init-and-add-out2.txt diff --git a/end-to-end-tests/ci/install.sh b/end-to-end-tests/ci/install.sh old mode 100644 new mode 100755 index 04915604..cbc4cf90 --- a/end-to-end-tests/ci/install.sh +++ b/end-to-end-tests/ci/install.sh @@ -7,10 +7,13 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/install.sh +WAPM_EXE=target/release/wapm echo "RUNNING SCRIPT..." -./end-to-end-tests/install.sh &> /tmp/install-out.txt +WAPM=$WAPM_EXE ./end-to-end-tests/install.sh &> /tmp/install-out.txt echo "GENERATED OUTPUT:" cat /tmp/install-out.txt +echo "EXPECTED OUTPUT:" +cat end-to-end-tests/install.txt echo "COMPARING..." diff -Bba end-to-end-tests/install.txt /tmp/install-out.txt export OUT=$? diff --git a/end-to-end-tests/ci/manifest-validation.sh b/end-to-end-tests/ci/manifest-validation.sh old mode 100644 new mode 100755 index b9691083..b3fe527f --- a/end-to-end-tests/ci/manifest-validation.sh +++ b/end-to-end-tests/ci/manifest-validation.sh @@ -7,10 +7,13 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/manifest-validation.sh +WAPM_EXE=target/release/wapm echo "RUNNING SCRIPT..." -./end-to-end-tests/manifest-validation.sh &> /tmp/manifest-validation-out.txt +WAPM=$WAPM_EXE ./end-to-end-tests/manifest-validation.sh &> /tmp/manifest-validation-out.txt echo "GENERATED OUTPUT:" cat /tmp/manifest-validation-out.txt +echo "EXPECTED OUTPUT:" +cat end-to-end-tests/manifest-validation.txt echo "COMPARING..." diff -Bba end-to-end-tests/manifest-validation.txt /tmp/manifest-validation-out.txt export OUT=$? diff --git a/end-to-end-tests/ci/package-fs-mapping.sh b/end-to-end-tests/ci/package-fs-mapping.sh old mode 100644 new mode 100755 index 55eee398..b3a96631 --- a/end-to-end-tests/ci/package-fs-mapping.sh +++ b/end-to-end-tests/ci/package-fs-mapping.sh @@ -7,10 +7,13 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/package-fs-mapping.sh +WAPM_EXE=target/release/wapm echo "RUNNING SCRIPT..." -./end-to-end-tests/package-fs-mapping.sh &> /tmp/package-fs-mapping-out.txt +WAPM=$WAPM_EXE ./end-to-end-tests/package-fs-mapping.sh &> /tmp/package-fs-mapping-out.txt echo "GENERATED OUTPUT:" cat /tmp/package-fs-mapping-out.txt +echo "EXPECTED OUTPUT:" +cat end-to-end-tests/end-to-end-tests/package-fs-mapping.txt echo "COMPARING..." ## hack to get the current directory in the expected output #sed -i.bak "s/{{CURRENT_DIR}}/$(pwd | sed 's/\//\\\//g')/g" end-to-end-tests/package-fs-mapping.txt diff --git a/end-to-end-tests/ci/validate-global.sh b/end-to-end-tests/ci/validate-global.sh old mode 100644 new mode 100755 index f0cc1cbb..b6cd936b --- a/end-to-end-tests/ci/validate-global.sh +++ b/end-to-end-tests/ci/validate-global.sh @@ -7,10 +7,13 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/validate-global.sh +WAPM_EXE=target/release/wapm echo "RUNNING SCRIPT..." -./end-to-end-tests/validate-global.sh &> /tmp/validate-global-out.txt +WAPM=$WAPM_EXE ./end-to-end-tests/validate-global.sh &> /tmp/validate-global-out.txt echo "GENERATED OUTPUT:" cat /tmp/validate-global-out.txt +echo "EXPECTED OUTPUT:" +cat end-to-end-tests/validate-global.txt echo "COMPARING..." diff -Bba end-to-end-tests/validate-global.txt /tmp/validate-global-out.txt export OUT=$? diff --git a/end-to-end-tests/ci/verification.sh b/end-to-end-tests/ci/verification.sh old mode 100644 new mode 100755 index de334331..80e672fa --- a/end-to-end-tests/ci/verification.sh +++ b/end-to-end-tests/ci/verification.sh @@ -7,10 +7,13 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/verification.sh +WAPM_EXE=target/release/wapm echo "RUNNING SCRIPT..." -./end-to-end-tests/verification.sh &> /tmp/verification-out.txt +WAPM=$WAPM_EXE ./end-to-end-tests/verification.sh &> /tmp/verification-out.txt echo "GENERATED OUTPUT:" cat /tmp/verification-out.txt +echo "EXPECTED OUTPUT:" +cat end-to-end-tests/verification.txt echo "COMPARING..." diff -Bba end-to-end-tests/verification.txt /tmp/verification-out.txt export OUT=$? diff --git a/end-to-end-tests/direct_execute.sh b/end-to-end-tests/direct_execute.sh index 81cc3f99..5ea4a8fd 100755 --- a/end-to-end-tests/direct_execute.sh +++ b/end-to-end-tests/direct_execute.sh @@ -2,20 +2,21 @@ export RUST_BACKTRACE=1 ln -sf `which wapm` wax -wapm config set registry.url "https://registry.wapm.dev" +WAX=$(echo $WAPM execute) +$WAPM config set registry.url "https://registry.wapm.dev" echo "hello" | wapm execute base64 -./wax echo "hello" -wapm install namespace-example/cowsay -./wax --emscripten cowsay "hello" -wapm uninstall namespace-example/cowsay -wapm install lolcat -wapm run lolcat -V -./wax lolcat -V -wapm uninstall lolcat -./wax lolcat -V -wapm list -a +$WAX echo "hello" +$WAPM install namespace-example/cowsay +$WAX --emscripten cowsay "hello" +$WAPM uninstall namespace-example/cowsay +$WAPM install lolcat +$WAPM run lolcat -V +$WAX lolcat -V +$WAPM uninstall lolcat +$WAX lolcat -V +$WAPM list -a rm -rf $(./wax --which lolcat)/wapm_packages/_/lolcat@0.1.1/* -./wax lolcat -V -./wax --offline lolcat -V -WAPM_RUNTIME=echo ./wax ls | grep "\-\-command-name" || echo "Success: command-name not found" +$WAX lolcat -V +$WAX --offline lolcat -V +WAPM_RUNTIME=echo $WAX ls | grep "\-\-command-name" || echo "Success: command-name not found" diff --git a/end-to-end-tests/direct_execute.txt b/end-to-end-tests/direct_execute.txt index a07d29da..51314f2a 100644 --- a/end-to-end-tests/direct_execute.txt +++ b/end-to-end-tests/direct_execute.txt @@ -1,6 +1,5 @@ [INFO] Installing mark2/coreutils@0.0.3 aGVsbG8K -[INFO] Installing mark2/coreutils@0.0.3 hello [INFO] Installing namespace-example/cowsay@0.2.0 Package installed successfully to wapm_packages! diff --git a/end-to-end-tests/init-and-add.sh b/end-to-end-tests/init-and-add.sh index 80b4a523..f58d6551 100755 --- a/end-to-end-tests/init-and-add.sh +++ b/end-to-end-tests/init-and-add.sh @@ -2,11 +2,12 @@ mkdir test-package cd test-package -wapm config set registry.url "https://registry.wapm.dev" -wapm init -y -wapm add this-package-does-not-exist -wapm add mark2/python@0.0.4 mark2/dog2 -wapm add lolcat@0.1.1 -wapm remove lolcat +WAX=$(echo $WAPM execute) +$WAPM config set registry.url "https://registry.wapm.dev" +$WAPM init -y +$WAPM add this-package-does-not-exist +$WAPM add mark2/python@0.0.4 mark2/dog2 +$WAPM add lolcat@0.1.1 +$WAPM remove lolcat cd .. rm -rf test-package diff --git a/end-to-end-tests/install.sh b/end-to-end-tests/install.sh index d1ab352a..1dc7fc2a 100755 --- a/end-to-end-tests/install.sh +++ b/end-to-end-tests/install.sh @@ -1,23 +1,23 @@ #!/bin/sh -wapm config set registry.url "https://registry.wapm.dev" -wapm install namespace-example/cowsay@0.1.2 -wapm install namespace-example/cowsay@0.1.2 -wapm run cowsay "hello, world" -wapm list -wapm uninstall namespace-example/cowsay -wapm install namespace-example/cowsay@0.1.2 -wapm uninstall namespace-example/cowsay -wapm uninstall namespace-example/cowsay -wapm install -g mark/rust-example@0.1.11 -wapm run hq9+ -e "H" -wapm uninstall -g mark/rust-example -wapm install -g mark/wapm-override-test@0.1.0 -wapm list -a -wapm run wapm-override-test -wapm install mark/wapm-override-test@0.2.0 -wapm run wapm-override-test -wapm uninstall mark/wapm-override-test -wapm run wapm-override-test -wapm uninstall -g mark/wapm-override-test -wapm install namespace-example/cowsay@0.1.1 namespace-example/cowsay@0.1.2 +$WAPM config set registry.url "https://registry.wapm.dev" +$WAPM install namespace-example/cowsay@0.1.2 +$WAPM install namespace-example/cowsay@0.1.2 +$WAPM run cowsay "hello, world" +$WAPM list +$WAPM uninstall namespace-example/cowsay +$WAPM install namespace-example/cowsay@0.1.2 +$WAPM uninstall namespace-example/cowsay +$WAPM uninstall namespace-example/cowsay +$WAPM install -g mark/rust-example@0.1.11 +$WAPM run hq9+ -e "H" +$WAPM uninstall -g mark/rust-example +$WAPM install -g mark/wapm-override-test@0.1.0 +$WAPM list -a +$WAPM run wapm-override-test +$WAPM install mark/wapm-override-test@0.2.0 +$WAPM run wapm-override-test +$WAPM uninstall mark/wapm-override-test +$WAPM run wapm-override-test +$WAPM uninstall -g mark/wapm-override-test +$WAPM install namespace-example/cowsay@0.1.1 namespace-example/cowsay@0.1.2 diff --git a/end-to-end-tests/manifest-validation.sh b/end-to-end-tests/manifest-validation.sh old mode 100644 new mode 100755 index 52aaacd2..b9f9380d --- a/end-to-end-tests/manifest-validation.sh +++ b/end-to-end-tests/manifest-validation.sh @@ -1,14 +1,14 @@ #!/bin/sh export RUST_BACKTRACE=1 -wapm config set registry.url "https://registry.wapm.dev" +$WAPM config set registry.url "https://registry.wapm.dev" echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -wapm publish --dry-run +$WAPM publish --dry-run # get a wasm module so we forget the abi field -wapm install mark2/dog2@0.0.13 --force-yes +$WAPM install mark2/dog2@0.0.13 --force-yes cp wapm_packages/mark2/dog2@0.0.13/dog.wasm . echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[module]]\nname="test-module"\nsource="dog.wasm"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -wapm publish --dry-run +$WAPM publish --dry-run echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[module]]\nname="test-module"\nsource="dog.wasm"\nabi="wasi"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -wapm publish --dry-run +$WAPM publish --dry-run rm dog.wasm diff --git a/end-to-end-tests/package-fs-mapping.sh b/end-to-end-tests/package-fs-mapping.sh index a0f46922..7eaaaeea 100755 --- a/end-to-end-tests/package-fs-mapping.sh +++ b/end-to-end-tests/package-fs-mapping.sh @@ -1,14 +1,14 @@ #!/bin/sh export RUST_BACKTRACE=1 -wapm config set registry.url "https://registry.wapm.dev" -wapm install -g mark2/dog2@0.0.13 --force-yes -wapm run dog -- data -wapm uninstall -g mark2/dog2 -wapm install mark2/dog2@0.0.13 -wapm run dog -- data -wapm uninstall mark2/dog2 +$WAPM config set registry.url "https://registry.wapm.dev" +$WAPM install -g mark2/dog2@0.0.13 --force-yes +$WAPM run dog -- data +$WAPM uninstall -g mark2/dog2 +$WAPM install mark2/dog2@0.0.13 +$WAPM run dog -- data +$WAPM uninstall mark2/dog2 cp wapm_packages/mark2/dog2@0.0.13/dog.wasm . echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[module]]\nname="test-module"\nsource="dog.wasm"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -wapm run test -- wapm_file +$WAPM run test -- wapm_file rm dog.wasm diff --git a/end-to-end-tests/validate-global.sh b/end-to-end-tests/validate-global.sh index cc03fcc4..a197c479 100755 --- a/end-to-end-tests/validate-global.sh +++ b/end-to-end-tests/validate-global.sh @@ -1,19 +1,19 @@ #!/bin/sh -wapm config set registry.url "https://registry.wapm.dev" +$WAPM config set registry.url "https://registry.wapm.dev" # test that the command name is overriden by default -wapm install -g mark2/binary-name-matters@0.0.3 -y -wapm run binary-name-matters -wapm uninstall -g mark2/binary-name-matters -wapm install mark2/binary-name-matters@0.0.3 -y -wapm run binary-name-matters -wapm uninstall mark2/binary-name-matters +$WAPM install -g mark2/binary-name-matters@0.0.3 -y +$WAPM run binary-name-matters +$WAPM uninstall -g mark2/binary-name-matters +$WAPM install mark2/binary-name-matters@0.0.3 -y +$WAPM run binary-name-matters +$WAPM uninstall mark2/binary-name-matters # disable command rename and manually reenable it with `wasmer-extra-flags` -wapm install -g mark2/binary-name-matters-2 -y -wapm run binary-name-matters-2 -wapm uninstall -g mark2/binary-name-matters-2 -wapm install mark2/binary-name-matters-2 -y -wapm run binary-name-matters-2 -wapm uninstall mark2/binary-name-matters-2 +$WAPM install -g mark2/binary-name-matters-2 -y +$WAPM run binary-name-matters-2 +$WAPM uninstall -g mark2/binary-name-matters-2 +$WAPM install mark2/binary-name-matters-2 -y +$WAPM run binary-name-matters-2 +$WAPM uninstall mark2/binary-name-matters-2 diff --git a/end-to-end-tests/verification.sh b/end-to-end-tests/verification.sh index 05592d74..be753693 100755 --- a/end-to-end-tests/verification.sh +++ b/end-to-end-tests/verification.sh @@ -1,17 +1,17 @@ #!/bin/sh export RUST_BACKTRACE=1 -wapm config set registry.url "https://registry.wapm.dev" +$WAPM config set registry.url "https://registry.wapm.dev" # redirect stderr to /dev/null so we can capture important stderr -yes no 2> /dev/null | wapm install mark2/dog2@0.0.0 +yes no 2> /dev/null | $WAPM install mark2/dog2@0.0.0 # wc because the date changes -wapm keys list -a -yes 2> /dev/null | wapm install mark2/dog@0.0.4 -wapm keys list -a | wc -l | xargs -wapm uninstall mark2/dog -wapm install mark2/dog@0.0.4 -wapm install mark2/dog2@0.0.0 +$WAPM keys list -a +yes 2> /dev/null | $WAPM install mark2/dog@0.0.4 +$WAPM keys list -a | wc -l | xargs +$WAPM uninstall mark2/dog +$WAPM install mark2/dog@0.0.4 +$WAPM install mark2/dog2@0.0.0 rm $HOME/.wasmer/wapm.sqlite &> /dev/null -wapm install syrusakbary/dog3@0.0.0 --force-yes -wapm uninstall syrusakbary/dog3 -wapm install syrusakbary/dog3@0.0.0 --force-yes +$WAPM install syrusakbary/dog3@0.0.0 --force-yes +$WAPM uninstall syrusakbary/dog3 +$WAPM install syrusakbary/dog3@0.0.0 --force-yes From 5527de7765db0f4c6edd85d12d1b655a7a65a567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 11:39:38 +0200 Subject: [PATCH 39/74] Fix error with package override not working with new URL resolver Sometimes a package name can be redirected on the server side, it is important that the redirection works so that the installation doesn't fail. --- src/commands/install.rs | 12 ++--- wapm-resolve-url/src/lib.rs | 92 +++++++++++++++++++++++++++++-------- 2 files changed, 79 insertions(+), 25 deletions(-) diff --git a/src/commands/install.rs b/src/commands/install.rs index 5027da57..bf2fd56a 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -178,7 +178,7 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result s, None => { if let Some((wax_package_name, wax_package_version)) = get_wax_package_name(package_name) { @@ -196,13 +196,13 @@ fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result Option { Some(Url::parse(std::str::from_utf8(&command.stdout).ok()?).ok()?) } -pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option<(Url, String)> { +#[derive(Debug, PartialEq, Clone)] +pub struct PackageRegistryInfoTarGz { + pub registry: Url, + /// Name of the package as originally queried + pub queried_name: String, + /// Version of the originally queried package + pub queried_version: Option, + /// Name of the resolved package, this can differ from the original package name + /// due to server-side package redirection + pub resolved_name: String, + /// Resolved version of the package + pub resolved_version: String, + /// URL of the .tar.gz file + pub url: Url, +} + +pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option { let q = GetPackageQueryTarGz::build_query(get_package_query_tar_gz::Variables { name: package_id.to_string(), @@ -44,7 +60,7 @@ pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Opti match version { Some(specific) => { - let last_package = all_package_versions.package?.versions?; + let last_package = all_package_versions.package.as_ref()?.versions.as_ref()?; let last_package = last_package .iter() @@ -52,20 +68,47 @@ pub fn get_tar_gz_url_of_package(registry: &Url, package_id: &str, version: Opti .filter(|v| v.version == specific) .next()?; - Url::parse(&last_package.distribution.download_url) - .ok() - .map(|u| (u, last_package.version.clone())) + let url = Url::parse(&last_package.distribution.download_url).ok()?; + Some(PackageRegistryInfoTarGz { + registry: registry.clone(), + queried_name: package_id.to_string(), + queried_version: version.as_ref().map(|s| s.to_string()), + resolved_name: all_package_versions.package.as_ref()?.name.to_string(), + resolved_version: last_package.version.to_string(), + url: url, + }) }, None => { - let last_version = all_package_versions.package?.last_version?; - Url::parse(&last_version.distribution.download_url) - .ok() - .map(|u| (u, last_version.version.clone())) + let last_version = all_package_versions.package.as_ref()?.last_version.as_ref()?; + let url = Url::parse(&last_version.distribution.download_url).ok()?; + Some(PackageRegistryInfoTarGz { + registry: registry.clone(), + queried_name: package_id.to_string(), + queried_version: version.as_ref().map(|s| s.to_string()), + resolved_name: all_package_versions.package.as_ref()?.name.to_string(), + resolved_version: last_version.version.to_string(), + url: url, + }) }, } } -pub fn get_pirita_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option<(Url, String)> { +#[derive(Debug, PartialEq, Clone)] +pub struct PackageRegistryInfoPirita { + pub registry: Url, + /// Name of the package as originally queried + pub queried_name: String, + /// Version of the originally queried package + pub queried_version: Option, + /// Name of the resolved package, this can differ from the original package name + /// due to server-side package redirection + pub resolved_name: String, + /// Resolved version of the package + pub resolved_version: String, + /// URL of the .tar.gz file + pub url: Url, +} +pub fn get_pirita_url_of_package(registry: &Url, package_id: &str, version: Option<&str>) -> Option { let q = GetPackageQueryPirita::build_query(get_package_query_pirita::Variables { name: package_id.to_string(), @@ -74,23 +117,34 @@ pub fn get_pirita_url_of_package(registry: &Url, package_id: &str, version: Opti match version { Some(specific) => { - let last_package = all_package_versions.package?.versions?; - + let last_package = all_package_versions.package.as_ref()?.versions.as_ref()?; let last_package = last_package .iter() .filter_map(|v| v.as_ref()) .filter(|v| v.version == specific) .next()?; - Url::parse(&last_package.distribution.pirita_download_url.as_ref().map(|s| s.as_str())?) - .ok() - .map(|u| (u, last_package.version.clone())) + let url = Url::parse(&last_package.distribution.pirita_download_url.as_ref().map(|s| s.as_str())?).ok()?; + Some(PackageRegistryInfoPirita { + registry: registry.clone(), + queried_name: package_id.to_string(), + queried_version: version.as_ref().map(|s| s.to_string()), + resolved_name: all_package_versions.package.as_ref()?.name.to_string(), + resolved_version: last_package.version.to_string(), + url: url, + }) }, None =>{ - let last_version = all_package_versions.package?.last_version?; - Url::parse(&last_version.distribution.pirita_download_url.as_ref().map(|s| s.as_str())?) - .ok() - .map(|u| (u, last_version.version.clone())) + let last_version = all_package_versions.package.as_ref()?.last_version.as_ref()?; + let url = Url::parse(&last_version.distribution.pirita_download_url.as_ref().map(|s| s.as_str())?).ok()?; + Some(PackageRegistryInfoPirita { + registry: registry.clone(), + queried_name: package_id.to_string(), + queried_version: version.as_ref().map(|s| s.to_string()), + resolved_name: all_package_versions.package.as_ref()?.name.to_string(), + resolved_version: last_version.version.to_string(), + url: url, + }) }, } } From cf9b8e9e1c1f6250d942893bcc4ddf6f8fef5a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 12:19:35 +0200 Subject: [PATCH 40/74] Fix regression tests to make sense, add --all option to "wapm uninstall" --- .gitignore | 2 +- Cargo.toml | 2 +- end-to-end-tests/ci/direct-execution.sh | 2 +- end-to-end-tests/ci/init-and-add.sh | 1 + end-to-end-tests/ci/install.sh | 1 + end-to-end-tests/ci/manifest-validation.sh | 1 + end-to-end-tests/ci/package-fs-mapping.sh | 1 + end-to-end-tests/ci/validate-global.sh | 1 + end-to-end-tests/ci/verification.sh | 1 + end-to-end-tests/direct_execute.txt | 3 +- src/commands/uninstall.rs | 106 +++++++++++++++------ src/data/wax_index.rs | 5 + src/dataflow/mod.rs | 8 ++ 13 files changed, 101 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index d27e698f..d779fa4f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ package dist wax - +wapm.lock \.idea/ \.vscode/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 1a74f969..a972db03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "ssh://git@github.com/wasmerio/pirita.git" +git = "https://github.com/wasmerio/pirita.git" rev = "1f898dca174c1a4effab78c16159a4b5515b8cdb" default-features = false features = ["autoconvert"] diff --git a/end-to-end-tests/ci/direct-execution.sh b/end-to-end-tests/ci/direct-execution.sh index ecfc3964..56b36e2f 100755 --- a/end-to-end-tests/ci/direct-execution.sh +++ b/end-to-end-tests/ci/direct-execution.sh @@ -6,7 +6,7 @@ rm -f $WASMER_DIR/.wax_index.toml rm -f wapm.toml rm -f wapm.lock WAPM_EXE=target/release/wapm -$WAPM_EXE uninstall base64 +$WAPM_EXE uninstall --global --all chmod +x end-to-end-tests/direct_execute.sh echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/direct_execute.sh &> /tmp/direct_execute.txt diff --git a/end-to-end-tests/ci/init-and-add.sh b/end-to-end-tests/ci/init-and-add.sh index 89859663..cd7d3771 100755 --- a/end-to-end-tests/ci/init-and-add.sh +++ b/end-to-end-tests/ci/init-and-add.sh @@ -7,6 +7,7 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock WAPM_EXE=../target/release/wapm +$WAPM_EXE uninstall --global --all chmod +x end-to-end-tests/init-and-add.sh echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/init-and-add.sh &> /tmp/init-and-add-out.txt diff --git a/end-to-end-tests/ci/install.sh b/end-to-end-tests/ci/install.sh index cbc4cf90..962c1a2f 100755 --- a/end-to-end-tests/ci/install.sh +++ b/end-to-end-tests/ci/install.sh @@ -8,6 +8,7 @@ rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/install.sh WAPM_EXE=target/release/wapm +$WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/install.sh &> /tmp/install-out.txt echo "GENERATED OUTPUT:" diff --git a/end-to-end-tests/ci/manifest-validation.sh b/end-to-end-tests/ci/manifest-validation.sh index b3fe527f..548d0819 100755 --- a/end-to-end-tests/ci/manifest-validation.sh +++ b/end-to-end-tests/ci/manifest-validation.sh @@ -8,6 +8,7 @@ rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/manifest-validation.sh WAPM_EXE=target/release/wapm +$WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/manifest-validation.sh &> /tmp/manifest-validation-out.txt echo "GENERATED OUTPUT:" diff --git a/end-to-end-tests/ci/package-fs-mapping.sh b/end-to-end-tests/ci/package-fs-mapping.sh index b3a96631..6a6bff18 100755 --- a/end-to-end-tests/ci/package-fs-mapping.sh +++ b/end-to-end-tests/ci/package-fs-mapping.sh @@ -8,6 +8,7 @@ rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/package-fs-mapping.sh WAPM_EXE=target/release/wapm +$WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/package-fs-mapping.sh &> /tmp/package-fs-mapping-out.txt echo "GENERATED OUTPUT:" diff --git a/end-to-end-tests/ci/validate-global.sh b/end-to-end-tests/ci/validate-global.sh index b6cd936b..19d5c4a8 100755 --- a/end-to-end-tests/ci/validate-global.sh +++ b/end-to-end-tests/ci/validate-global.sh @@ -8,6 +8,7 @@ rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/validate-global.sh WAPM_EXE=target/release/wapm +$WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/validate-global.sh &> /tmp/validate-global-out.txt echo "GENERATED OUTPUT:" diff --git a/end-to-end-tests/ci/verification.sh b/end-to-end-tests/ci/verification.sh index 80e672fa..ef8f35c1 100755 --- a/end-to-end-tests/ci/verification.sh +++ b/end-to-end-tests/ci/verification.sh @@ -8,6 +8,7 @@ rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/verification.sh WAPM_EXE=target/release/wapm +$WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/verification.sh &> /tmp/verification-out.txt echo "GENERATED OUTPUT:" diff --git a/end-to-end-tests/direct_execute.txt b/end-to-end-tests/direct_execute.txt index 51314f2a..d79a7cf2 100644 --- a/end-to-end-tests/direct_execute.txt +++ b/end-to-end-tests/direct_execute.txt @@ -1,5 +1,6 @@ [INFO] Installing mark2/coreutils@0.0.3 aGVsbG8K +[INFO] Installing mark2/coreutils@0.0.3 hello [INFO] Installing namespace-example/cowsay@0.2.0 Package installed successfully to wapm_packages! @@ -16,7 +17,7 @@ Package installed successfully to wapm_packages! Package installed successfully to wapm_packages! lolcat 1.0.1 lolcat 1.0.1 -[INFO] Package "lolcat" is not installed. +[INFO] Package "lolcat" uninstalled. lolcat 1.0.1 LOCAL PACKAGES: PACKAGE | VERSION | MODULE | ABI diff --git a/src/commands/uninstall.rs b/src/commands/uninstall.rs index cf6f6de7..3425f37d 100644 --- a/src/commands/uninstall.rs +++ b/src/commands/uninstall.rs @@ -13,10 +13,13 @@ pub enum Error { #[derive(StructOpt, Debug)] pub struct UninstallOpt { - pub package: String, + pub package: Option, /// Uninstall the package(s) globally #[structopt(short = "g", long = "global")] pub global: bool, + /// Uninstall all packages (useful for running in CI) + #[structopt(short = "a", long = "all")] + pub all: bool, } pub fn uninstall(options: UninstallOpt) -> anyhow::Result<()> { @@ -24,38 +27,83 @@ pub fn uninstall(options: UninstallOpt) -> anyhow::Result<()> { true => Config::get_globals_directory()?, false => Config::get_current_dir()?, }; - let uninstalled_package_names = vec![options.package.as_str()]; - // do not allow the "@" symbol to prevent mis-use of this command - if options.package.contains('@') { - return Err(Error::NoAtSignAllowed.into()); - } + let package_names = match options.package.as_ref() { + Some(s) => s.split_whitespace().map(|s| s.to_string()).collect::>(), + None => { + if options.all { + use crate::dataflow::lockfile_packages::{LockfilePackages, LockfileResult}; - // returned bool indicates if there was any to the lockfile. If this pacakge is uninstalled, - // there will be a diff created, which causes update to return true. Because no other change - // is made, we can assume any change resulted in successfully uninstalled package. - let result = dataflow::update(vec![], uninstalled_package_names, dir.clone())?; - - // Uninstall the package from /tmp/wax/... - let mut wax_uninstalled = false; - let mut wax_index = wax_index::WaxIndex::open()?; - if wax_index.search_for_entry(options.package.clone()).is_ok() { - wax_index.remove_entry(options.package.as_str())?; - wax_index.save()?; - wax_uninstalled = true; - } + let wax_index = wax_index::WaxIndex::open()?; + let mut entries = wax_index.get_all_entries(); - let mut pirita_uninstalled = false; - let path = dir.join(PACKAGES_DIR_NAME).join(".bin").join(options.package.as_str()); - if path.exists() { - std::fs::remove_file(&path)?; - pirita_uninstalled = true; - } + // get local packages from lockfile + let lockfile_result = LockfileResult::find_in_directory(&Config::get_current_dir()?); + let lockfile_packages = LockfilePackages::new_from_result(lockfile_result) + .map(|k| k.package_keys()) + .unwrap_or_default(); + for key in lockfile_packages.iter() { + println!("uninstalling lockfile package {}", key.get_name()); + entries.push(key.get_name().to_string()); + } + + if options.global { + // get local packages from lockfile + let lockfile_result = LockfileResult::find_in_directory(&Config::get_globals_directory()?); + let lockfile_packages = LockfilePackages::new_from_result(lockfile_result) + .map(|k| k.package_keys()) + .unwrap_or_default(); + for key in lockfile_packages.iter() { + println!("uninstalling lockfile package {}", key.get_name()); + entries.push(key.get_name().to_string()); + } + } + + if entries.is_empty() { + return Ok(()); + } + entries + } else { + return Err(anyhow!("No packages specified to uninstall.")); + } + } + }; + + for package in package_names.iter() { + + let uninstalled_package_names = vec![package.as_str()]; - if !result && !wax_uninstalled && !pirita_uninstalled { - info!("Package \"{}\" is not installed.", options.package); - } else { - info!("Package \"{}\" uninstalled.", options.package); + // do not allow the "@" symbol to prevent mis-use of this command + if package.contains('@') { + return Err(Error::NoAtSignAllowed.into()); + } + + // returned bool indicates if there was any to the lockfile. If this pacakge is uninstalled, + // there will be a diff created, which causes update to return true. Because no other change + // is made, we can assume any change resulted in successfully uninstalled package. + let result = dataflow::update(vec![], uninstalled_package_names, dir.clone())?; + + // Uninstall the package from /tmp/wax/... + let mut wax_uninstalled = false; + let mut wax_index = wax_index::WaxIndex::open()?; + if wax_index.search_for_entry(package.clone()).is_ok() { + wax_index.remove_entry(package.as_str())?; + wax_index.save()?; + wax_uninstalled = true; + } + + let mut pirita_uninstalled = false; + let path = dir.join(PACKAGES_DIR_NAME).join(".bin").join(package.as_str()); + if path.exists() { + std::fs::remove_file(&path)?; + pirita_uninstalled = true; + } + + if !result && !wax_uninstalled && !pirita_uninstalled { + info!("Package \"{}\" is not installed.", package); + } else { + info!("Package \"{}\" uninstalled.", package); + } } Ok(()) diff --git a/src/data/wax_index.rs b/src/data/wax_index.rs index 817b6997..74da876f 100644 --- a/src/data/wax_index.rs +++ b/src/data/wax_index.rs @@ -161,6 +161,11 @@ impl WaxIndex { pub fn base_path(&self) -> &Path { &self.base_dir } + + /// Returns a list of all currently installed packages + pub fn get_all_entries(&self) -> Vec { + self.index.keys().cloned().collect() + } } pub fn nuke_dir>(path: P) -> Result<(), String> { diff --git a/src/dataflow/mod.rs b/src/dataflow/mod.rs index 440b9ce8..85b02894 100644 --- a/src/dataflow/mod.rs +++ b/src/dataflow/mod.rs @@ -122,6 +122,14 @@ pub enum PackageKey<'a> { } impl<'a> PackageKey<'a> { + + pub fn get_name(&'a self) -> &'a str { + match self { + PackageKey::WapmPackage(a) => a.name.as_ref(), + PackageKey::WapmPackageRange(a) => a.name.as_ref(), + } + } + /// Convenience constructor for wapm.io registry keys. pub fn new_registry_package(name: S, version: Version) -> Self where From 2da4d7d15112da25b1a17d1c71b04a698bc6200a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 13:01:16 +0200 Subject: [PATCH 41/74] Debug working directory missing from WAPM_EXE variable --- end-to-end-tests/ci/direct-execution.sh | 6 +++++- end-to-end-tests/ci/init-and-add.sh | 6 +++++- end-to-end-tests/ci/install.sh | 6 +++++- end-to-end-tests/ci/manifest-validation.sh | 6 +++++- end-to-end-tests/ci/package-fs-mapping.sh | 6 +++++- end-to-end-tests/ci/validate-global.sh | 6 +++++- end-to-end-tests/ci/verification.sh | 6 +++++- 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/end-to-end-tests/ci/direct-execution.sh b/end-to-end-tests/ci/direct-execution.sh index 56b36e2f..6a3237df 100755 --- a/end-to-end-tests/ci/direct-execution.sh +++ b/end-to-end-tests/ci/direct-execution.sh @@ -5,7 +5,11 @@ rm -f $WASMER_DIR/.wax_index.toml # TODO force clear cache rm -f wapm.toml rm -f wapm.lock -WAPM_EXE=target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all chmod +x end-to-end-tests/direct_execute.sh echo "RUNNING SCRIPT..." diff --git a/end-to-end-tests/ci/init-and-add.sh b/end-to-end-tests/ci/init-and-add.sh index cd7d3771..494aee51 100755 --- a/end-to-end-tests/ci/init-and-add.sh +++ b/end-to-end-tests/ci/init-and-add.sh @@ -6,7 +6,11 @@ rm -f $WASMER_DIR/globals/wapm.lock rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock -WAPM_EXE=../target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all chmod +x end-to-end-tests/init-and-add.sh echo "RUNNING SCRIPT..." diff --git a/end-to-end-tests/ci/install.sh b/end-to-end-tests/ci/install.sh index 962c1a2f..2abe494d 100755 --- a/end-to-end-tests/ci/install.sh +++ b/end-to-end-tests/ci/install.sh @@ -7,7 +7,11 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/install.sh -WAPM_EXE=target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/install.sh &> /tmp/install-out.txt diff --git a/end-to-end-tests/ci/manifest-validation.sh b/end-to-end-tests/ci/manifest-validation.sh index 548d0819..a98cac19 100755 --- a/end-to-end-tests/ci/manifest-validation.sh +++ b/end-to-end-tests/ci/manifest-validation.sh @@ -7,7 +7,11 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/manifest-validation.sh -WAPM_EXE=target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/manifest-validation.sh &> /tmp/manifest-validation-out.txt diff --git a/end-to-end-tests/ci/package-fs-mapping.sh b/end-to-end-tests/ci/package-fs-mapping.sh index 6a6bff18..19d20e40 100755 --- a/end-to-end-tests/ci/package-fs-mapping.sh +++ b/end-to-end-tests/ci/package-fs-mapping.sh @@ -7,7 +7,11 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/package-fs-mapping.sh -WAPM_EXE=target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/package-fs-mapping.sh &> /tmp/package-fs-mapping-out.txt diff --git a/end-to-end-tests/ci/validate-global.sh b/end-to-end-tests/ci/validate-global.sh index 19d5c4a8..32feb211 100755 --- a/end-to-end-tests/ci/validate-global.sh +++ b/end-to-end-tests/ci/validate-global.sh @@ -7,7 +7,11 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/validate-global.sh -WAPM_EXE=target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/validate-global.sh &> /tmp/validate-global-out.txt diff --git a/end-to-end-tests/ci/verification.sh b/end-to-end-tests/ci/verification.sh index ef8f35c1..4be4f934 100755 --- a/end-to-end-tests/ci/verification.sh +++ b/end-to-end-tests/ci/verification.sh @@ -7,7 +7,11 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/verification.sh -WAPM_EXE=target/release/wapm +echo "pwd" +pwd +WORKDIR=$(pwd) +WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) +echo $WAPM_EXE $WAPM_EXE uninstall --global --all echo "RUNNING SCRIPT..." WAPM=$WAPM_EXE ./end-to-end-tests/verification.sh &> /tmp/verification-out.txt From d75d1c6384845a16e86b082c253088b41d88eb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 13:30:02 +0200 Subject: [PATCH 42/74] Add "cargo build release" to regression tests This avoids running a locally installed / default version of wapm, since we want to test the wapm-cli from the current package, not the globally installed one that comes bundled with the wasmer install script. --- end-to-end-tests/ci/direct-execution.sh | 1 + end-to-end-tests/ci/init-and-add.sh | 1 + end-to-end-tests/ci/install.sh | 1 + end-to-end-tests/ci/manifest-validation.sh | 1 + end-to-end-tests/ci/package-fs-mapping.sh | 1 + end-to-end-tests/ci/validate-global.sh | 1 + end-to-end-tests/ci/verification.sh | 1 + 7 files changed, 7 insertions(+) diff --git a/end-to-end-tests/ci/direct-execution.sh b/end-to-end-tests/ci/direct-execution.sh index 6a3237df..281a2e4f 100755 --- a/end-to-end-tests/ci/direct-execution.sh +++ b/end-to-end-tests/ci/direct-execution.sh @@ -5,6 +5,7 @@ rm -f $WASMER_DIR/.wax_index.toml # TODO force clear cache rm -f wapm.toml rm -f wapm.lock +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) diff --git a/end-to-end-tests/ci/init-and-add.sh b/end-to-end-tests/ci/init-and-add.sh index 494aee51..801fa340 100755 --- a/end-to-end-tests/ci/init-and-add.sh +++ b/end-to-end-tests/ci/init-and-add.sh @@ -6,6 +6,7 @@ rm -f $WASMER_DIR/globals/wapm.lock rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) diff --git a/end-to-end-tests/ci/install.sh b/end-to-end-tests/ci/install.sh index 2abe494d..6e61237e 100755 --- a/end-to-end-tests/ci/install.sh +++ b/end-to-end-tests/ci/install.sh @@ -7,6 +7,7 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/install.sh +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) diff --git a/end-to-end-tests/ci/manifest-validation.sh b/end-to-end-tests/ci/manifest-validation.sh index a98cac19..94436622 100755 --- a/end-to-end-tests/ci/manifest-validation.sh +++ b/end-to-end-tests/ci/manifest-validation.sh @@ -7,6 +7,7 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/manifest-validation.sh +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) diff --git a/end-to-end-tests/ci/package-fs-mapping.sh b/end-to-end-tests/ci/package-fs-mapping.sh index 19d20e40..4c4a6854 100755 --- a/end-to-end-tests/ci/package-fs-mapping.sh +++ b/end-to-end-tests/ci/package-fs-mapping.sh @@ -7,6 +7,7 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/package-fs-mapping.sh +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) diff --git a/end-to-end-tests/ci/validate-global.sh b/end-to-end-tests/ci/validate-global.sh index 32feb211..1a6fbc61 100755 --- a/end-to-end-tests/ci/validate-global.sh +++ b/end-to-end-tests/ci/validate-global.sh @@ -7,6 +7,7 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/validate-global.sh +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) diff --git a/end-to-end-tests/ci/verification.sh b/end-to-end-tests/ci/verification.sh index 4be4f934..278339b0 100755 --- a/end-to-end-tests/ci/verification.sh +++ b/end-to-end-tests/ci/verification.sh @@ -7,6 +7,7 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/verification.sh +cargo build --release echo "pwd" pwd WORKDIR=$(pwd) From d48622fb7e1fbe489b701137a0c2cf2054feaf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 25 Jul 2022 14:17:25 +0200 Subject: [PATCH 43/74] Try fixing regression tests --- .github/workflows/main.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 68647942..289e351f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -194,6 +194,11 @@ jobs: tar -xzf `pwd`/artifacts/wapm-linux-amd64/wapm-cli.tar.gz cp ./bin/wapm /home/runner/.wasmer/bin/wapm chmod +x /home/runner/.wasmer/bin/wapm + - name: Configure cargo data directory + private access tokens + run: | + echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV + echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt + git config --global credential.helper "store --file creds.txt" - name: 'Regression test: direct execution works' shell: bash run: | From 5115a30ad99f39e09e57cb3d8adfe9ce1fd66813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 26 Jul 2022 10:45:35 +0200 Subject: [PATCH 44/74] Fix end-to-end test (remove cargo build) again --- end-to-end-tests/ci/direct-execution.sh | 10 ++---- end-to-end-tests/ci/init-and-add.sh | 10 ++---- end-to-end-tests/ci/install.sh | 10 ++---- end-to-end-tests/ci/manifest-validation.sh | 10 ++---- end-to-end-tests/ci/package-fs-mapping.sh | 10 ++---- end-to-end-tests/ci/validate-global.sh | 10 ++---- end-to-end-tests/ci/verification.sh | 10 ++---- end-to-end-tests/direct_execute.sh | 16 ++++----- end-to-end-tests/init-and-add.sh | 14 ++++---- end-to-end-tests/install.sh | 42 +++++++++++----------- end-to-end-tests/manifest-validation.sh | 10 +++--- end-to-end-tests/package-fs-mapping.sh | 16 ++++----- end-to-end-tests/validate-global.sh | 26 +++++++------- end-to-end-tests/verification.sh | 22 ++++++------ 14 files changed, 87 insertions(+), 129 deletions(-) diff --git a/end-to-end-tests/ci/direct-execution.sh b/end-to-end-tests/ci/direct-execution.sh index 281a2e4f..c7ef699c 100755 --- a/end-to-end-tests/ci/direct-execution.sh +++ b/end-to-end-tests/ci/direct-execution.sh @@ -5,16 +5,10 @@ rm -f $WASMER_DIR/.wax_index.toml # TODO force clear cache rm -f wapm.toml rm -f wapm.lock -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all chmod +x end-to-end-tests/direct_execute.sh echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/direct_execute.sh &> /tmp/direct_execute.txt +./end-to-end-tests/direct_execute.sh &> /tmp/direct_execute.txt echo "GENERATED OUTPUT: ----" cat /tmp/direct_execute.txt echo "EXPECTED OUTPUT: ----" diff --git a/end-to-end-tests/ci/init-and-add.sh b/end-to-end-tests/ci/init-and-add.sh index 801fa340..3e915dc8 100755 --- a/end-to-end-tests/ci/init-and-add.sh +++ b/end-to-end-tests/ci/init-and-add.sh @@ -6,16 +6,10 @@ rm -f $WASMER_DIR/globals/wapm.lock rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all chmod +x end-to-end-tests/init-and-add.sh echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/init-and-add.sh &> /tmp/init-and-add-out.txt +./end-to-end-tests/init-and-add.sh &> /tmp/init-and-add-out.txt echo "GENERATED OUTPUT:" cat /tmp/init-and-add-out.txt echo "EXPECTED OUTPUT:" diff --git a/end-to-end-tests/ci/install.sh b/end-to-end-tests/ci/install.sh index 6e61237e..a82033eb 100755 --- a/end-to-end-tests/ci/install.sh +++ b/end-to-end-tests/ci/install.sh @@ -7,15 +7,9 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/install.sh -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/install.sh &> /tmp/install-out.txt +./end-to-end-tests/install.sh &> /tmp/install-out.txt echo "GENERATED OUTPUT:" cat /tmp/install-out.txt echo "EXPECTED OUTPUT:" diff --git a/end-to-end-tests/ci/manifest-validation.sh b/end-to-end-tests/ci/manifest-validation.sh index 94436622..a3d62a85 100755 --- a/end-to-end-tests/ci/manifest-validation.sh +++ b/end-to-end-tests/ci/manifest-validation.sh @@ -7,15 +7,9 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/manifest-validation.sh -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/manifest-validation.sh &> /tmp/manifest-validation-out.txt +./end-to-end-tests/manifest-validation.sh &> /tmp/manifest-validation-out.txt echo "GENERATED OUTPUT:" cat /tmp/manifest-validation-out.txt echo "EXPECTED OUTPUT:" diff --git a/end-to-end-tests/ci/package-fs-mapping.sh b/end-to-end-tests/ci/package-fs-mapping.sh index 4c4a6854..716d0841 100755 --- a/end-to-end-tests/ci/package-fs-mapping.sh +++ b/end-to-end-tests/ci/package-fs-mapping.sh @@ -7,15 +7,9 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/package-fs-mapping.sh -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/package-fs-mapping.sh &> /tmp/package-fs-mapping-out.txt +./end-to-end-tests/package-fs-mapping.sh &> /tmp/package-fs-mapping-out.txt echo "GENERATED OUTPUT:" cat /tmp/package-fs-mapping-out.txt echo "EXPECTED OUTPUT:" diff --git a/end-to-end-tests/ci/validate-global.sh b/end-to-end-tests/ci/validate-global.sh index 1a6fbc61..1d9d470a 100755 --- a/end-to-end-tests/ci/validate-global.sh +++ b/end-to-end-tests/ci/validate-global.sh @@ -7,15 +7,9 @@ rm -f wapm.lock rm -f wapm.toml rm -rf wapm_packages chmod +x end-to-end-tests/validate-global.sh -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/validate-global.sh &> /tmp/validate-global-out.txt +./end-to-end-tests/validate-global.sh &> /tmp/validate-global-out.txt echo "GENERATED OUTPUT:" cat /tmp/validate-global-out.txt echo "EXPECTED OUTPUT:" diff --git a/end-to-end-tests/ci/verification.sh b/end-to-end-tests/ci/verification.sh index 278339b0..996b97f6 100755 --- a/end-to-end-tests/ci/verification.sh +++ b/end-to-end-tests/ci/verification.sh @@ -7,15 +7,9 @@ rm -rf wapm_packages rm -f wapm.toml rm -f wapm.lock chmod +x end-to-end-tests/verification.sh -cargo build --release -echo "pwd" -pwd -WORKDIR=$(pwd) -WAPM_EXE=$(readlink -m $WORKDIR/target/release/wapm) -echo $WAPM_EXE -$WAPM_EXE uninstall --global --all +wapm uninstall --global --all echo "RUNNING SCRIPT..." -WAPM=$WAPM_EXE ./end-to-end-tests/verification.sh &> /tmp/verification-out.txt +./end-to-end-tests/verification.sh &> /tmp/verification-out.txt echo "GENERATED OUTPUT:" cat /tmp/verification-out.txt echo "EXPECTED OUTPUT:" diff --git a/end-to-end-tests/direct_execute.sh b/end-to-end-tests/direct_execute.sh index 5ea4a8fd..e57678c6 100755 --- a/end-to-end-tests/direct_execute.sh +++ b/end-to-end-tests/direct_execute.sh @@ -2,20 +2,20 @@ export RUST_BACKTRACE=1 ln -sf `which wapm` wax -WAX=$(echo $WAPM execute) -$WAPM config set registry.url "https://registry.wapm.dev" +WAX=$(echo wapm execute) +wapm config set registry.url "https://registry.wapm.dev" echo "hello" | wapm execute base64 $WAX echo "hello" -$WAPM install namespace-example/cowsay +wapm install namespace-example/cowsay $WAX --emscripten cowsay "hello" -$WAPM uninstall namespace-example/cowsay -$WAPM install lolcat -$WAPM run lolcat -V +wapm uninstall namespace-example/cowsay +wapm install lolcat +wapm run lolcat -V $WAX lolcat -V -$WAPM uninstall lolcat +wapm uninstall lolcat $WAX lolcat -V -$WAPM list -a +wapm list -a rm -rf $(./wax --which lolcat)/wapm_packages/_/lolcat@0.1.1/* $WAX lolcat -V $WAX --offline lolcat -V diff --git a/end-to-end-tests/init-and-add.sh b/end-to-end-tests/init-and-add.sh index f58d6551..eaa7a9db 100755 --- a/end-to-end-tests/init-and-add.sh +++ b/end-to-end-tests/init-and-add.sh @@ -2,12 +2,12 @@ mkdir test-package cd test-package -WAX=$(echo $WAPM execute) -$WAPM config set registry.url "https://registry.wapm.dev" -$WAPM init -y -$WAPM add this-package-does-not-exist -$WAPM add mark2/python@0.0.4 mark2/dog2 -$WAPM add lolcat@0.1.1 -$WAPM remove lolcat +WAX=$(echo wapm execute) +wapm config set registry.url "https://registry.wapm.dev" +wapm init -y +wapm add this-package-does-not-exist +wapm add mark2/python@0.0.4 mark2/dog2 +wapm add lolcat@0.1.1 +wapm remove lolcat cd .. rm -rf test-package diff --git a/end-to-end-tests/install.sh b/end-to-end-tests/install.sh index 1dc7fc2a..d1ab352a 100755 --- a/end-to-end-tests/install.sh +++ b/end-to-end-tests/install.sh @@ -1,23 +1,23 @@ #!/bin/sh -$WAPM config set registry.url "https://registry.wapm.dev" -$WAPM install namespace-example/cowsay@0.1.2 -$WAPM install namespace-example/cowsay@0.1.2 -$WAPM run cowsay "hello, world" -$WAPM list -$WAPM uninstall namespace-example/cowsay -$WAPM install namespace-example/cowsay@0.1.2 -$WAPM uninstall namespace-example/cowsay -$WAPM uninstall namespace-example/cowsay -$WAPM install -g mark/rust-example@0.1.11 -$WAPM run hq9+ -e "H" -$WAPM uninstall -g mark/rust-example -$WAPM install -g mark/wapm-override-test@0.1.0 -$WAPM list -a -$WAPM run wapm-override-test -$WAPM install mark/wapm-override-test@0.2.0 -$WAPM run wapm-override-test -$WAPM uninstall mark/wapm-override-test -$WAPM run wapm-override-test -$WAPM uninstall -g mark/wapm-override-test -$WAPM install namespace-example/cowsay@0.1.1 namespace-example/cowsay@0.1.2 +wapm config set registry.url "https://registry.wapm.dev" +wapm install namespace-example/cowsay@0.1.2 +wapm install namespace-example/cowsay@0.1.2 +wapm run cowsay "hello, world" +wapm list +wapm uninstall namespace-example/cowsay +wapm install namespace-example/cowsay@0.1.2 +wapm uninstall namespace-example/cowsay +wapm uninstall namespace-example/cowsay +wapm install -g mark/rust-example@0.1.11 +wapm run hq9+ -e "H" +wapm uninstall -g mark/rust-example +wapm install -g mark/wapm-override-test@0.1.0 +wapm list -a +wapm run wapm-override-test +wapm install mark/wapm-override-test@0.2.0 +wapm run wapm-override-test +wapm uninstall mark/wapm-override-test +wapm run wapm-override-test +wapm uninstall -g mark/wapm-override-test +wapm install namespace-example/cowsay@0.1.1 namespace-example/cowsay@0.1.2 diff --git a/end-to-end-tests/manifest-validation.sh b/end-to-end-tests/manifest-validation.sh index b9f9380d..52aaacd2 100755 --- a/end-to-end-tests/manifest-validation.sh +++ b/end-to-end-tests/manifest-validation.sh @@ -1,14 +1,14 @@ #!/bin/sh export RUST_BACKTRACE=1 -$WAPM config set registry.url "https://registry.wapm.dev" +wapm config set registry.url "https://registry.wapm.dev" echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -$WAPM publish --dry-run +wapm publish --dry-run # get a wasm module so we forget the abi field -$WAPM install mark2/dog2@0.0.13 --force-yes +wapm install mark2/dog2@0.0.13 --force-yes cp wapm_packages/mark2/dog2@0.0.13/dog.wasm . echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[module]]\nname="test-module"\nsource="dog.wasm"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -$WAPM publish --dry-run +wapm publish --dry-run echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[module]]\nname="test-module"\nsource="dog.wasm"\nabi="wasi"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -$WAPM publish --dry-run +wapm publish --dry-run rm dog.wasm diff --git a/end-to-end-tests/package-fs-mapping.sh b/end-to-end-tests/package-fs-mapping.sh index 7eaaaeea..a0f46922 100755 --- a/end-to-end-tests/package-fs-mapping.sh +++ b/end-to-end-tests/package-fs-mapping.sh @@ -1,14 +1,14 @@ #!/bin/sh export RUST_BACKTRACE=1 -$WAPM config set registry.url "https://registry.wapm.dev" -$WAPM install -g mark2/dog2@0.0.13 --force-yes -$WAPM run dog -- data -$WAPM uninstall -g mark2/dog2 -$WAPM install mark2/dog2@0.0.13 -$WAPM run dog -- data -$WAPM uninstall mark2/dog2 +wapm config set registry.url "https://registry.wapm.dev" +wapm install -g mark2/dog2@0.0.13 --force-yes +wapm run dog -- data +wapm uninstall -g mark2/dog2 +wapm install mark2/dog2@0.0.13 +wapm run dog -- data +wapm uninstall mark2/dog2 cp wapm_packages/mark2/dog2@0.0.13/dog.wasm . echo '[package]\nname="test"\nversion="0.0.0"\ndescription="this is a test"\n[[module]]\nname="test-module"\nsource="dog.wasm"\n[[command]]\nname="test"\nmodule="test-module"\n[fs]\n"wapm_file"="src/bin"' > wapm.toml -$WAPM run test -- wapm_file +wapm run test -- wapm_file rm dog.wasm diff --git a/end-to-end-tests/validate-global.sh b/end-to-end-tests/validate-global.sh index a197c479..cc03fcc4 100755 --- a/end-to-end-tests/validate-global.sh +++ b/end-to-end-tests/validate-global.sh @@ -1,19 +1,19 @@ #!/bin/sh -$WAPM config set registry.url "https://registry.wapm.dev" +wapm config set registry.url "https://registry.wapm.dev" # test that the command name is overriden by default -$WAPM install -g mark2/binary-name-matters@0.0.3 -y -$WAPM run binary-name-matters -$WAPM uninstall -g mark2/binary-name-matters -$WAPM install mark2/binary-name-matters@0.0.3 -y -$WAPM run binary-name-matters -$WAPM uninstall mark2/binary-name-matters +wapm install -g mark2/binary-name-matters@0.0.3 -y +wapm run binary-name-matters +wapm uninstall -g mark2/binary-name-matters +wapm install mark2/binary-name-matters@0.0.3 -y +wapm run binary-name-matters +wapm uninstall mark2/binary-name-matters # disable command rename and manually reenable it with `wasmer-extra-flags` -$WAPM install -g mark2/binary-name-matters-2 -y -$WAPM run binary-name-matters-2 -$WAPM uninstall -g mark2/binary-name-matters-2 -$WAPM install mark2/binary-name-matters-2 -y -$WAPM run binary-name-matters-2 -$WAPM uninstall mark2/binary-name-matters-2 +wapm install -g mark2/binary-name-matters-2 -y +wapm run binary-name-matters-2 +wapm uninstall -g mark2/binary-name-matters-2 +wapm install mark2/binary-name-matters-2 -y +wapm run binary-name-matters-2 +wapm uninstall mark2/binary-name-matters-2 diff --git a/end-to-end-tests/verification.sh b/end-to-end-tests/verification.sh index be753693..05592d74 100755 --- a/end-to-end-tests/verification.sh +++ b/end-to-end-tests/verification.sh @@ -1,17 +1,17 @@ #!/bin/sh export RUST_BACKTRACE=1 -$WAPM config set registry.url "https://registry.wapm.dev" +wapm config set registry.url "https://registry.wapm.dev" # redirect stderr to /dev/null so we can capture important stderr -yes no 2> /dev/null | $WAPM install mark2/dog2@0.0.0 +yes no 2> /dev/null | wapm install mark2/dog2@0.0.0 # wc because the date changes -$WAPM keys list -a -yes 2> /dev/null | $WAPM install mark2/dog@0.0.4 -$WAPM keys list -a | wc -l | xargs -$WAPM uninstall mark2/dog -$WAPM install mark2/dog@0.0.4 -$WAPM install mark2/dog2@0.0.0 +wapm keys list -a +yes 2> /dev/null | wapm install mark2/dog@0.0.4 +wapm keys list -a | wc -l | xargs +wapm uninstall mark2/dog +wapm install mark2/dog@0.0.4 +wapm install mark2/dog2@0.0.0 rm $HOME/.wasmer/wapm.sqlite &> /dev/null -$WAPM install syrusakbary/dog3@0.0.0 --force-yes -$WAPM uninstall syrusakbary/dog3 -$WAPM install syrusakbary/dog3@0.0.0 --force-yes +wapm install syrusakbary/dog3@0.0.0 --force-yes +wapm uninstall syrusakbary/dog3 +wapm install syrusakbary/dog3@0.0.0 --force-yes From 689c206b2d8200ed73ebb248bb002e4cd0814715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 26 Jul 2022 15:43:40 +0200 Subject: [PATCH 45/74] Make error message for failed InterfaceVersion download more descriptive --- src/dataflow/interfaces.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dataflow/interfaces.rs b/src/dataflow/interfaces.rs index 93d2b6f9..14470b15 100644 --- a/src/dataflow/interfaces.rs +++ b/src/dataflow/interfaces.rs @@ -33,10 +33,10 @@ impl InterfaceFromServer { } pub fn get(name: String, version: String) -> anyhow::Result { - let response = Self::get_response(name, version)?; + let response = Self::get_response(name.clone(), version.clone())?; let response_val = response .interface - .ok_or_else(|| anyhow!("Error downloading Interface from the server"))?; + .ok_or_else(|| anyhow!("Error downloading Interface from the server: {name}@{version}"))?; Ok(Self { name: response_val.interface.name, version: response_val.version, From b80c752ec02a2474b84fc6c94f37e8fbd3c2b878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 29 Jul 2022 10:39:35 +0200 Subject: [PATCH 46/74] Use wasm-request-bus v0.2.0 for now --- Cargo.lock | 90 ++++++++++++++++++++++++++++++++++--- wapm-resolve-url/Cargo.toml | 4 +- 2 files changed, 86 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3046ee59..6a6d5654 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2314,7 +2314,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "wapm-targz-to-pirita", @@ -3941,8 +3941,8 @@ dependencies = [ "serde_json", "thiserror", "url 2.2.2", - "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus-process 0.1.0", + "wasm-bus-reqwest 0.1.0", "whoami", ] @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "base64 0.13.0", @@ -4092,6 +4092,25 @@ version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +[[package]] +name = "wasm-bus" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb298c970d0f4532c3d80448e2191b873d6cee4bd00cd3efed077926b2a06ab9" +dependencies = [ + "base64 0.13.0", + "bincode", + "cooked-waker", + "derivative", + "once_cell", + "serde", + "serde_json", + "tokio", + "tracing", + "wasm-bus-macros 0.1.0", + "wasm-bus-types 0.1.0", +] + [[package]] name = "wasm-bus" version = "1.1.0" @@ -4130,6 +4149,20 @@ dependencies = [ "wasm-bus-types 1.1.0", ] +[[package]] +name = "wasm-bus-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "996fa338855d96f5cdb8a6d8999f5a315b281d9019b9b2ad0a62570f64dc89fd" +dependencies = [ + "convert_case", + "derivative", + "proc-macro2", + "quote", + "syn", + "wasm-bus-types 0.1.0", +] + [[package]] name = "wasm-bus-macros" version = "1.1.0" @@ -4157,6 +4190,21 @@ dependencies = [ "wasm-bus-types 1.1.0", ] +[[package]] +name = "wasm-bus-process" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bff68e7e17fe033e2cbb5d4c87319fe8877275e0166d9be523e3d20ef6ad1b2" +dependencies = [ + "async-trait", + "bytes", + "dummy-waker", + "serde", + "tokio", + "tracing", + "wasm-bus 0.4.1", +] + [[package]] name = "wasm-bus-process" version = "1.1.0" @@ -4186,6 +4234,30 @@ dependencies = [ "wasm-bus 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", ] +[[package]] +name = "wasm-bus-reqwest" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c19653892885942813c20a381bda8fd12f689c0719d62c9898ee9b048cec54b" +dependencies = [ + "async-trait", + "bytes", + "formdata", + "futures-core", + "futures-util", + "http", + "http-body", + "mime_guess", + "pin-project-lite", + "serde", + "serde_json", + "tokio", + "tracing", + "url 2.2.2", + "urlencoding", + "wasm-bus 0.4.1", +] + [[package]] name = "wasm-bus-reqwest" version = "1.2.0" @@ -4233,6 +4305,12 @@ dependencies = [ "wasm-bus 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", ] +[[package]] +name = "wasm-bus-types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "407ce28d552f155838b2c1038e3779668901228142a4a47176323851099af107" + [[package]] name = "wasm-bus-types" version = "1.0.0" @@ -4303,7 +4381,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "base64 0.13.0", @@ -4326,7 +4404,7 @@ dependencies = [ [[package]] name = "webc-runner" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" dependencies = [ "anyhow", "futures-util", diff --git a/wapm-resolve-url/Cargo.toml b/wapm-resolve-url/Cargo.toml index 8ae9bfb2..1fdff55e 100644 --- a/wapm-resolve-url/Cargo.toml +++ b/wapm-resolve-url/Cargo.toml @@ -16,5 +16,5 @@ whoami = "1.2.1" reqwest = { version = "0.11.0", features = ["rustls-tls", "blocking", "json", "gzip","socks", "multipart"] } [target.'cfg(target_os = "wasi")'.dependencies] -wasm-bus-reqwest = { git = "https://github.com/tokera-com/ate", rev = "77b2bca4264e1fcb3d977650c09bb228a782b6f2" } -wasm-bus-process = { git = "https://github.com/tokera-com/ate", rev = "77b2bca4264e1fcb3d977650c09bb228a782b6f2" } +wasm-bus-reqwest = "0.1.0" +wasm-bus-process = "0.1.0" From ec1d0b41e9fd1b4248683bbdf148733e041d1639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 2 Aug 2022 11:37:50 +0200 Subject: [PATCH 47/74] Use fs::copy instead of fs::rename --- src/commands/install.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands/install.rs b/src/commands/install.rs index bf2fd56a..5ad3e2d4 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -246,7 +246,6 @@ pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { options.nocache || options.force_yes, ) .await { - println!("download with autoconversion!"); download_pirita( &p.name, &p.version, @@ -410,7 +409,7 @@ async fn download_pirita( pb.finish_and_clear(); - std::fs::rename(&temp_tar_gz_path, &target_file_path)?; + std::fs::copy(&temp_tar_gz_path, &target_file_path)?; if autoconvert && pirita::PiritaFile::load_mmap(temp_tar_gz_path.clone()).is_none() { From f69fe179697703139bb86ccb01ee44e329a91cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 8 Aug 2022 18:01:54 +0200 Subject: [PATCH 48/74] Disable default-features from reqwest dependency --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a972db03..fcb41a34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ wapm-resolve-url = { version = "0.1.0", path = "./wapm-resolve-url" } [target.'cfg(not(target_os = "wasi"))'.dependencies] atty = "0.2" -reqwest = { version = "0.11.0", features = ["native-tls-vendored", "blocking", "json", "gzip","socks","multipart"], optional = true } +reqwest = { version = "0.11.0", default-features = false, features = ["rustls-tls", "blocking"], optional = true } tar = { version = "0.4" } tokio = { version = "1.19.2", features = ["full"] } From 74297e37a96e27c2aee4fc8fcaf4f5dea15a4423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 8 Aug 2022 18:30:34 +0200 Subject: [PATCH 49/74] Update dependency on pirita.git --- Cargo.lock | 261 ++++++++--------------------------------------------- Cargo.toml | 2 +- 2 files changed, 41 insertions(+), 222 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a6d5654..23468f1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,17 +63,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.6", - "once_cell", - "version_check 0.9.4", -] - [[package]] name = "aho-corasick" version = "0.7.18" @@ -1412,7 +1401,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ - "ahash 0.4.7", + "ahash", ] [[package]] @@ -1420,10 +1409,6 @@ name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.6", - "serde", -] [[package]] name = "hashlink" @@ -1878,15 +1863,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - [[package]] name = "memsec" version = "0.6.2" @@ -2136,15 +2112,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "111.20.0+1.1.1o" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92892c4f87d56e376e469ace79f1128fdaded07646ddf73aa0be4706ff712dec" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.74" @@ -2154,7 +2121,6 @@ dependencies = [ "autocfg 1.1.0", "cc", "libc", - "openssl-src", "pkg-config", "vcpkg", ] @@ -2193,12 +2159,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "paste" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" - [[package]] name = "path-clean" version = "0.1.0" @@ -2314,12 +2274,11 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=f1aa2f79243c02197715b4c35524aad60de83ec9#f1aa2f79243c02197715b4c35524aad60de83ec9" dependencies = [ "anyhow", "wapm-targz-to-pirita", "webc", - "webc-runner", ] [[package]] @@ -2660,28 +2619,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "rmp" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44519172358fd6d58656c86ab8e7fbc9e1490c3e8f14d35ed78ca0dd07403c9f" -dependencies = [ - "byteorder", - "num-traits", - "paste", -] - -[[package]] -name = "rmp-serde" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" -dependencies = [ - "byteorder", - "rmp", - "serde", -] - [[package]] name = "rpassword" version = "5.0.1" @@ -2816,6 +2753,15 @@ dependencies = [ "cipher", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.20" @@ -3045,18 +2991,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-xml-rs" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65162e9059be2f6a3421ebbb4fef3e74b7d9e7c60c50a0e292c6239f19f1edfa" -dependencies = [ - "log 0.4.17", - "serde", - "thiserror", - "xml-rs", -] - [[package]] name = "serde_cbor" version = "0.11.2" @@ -3866,6 +3800,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + [[package]] name = "want" version = "0.3.0" @@ -3921,10 +3866,10 @@ dependencies = [ "tokio", "toml", "url 2.2.2", - "wapm-resolve-url 0.1.0", + "wapm-resolve-url", "wapm-toml", - "wasm-bus-process 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bus-reqwest 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bus-process 1.1.0", + "wasm-bus-reqwest 1.2.0", "wasmer-wasm-interface", "wasmparser", "whoami", @@ -3946,32 +3891,14 @@ dependencies = [ "whoami", ] -[[package]] -name = "wapm-resolve-url" -version = "0.1.0" -source = "git+https://github.com/wasmerio/wapm-cli?rev=a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e#a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e" -dependencies = [ - "anyhow", - "graphql_client", - "reqwest", - "serde", - "serde_json", - "thiserror", - "url 2.2.2", - "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "whoami", -] - [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=f1aa2f79243c02197715b4c35524aad60de83ec9#f1aa2f79243c02197715b4c35524aad60de83ec9" dependencies = [ "anyhow", "base64 0.13.0", "flate2", - "indexmap", "json5", "rand 0.8.5", "sequoia-openpgp", @@ -4020,12 +3947,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasix" -version = "0.11.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3fb76de32c72156fd25fa56776b4ed3d02fcafddfa36d24fac6b135bc7e9bca" - [[package]] name = "wasm-bindgen" version = "0.2.80" @@ -4126,29 +4047,10 @@ dependencies = [ "serde_json", "tokio", "tracing", - "wasm-bus-macros 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bus-macros 1.1.0", "wasm-bus-types 1.0.0", ] -[[package]] -name = "wasm-bus" -version = "1.1.0" -source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" -dependencies = [ - "async-trait", - "base64 0.13.0", - "cooked-waker", - "derivative", - "once_cell", - "serde", - "sha2 0.10.2", - "tokio", - "tracing", - "wasix", - "wasm-bus-macros 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "wasm-bus-types 1.1.0", -] - [[package]] name = "wasm-bus-macros" version = "0.1.0" @@ -4177,19 +4079,6 @@ dependencies = [ "wasm-bus-types 1.0.0", ] -[[package]] -name = "wasm-bus-macros" -version = "1.1.0" -source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" -dependencies = [ - "convert_case", - "derivative", - "proc-macro2", - "quote", - "syn", - "wasm-bus-types 1.1.0", -] - [[package]] name = "wasm-bus-process" version = "0.1.0" @@ -4217,21 +4106,7 @@ dependencies = [ "serde", "tokio", "tracing", - "wasm-bus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bus-process" -version = "1.1.0" -source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" -dependencies = [ - "async-trait", - "bytes", - "dummy-waker", - "serde", - "tokio", - "tracing", - "wasm-bus 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus 1.1.0", ] [[package]] @@ -4279,30 +4154,7 @@ dependencies = [ "tracing", "url 2.2.2", "urlencoding", - "wasm-bus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-bus-reqwest" -version = "1.2.0" -source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" -dependencies = [ - "async-trait", - "bytes", - "formdata", - "futures-core", - "futures-util", - "http", - "http-body", - "mime_guess", - "pin-project-lite", - "serde", - "serde_json", - "tokio", - "tracing", - "url 2.2.2", - "urlencoding", - "wasm-bus 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", + "wasm-bus 1.1.0", ] [[package]] @@ -4317,19 +4169,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d49ff958a0d83cacc3dc470ded238af5e1d316dcdc6d74322d2b7b2a438046d" -[[package]] -name = "wasm-bus-types" -version = "1.1.0" -source = "git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2#77b2bca4264e1fcb3d977650c09bb228a782b6f2" -dependencies = [ - "bincode", - "rmp-serde", - "serde", - "serde-xml-rs", - "serde_json", - "serde_yaml", -] - [[package]] name = "wasmer-wasm-interface" version = "0.1.0" @@ -4381,16 +4220,14 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=f1aa2f79243c02197715b4c35524aad60de83ec9#f1aa2f79243c02197715b4c35524aad60de83ec9" dependencies = [ "anyhow", "base64 0.13.0", - "hashbrown 0.11.2", "indexmap", "leb128", "lexical-sort", "memchr", - "memmap2", "path-clean", "rand 0.8.5", "sequoia-openpgp", @@ -4399,28 +4236,7 @@ dependencies = [ "serde_json", "sha2 0.10.2", "url 2.2.2", -] - -[[package]] -name = "webc-runner" -version = "0.1.0" -source = "git+git://git@github.com/wasmerio/pirita.git?rev=1f898dca174c1a4effab78c16159a4b5515b8cdb#1f898dca174c1a4effab78c16159a4b5515b8cdb" -dependencies = [ - "anyhow", - "futures-util", - "lazy_static", - "libc", - "log 0.4.17", - "regex", - "reqwest", - "serde", - "serde_derive", - "tokio", - "url 2.2.2", - "wapm-resolve-url 0.1.0 (git+https://github.com/wasmerio/wapm-cli?rev=a4f4f0d9dc2ba58627ee1051843367a4e5ffcf4e)", - "wasm-bus-process 1.1.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "wasm-bus-reqwest 1.2.0 (git+https://github.com/tokera-com/ate?rev=77b2bca4264e1fcb3d977650c09bb228a782b6f2)", - "webc", + "walkdir", ] [[package]] @@ -4468,6 +4284,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -4552,12 +4377,6 @@ dependencies = [ "libc", ] -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - [[package]] name = "xxhash-rust" version = "0.8.5" diff --git a/Cargo.toml b/Cargo.toml index fcb41a34..3c59123a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] git = "https://github.com/wasmerio/pirita.git" -rev = "1f898dca174c1a4effab78c16159a4b5515b8cdb" +rev = "f1aa2f79243c02197715b4c35524aad60de83ec9" default-features = false features = ["autoconvert"] optional = true From 6a7cf4eafe3fec53774e10722a1054ef86eddce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 8 Aug 2022 18:40:59 +0200 Subject: [PATCH 50/74] Update pirita dependency --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3c59123a..fe10b335 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] git = "https://github.com/wasmerio/pirita.git" -rev = "f1aa2f79243c02197715b4c35524aad60de83ec9" +rev = "39b90ff364337b60b38047f53e1ef3db3fdbd125" default-features = false features = ["autoconvert"] optional = true From 738023609f1dde431ef2265e98f6c5848962fce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 8 Aug 2022 18:43:26 +0200 Subject: [PATCH 51/74] Disable default TLS for wapm-resolve-url --- wapm-resolve-url/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wapm-resolve-url/Cargo.toml b/wapm-resolve-url/Cargo.toml index 1fdff55e..ac61ca95 100644 --- a/wapm-resolve-url/Cargo.toml +++ b/wapm-resolve-url/Cargo.toml @@ -13,7 +13,7 @@ serde_json = "1.0.81" whoami = "1.2.1" [target.'cfg(not(target_os = "wasi"))'.dependencies] -reqwest = { version = "0.11.0", features = ["rustls-tls", "blocking", "json", "gzip","socks", "multipart"] } +reqwest = { version = "0.11.0", default-features = false, features = ["rustls-tls", "blocking", "json", "gzip","socks", "multipart"] } [target.'cfg(target_os = "wasi")'.dependencies] wasm-bus-reqwest = "0.1.0" From d231735586fb153bc55eb45c3e3523040d37ea89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 8 Aug 2022 19:50:40 +0200 Subject: [PATCH 52/74] Update pirita version --- Cargo.lock | 16 +++++++++++++--- Cargo.toml | 6 +++--- src/commands/install.rs | 6 +++--- src/commands/run.rs | 7 ++----- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23468f1c..1aa2f25f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1863,6 +1863,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + [[package]] name = "memsec" version = "0.6.2" @@ -2274,7 +2283,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=f1aa2f79243c02197715b4c35524aad60de83ec9#f1aa2f79243c02197715b4c35524aad60de83ec9" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1#5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" dependencies = [ "anyhow", "wapm-targz-to-pirita", @@ -3894,7 +3903,7 @@ dependencies = [ [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=f1aa2f79243c02197715b4c35524aad60de83ec9#f1aa2f79243c02197715b4c35524aad60de83ec9" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1#5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" dependencies = [ "anyhow", "base64 0.13.0", @@ -4220,7 +4229,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=f1aa2f79243c02197715b4c35524aad60de83ec9#f1aa2f79243c02197715b4c35524aad60de83ec9" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1#5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" dependencies = [ "anyhow", "base64 0.13.0", @@ -4228,6 +4237,7 @@ dependencies = [ "leb128", "lexical-sort", "memchr", + "memmap2", "path-clean", "rand 0.8.5", "sequoia-openpgp", diff --git a/Cargo.toml b/Cargo.toml index fe10b335..a410b755 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,10 +62,10 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "https://github.com/wasmerio/pirita.git" -rev = "39b90ff364337b60b38047f53e1ef3db3fdbd125" +git = "ssh://git@github.com/wasmerio/pirita.git" +rev = "5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" default-features = false -features = ["autoconvert"] +features = ["autoconvert", "mmap"] optional = true [dev-dependencies] diff --git a/src/commands/install.rs b/src/commands/install.rs index 5ad3e2d4..6da16573 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -392,7 +392,7 @@ async fn download_pirita( if let Some(first_chunk) = response.chunk().await? { let new = (downloaded + first_chunk.len() as u64).min(total_size); downloaded = new; - if !autoconvert && !pirita::PiritaFile::check_is_pirita_file(&first_chunk) { + if !autoconvert && !pirita::Pirita::check_is_pirita_file(&first_chunk) { pb.finish_and_clear(); return Err(anyhow!("Error: remote package is not a PiritaFile")); } @@ -411,7 +411,7 @@ async fn download_pirita( std::fs::copy(&temp_tar_gz_path, &target_file_path)?; - if autoconvert && pirita::PiritaFile::load_mmap(temp_tar_gz_path.clone()).is_none() { + if autoconvert && pirita::Pirita::load_mmap(temp_tar_gz_path.clone()).is_none() { std::fs::remove_file(&target_file_path)?; @@ -434,7 +434,7 @@ async fn download_pirita( } } - let parsed_file = pirita::PiritaFile::load_mmap(target_file_path.clone()).ok_or(anyhow!( + let parsed_file = pirita::Pirita::load_mmap(target_file_path.clone()).ok_or(anyhow!( "Could not parse {key:?} ({target_file_path:?}): not a PiritaFile" ))?; diff --git a/src/commands/run.rs b/src/commands/run.rs index 303a11f1..30a80c44 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -130,11 +130,8 @@ fn run_pirita(args: &[String], rt_args: &[OsString]) -> Result<(), anyhow::Error pub fn run(run_options: RunOpt) -> anyhow::Result<()> { if std::env::var("USE_PIRITA") == Ok("1".to_string()) { - match try_run_pirita(&run_options) { - Ok(()) => return Ok(()), - Err(PiritaRunError::Initialize(_)) => { }, - Err(PiritaRunError::Run(e)) => return Err(e), - } + return try_run_pirita(&run_options) + .map_err(|e| anyhow::anyhow!("{e}")); } let command_name = run_options.command.as_str(); From 5a8799803dd799c27b5968b20812b3598cd0d3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Mon, 8 Aug 2022 20:08:49 +0200 Subject: [PATCH 53/74] Debug "wapm install" --- src/commands/install.rs | 75 +++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/src/commands/install.rs b/src/commands/install.rs index 6da16573..af6440f1 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -237,6 +237,7 @@ pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { match p.pirita_download_url.as_ref() { Some(pirita_url) => { + println!("downloading {pirita_url}"); if let Err(_) = download_pirita( &p.name, &p.version, @@ -246,6 +247,7 @@ pub fn install_pirita(options: &InstallOpt) -> anyhow::Result<()> { options.nocache || options.force_yes, ) .await { + println!("downloading with autoconvert!"); download_pirita( &p.name, &p.version, @@ -351,6 +353,19 @@ async fn download_pirita( .and_then(|c| c.to_str().ok()?.parse().ok()) .unwrap_or(u64::MAX); + let temp_dir = + create_temp_dir() + .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; + + let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); + + std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) + .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; + + let temp_tar_gz_path = tmp_dir_path + .join("wapm_package_install") + .join("package.pirita"); + if nocache || autoconvert || ( target_file_path.exists() && target_file_path.metadata()?.len() == total_size && @@ -360,19 +375,6 @@ async fn download_pirita( .interact()? ) { - let temp_dir = - create_temp_dir() - .map_err(|e| Error::DownloadError(key.to_string(), e.to_string()))?; - - let tmp_dir_path: &std::path::Path = temp_dir.as_ref(); - - std::fs::create_dir_all(tmp_dir_path.join("wapm_package_install")) - .map_err(|e| Error::IoErrorCreatingDirectory(key.to_string(), e.to_string()))?; - - let temp_tar_gz_path = tmp_dir_path - .join("wapm_package_install") - .join("package.pirita"); - let mut dest = OpenOptions::new() .read(true) .write(true) @@ -408,29 +410,36 @@ async fn download_pirita( } pb.finish_and_clear(); + println!("downloaded: {download_url} to {}", temp_tar_gz_path.display()); std::fs::copy(&temp_tar_gz_path, &target_file_path)?; + } - if autoconvert && pirita::Pirita::load_mmap(temp_tar_gz_path.clone()).is_none() { - - std::fs::remove_file(&target_file_path)?; - - // autoconvert .tar.gz => .pirita after download - let _ = pirita::convert_targz_to_pirita( - &temp_tar_gz_path, - &target_file_path, - None, - &pirita::TransformManifestFunctions { - get_atoms_wapm_toml: wapm_toml::get_wapm_atom_file_paths, - get_dependencies: wapm_toml::get_dependencies, - get_package_annotations: wapm_toml::get_package_annotations, - get_modules: wapm_toml::get_modules, - get_commands: wapm_toml::get_commands, - get_manifest_file_names: wapm_toml::get_manifest_file_names, - get_metadata_paths: wapm_toml::get_metadata_paths, - get_wapm_manifest_file_name: wapm_toml::get_wapm_manifest_file_name, - }, - ); + println!("file downloaded: {autoconvert}, {}", pirita::Pirita::load_mmap(temp_tar_gz_path.clone()).is_none()); + + if autoconvert && pirita::Pirita::load_mmap(temp_tar_gz_path.clone()).is_none() { + + std::fs::remove_file(&target_file_path)?; + + // autoconvert .tar.gz => .pirita after download + let e = pirita::convert_targz_to_pirita( + &temp_tar_gz_path, + &target_file_path, + None, + &pirita::TransformManifestFunctions { + get_atoms_wapm_toml: wapm_toml::get_wapm_atom_file_paths, + get_dependencies: wapm_toml::get_dependencies, + get_package_annotations: wapm_toml::get_package_annotations, + get_modules: wapm_toml::get_modules, + get_commands: wapm_toml::get_commands, + get_manifest_file_names: wapm_toml::get_manifest_file_names, + get_metadata_paths: wapm_toml::get_metadata_paths, + get_wapm_manifest_file_name: wapm_toml::get_wapm_manifest_file_name, + }, + ); + + if let Err(e) = e { + println!("{e}"); } } From dc9216e6c02c6616bba3180e415eba266560d7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 11 Aug 2022 16:14:46 +0200 Subject: [PATCH 54/74] Add "wasm4" ABI recognition to wapm-toml --- wapm-toml/src/lib.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index 4d499a86..f9267178 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -460,14 +460,19 @@ pub fn get_commands( return Err(anyhow::anyhow!("Command {name} is defined more than once")); } - let runner = match atom_kinds.get(module).map(|s| s.as_str()) { + let abi = atom_kinds.get(module).map(|s| s.as_str()); + let runner = match abi { Some("emscripten") => "https://webc.org/runner/emscripten/command@unstable_", - _ => "https://webc.org/runner/wasi/command@unstable_", + Some("wasm4") => "https://webc.org/runner/wasm4/command@unstable_", + Some("wasi") => "https://webc.org/runner/wasi/command@unstable_", + _ => { return Err(anyhow::anyhow!("Unknown ABI in command {name:?}: {:?}", abi.unwrap_or(""))); }, }; - let annotations_str = match atom_kinds.get(module).map(|s| s.as_str()) { + let annotations_str = match abi { Some("emscripten") => "emscripten", - _ => "wasi", + Some("wasm4") => "wasm4", + Some("wasi") => "wasi", + _ => { return Err(anyhow::anyhow!("Unknown ABI in command {name:?}: {:?}", abi.unwrap_or(""))); }, }; let runner = runner.to_string(); From 25c9165823d2dad019f8497cfea807e918555fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 11 Aug 2022 16:51:02 +0200 Subject: [PATCH 55/74] Automatically fixup dependencies to owner/package format when converting --- Cargo.lock | 1 + wapm-toml/Cargo.toml | 1 + wapm-toml/src/lib.rs | 22 ++++++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1aa2f25f..5ac019ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3936,6 +3936,7 @@ dependencies = [ "thiserror", "toml", "validator", + "wapm-resolve-url", ] [[package]] diff --git a/wapm-toml/Cargo.toml b/wapm-toml/Cargo.toml index 1c5f9201..ccf2e90a 100644 --- a/wapm-toml/Cargo.toml +++ b/wapm-toml/Cargo.toml @@ -17,6 +17,7 @@ serde_yaml = "0.8.24" serde_cbor = "0.11.2" indexmap = { version = "1.6", features = ["serde"] } validator = "0.15.0" +wapm-resolve-url = { version = "0.1.0", path = "../wapm-resolve-url" } [features] integration_tests = [] diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index f9267178..d4703c3a 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -65,9 +65,27 @@ pub fn get_dependencies(wapm: &str) -> Vec<(String, String)>{ Ok(o) => o, Err(_) => { return Vec::new(); }, }; - wapm.dependencies + let mut dependencies = wapm.dependencies .clone().unwrap_or_default() - .iter().map(|(k, v)| (k.clone(), v.clone())).collect() + .iter().map(|(k, v)| (k.clone(), v.clone())) + .collect::>(); + + let current_registry = wapm_resolve_url::get_current_wapm_registry(); + + for (k, _) in dependencies.iter_mut() { + if k.split("/").count() == 1 { + // Somebody only specified the package / command as the dependency instead + // of using the owner/package format + if let Some(r) = current_registry.as_ref() { + let package_info = wapm_resolve_url::get_tar_gz_url_of_package(r, k, None); + if let Some(pi) = package_info { + *k = pi.resolved_name.clone(); + } + } + } + } + + dependencies } pub fn get_wapm_atom_file_paths( From 7235f575b5384fa802f8068eceef627c45248c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 11 Aug 2022 17:16:02 +0200 Subject: [PATCH 56/74] Remove wasm-bus from wapm-resolve-url --- Cargo.lock | 94 +++------------------------------ wapm-resolve-url/Cargo.toml | 6 +-- wapm-resolve-url/src/graphql.rs | 16 +++++- 3 files changed, 24 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ac019ed..681af41b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3877,8 +3877,8 @@ dependencies = [ "url 2.2.2", "wapm-resolve-url", "wapm-toml", - "wasm-bus-process 1.1.0", - "wasm-bus-reqwest 1.2.0", + "wasm-bus-process", + "wasm-bus-reqwest", "wasmer-wasm-interface", "wasmparser", "whoami", @@ -3895,8 +3895,6 @@ dependencies = [ "serde_json", "thiserror", "url 2.2.2", - "wasm-bus-process 0.1.0", - "wasm-bus-reqwest 0.1.0", "whoami", ] @@ -4023,25 +4021,6 @@ version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" -[[package]] -name = "wasm-bus" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb298c970d0f4532c3d80448e2191b873d6cee4bd00cd3efed077926b2a06ab9" -dependencies = [ - "base64 0.13.0", - "bincode", - "cooked-waker", - "derivative", - "once_cell", - "serde", - "serde_json", - "tokio", - "tracing", - "wasm-bus-macros 0.1.0", - "wasm-bus-types 0.1.0", -] - [[package]] name = "wasm-bus" version = "1.1.0" @@ -4057,22 +4036,8 @@ dependencies = [ "serde_json", "tokio", "tracing", - "wasm-bus-macros 1.1.0", - "wasm-bus-types 1.0.0", -] - -[[package]] -name = "wasm-bus-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "996fa338855d96f5cdb8a6d8999f5a315b281d9019b9b2ad0a62570f64dc89fd" -dependencies = [ - "convert_case", - "derivative", - "proc-macro2", - "quote", - "syn", - "wasm-bus-types 0.1.0", + "wasm-bus-macros", + "wasm-bus-types", ] [[package]] @@ -4086,22 +4051,7 @@ dependencies = [ "proc-macro2", "quote", "syn", - "wasm-bus-types 1.0.0", -] - -[[package]] -name = "wasm-bus-process" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bff68e7e17fe033e2cbb5d4c87319fe8877275e0166d9be523e3d20ef6ad1b2" -dependencies = [ - "async-trait", - "bytes", - "dummy-waker", - "serde", - "tokio", - "tracing", - "wasm-bus 0.4.1", + "wasm-bus-types", ] [[package]] @@ -4116,31 +4066,7 @@ dependencies = [ "serde", "tokio", "tracing", - "wasm-bus 1.1.0", -] - -[[package]] -name = "wasm-bus-reqwest" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c19653892885942813c20a381bda8fd12f689c0719d62c9898ee9b048cec54b" -dependencies = [ - "async-trait", - "bytes", - "formdata", - "futures-core", - "futures-util", - "http", - "http-body", - "mime_guess", - "pin-project-lite", - "serde", - "serde_json", - "tokio", - "tracing", - "url 2.2.2", - "urlencoding", - "wasm-bus 0.4.1", + "wasm-bus", ] [[package]] @@ -4164,15 +4090,9 @@ dependencies = [ "tracing", "url 2.2.2", "urlencoding", - "wasm-bus 1.1.0", + "wasm-bus", ] -[[package]] -name = "wasm-bus-types" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "407ce28d552f155838b2c1038e3779668901228142a4a47176323851099af107" - [[package]] name = "wasm-bus-types" version = "1.0.0" diff --git a/wapm-resolve-url/Cargo.toml b/wapm-resolve-url/Cargo.toml index ac61ca95..7068ef4e 100644 --- a/wapm-resolve-url/Cargo.toml +++ b/wapm-resolve-url/Cargo.toml @@ -15,6 +15,6 @@ whoami = "1.2.1" [target.'cfg(not(target_os = "wasi"))'.dependencies] reqwest = { version = "0.11.0", default-features = false, features = ["rustls-tls", "blocking", "json", "gzip","socks", "multipart"] } -[target.'cfg(target_os = "wasi")'.dependencies] -wasm-bus-reqwest = "0.1.0" -wasm-bus-process = "0.1.0" +# [target.'cfg(target_os = "wasi")'.dependencies] +# wasm-bus-reqwest = "0.1.0" +# wasm-bus-process = "0.1.0" diff --git a/wapm-resolve-url/src/graphql.rs b/wapm-resolve-url/src/graphql.rs index 48cd8cd9..e3d15233 100644 --- a/wapm-resolve-url/src/graphql.rs +++ b/wapm-resolve-url/src/graphql.rs @@ -14,8 +14,8 @@ use { header::USER_AGENT, }, }; -#[cfg(target_os = "wasi")] -use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; +// #[cfg(target_os = "wasi")] +// use {wasm_bus_reqwest::prelude::header::*, wasm_bus_reqwest::prelude::*}; #[derive(Debug, Error)] enum GraphQLError { @@ -25,6 +25,18 @@ enum GraphQLError { pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[cfg(target_os = "wasi")] +pub fn execute_query_modifier(registry: &Url, query: &QueryBody, form_modifier: F) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, + F: FnOnce(Form) -> Form, +{ + Err(anyhow::anyhow!("networking is not implemented on wasm32-wasi")) +} + +#[cfg(not(target_os = "wasi"))] pub fn execute_query_modifier(registry: &Url, query: &QueryBody, form_modifier: F) -> anyhow::Result where for<'de> R: serde::Deserialize<'de>, From c39c6adf0fdbdd1628786dbbd03bfe6290c9c4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 11 Aug 2022 17:35:59 +0200 Subject: [PATCH 57/74] Remove wasm-bus properly --- wapm-resolve-url/src/graphql.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/wapm-resolve-url/src/graphql.rs b/wapm-resolve-url/src/graphql.rs index e3d15233..4334f8cf 100644 --- a/wapm-resolve-url/src/graphql.rs +++ b/wapm-resolve-url/src/graphql.rs @@ -25,17 +25,6 @@ enum GraphQLError { pub const VERSION: &str = env!("CARGO_PKG_VERSION"); - -#[cfg(target_os = "wasi")] -pub fn execute_query_modifier(registry: &Url, query: &QueryBody, form_modifier: F) -> anyhow::Result -where - for<'de> R: serde::Deserialize<'de>, - V: serde::Serialize, - F: FnOnce(Form) -> Form, -{ - Err(anyhow::anyhow!("networking is not implemented on wasm32-wasi")) -} - #[cfg(not(target_os = "wasi"))] pub fn execute_query_modifier(registry: &Url, query: &QueryBody, form_modifier: F) -> anyhow::Result where @@ -94,6 +83,7 @@ where Ok(response_body.data.expect("missing response data")) } +#[cfg(not(target_os = "wasi"))] pub fn execute_query(registry: &Url, query: &QueryBody) -> anyhow::Result where for<'de> R: serde::Deserialize<'de>, @@ -101,3 +91,12 @@ where { execute_query_modifier(registry, query, |f| f) } + +#[cfg(target_os = "wasi")] +pub fn execute_query(registry: &Url, query: &QueryBody) -> anyhow::Result +where + for<'de> R: serde::Deserialize<'de>, + V: serde::Serialize, +{ + Err(anyhow::anyhow!("networking is not implemented on wasm32-wasi")) +} From 8bf7f3d611575c073605f8a2d9d1ff14283b28a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 11 Aug 2022 17:49:25 +0200 Subject: [PATCH 58/74] Remove entire wapm_resolve_url crate on WASI --- wapm-toml/Cargo.toml | 2 ++ wapm-toml/src/lib.rs | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/wapm-toml/Cargo.toml b/wapm-toml/Cargo.toml index ccf2e90a..45e22c48 100644 --- a/wapm-toml/Cargo.toml +++ b/wapm-toml/Cargo.toml @@ -17,6 +17,8 @@ serde_yaml = "0.8.24" serde_cbor = "0.11.2" indexmap = { version = "1.6", features = ["serde"] } validator = "0.15.0" + +[target.'cfg(not(target_os = "wasi"))'.dependencies] wapm-resolve-url = { version = "0.1.0", path = "../wapm-resolve-url" } [features] diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index d4703c3a..9ad439f9 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -70,21 +70,23 @@ pub fn get_dependencies(wapm: &str) -> Vec<(String, String)>{ .iter().map(|(k, v)| (k.clone(), v.clone())) .collect::>(); - let current_registry = wapm_resolve_url::get_current_wapm_registry(); - - for (k, _) in dependencies.iter_mut() { - if k.split("/").count() == 1 { - // Somebody only specified the package / command as the dependency instead - // of using the owner/package format - if let Some(r) = current_registry.as_ref() { - let package_info = wapm_resolve_url::get_tar_gz_url_of_package(r, k, None); - if let Some(pi) = package_info { - *k = pi.resolved_name.clone(); + #[cfg(not(target_os = "wasi"))] { + let current_registry = wapm_resolve_url::get_current_wapm_registry(); + + for (k, _) in dependencies.iter_mut() { + if k.split("/").count() == 1 { + // Somebody only specified the package / command as the dependency instead + // of using the owner/package format + if let Some(r) = current_registry.as_ref() { + let package_info = wapm_resolve_url::get_tar_gz_url_of_package(r, k, None); + if let Some(pi) = package_info { + *k = pi.resolved_name.clone(); + } } } - } + } } - + dependencies } From 6e093c8caa1513125ad44901b58879aa7c021045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 18 Aug 2022 11:52:52 +0200 Subject: [PATCH 59/74] Add empty get_bindings functions function --- wapm-toml/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index 5a963b40..ba773a8e 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -482,6 +482,16 @@ pub struct Manifest { pub base_directory_path: PathBuf, } +pub type WebcBinding = (String, String, serde_cbor::Value); + +pub fn get_bindings( + wapm: &str, + base_path: &PathBuf, + atom_kinds: &BTreeMap +) -> Result, anyhow::Error> { + Ok(Vec::new()) +} + // command name => (runner, annotations) pub type WebcCommand = (String, Vec<(String, serde_cbor::Value)>); From dfe86a7052e0eda6d1f6bf265d19ec536b3cf70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 18 Aug 2022 12:16:10 +0200 Subject: [PATCH 60/74] Implement conversion for wapm-toml --- wapm-toml/src/lib.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index ba773a8e..b9ca3458 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -482,14 +482,43 @@ pub struct Manifest { pub base_directory_path: PathBuf, } + +#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WitBindingsExtended { + pub wit: WitBindings, +} + +#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WitBindings { + pub exports: String, + pub module: String, +} + pub type WebcBinding = (String, String, serde_cbor::Value); pub fn get_bindings( wapm: &str, - base_path: &PathBuf, - atom_kinds: &BTreeMap + _base_path: &PathBuf, + _atom_kinds: &BTreeMap ) -> Result, anyhow::Error> { - Ok(Vec::new()) + + let wapm: Manifest = toml::from_str(wapm)?; + let default_modules = Vec::new(); + let mut bindings = Vec::new(); + + for module in wapm.module.as_ref().unwrap_or(&default_modules).iter() { + if let Some(b) = module.bindings.as_ref() { + let value = serde_cbor::from_slice(&serde_cbor::to_vec(&WitBindingsExtended { + wit: WitBindings { + exports: format!("metadata://{}", b.wit.display()), + module: format!("atoms://{}", module.name), + } + })?)?; + bindings.push(("library-bindings".to_string(), format!("wit@{}", b.wit_bindgen), value)); + } + } + + Ok(bindings) } // command name => (runner, annotations) From c85313892e16d6d9b6bd018ad6860235ed8f1d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 18 Aug 2022 17:14:29 +0200 Subject: [PATCH 61/74] Added preparation for splitting binding files into metadata volume --- wapm-toml/src/lib.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index b9ca3458..87e6ee6b 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -94,10 +94,14 @@ pub fn get_wapm_atom_file_paths( paths: &BTreeMap<&PathBuf, &Vec> ) -> Result, anyhow::Error> { - let wapm_toml: Manifest = paths.get(&Path::new(MANIFEST_FILE_NAME).to_path_buf()) - .and_then(|t| toml::from_slice(t).ok()) + println!("searching for {MANIFEST_FILE_NAME:?} in {:#?}", paths.keys().collect::>()); + + let wapm_toml = paths.get(&Path::new(MANIFEST_FILE_NAME).to_path_buf()) .ok_or(anyhow::anyhow!("Could not find wapm.toml in FileMap"))?; - + + let wapm_toml: Manifest = toml::from_slice(&wapm_toml) + .map_err(|e| anyhow::anyhow!("Could not parse wapm.toml: {e}"))?; + Ok(wapm_toml.module.clone().unwrap_or_default().into_iter().map(|m| { (m.name.clone(), Path::new(&m.source).to_path_buf()) }).collect()) @@ -550,14 +554,14 @@ pub fn get_commands( let runner = match abi { Some("emscripten") => "https://webc.org/runner/emscripten/command@unstable_", Some("wasm4") => "https://webc.org/runner/wasm4/command@unstable_", - Some("wasi") => "https://webc.org/runner/wasi/command@unstable_", + Some("wasi") | Some("generic") => "https://webc.org/runner/wasi/command@unstable_", _ => { return Err(anyhow::anyhow!("Unknown ABI in command {name:?}: {:?}", abi.unwrap_or(""))); }, }; let annotations_str = match abi { Some("emscripten") => "emscripten", Some("wasm4") => "wasm4", - Some("wasi") => "wasi", + Some("wasi") | Some("generic") => "wasi", _ => { return Err(anyhow::anyhow!("Unknown ABI in command {name:?}: {:?}", abi.unwrap_or(""))); }, }; @@ -616,7 +620,7 @@ pub fn get_manifest_file_names() -> Vec { vec![Path::new(MANIFEST_FILE_NAME).to_path_buf()] } -pub fn get_metadata_paths() -> Vec { +pub fn get_metadata_paths(bindings: &[serde_cbor::Value]) -> Vec { let mut paths = Vec::new(); for p in README_PATHS.iter() { paths.push(Path::new(p).to_path_buf()); From b92c930bc191182321a97fb7154976b557ea8adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 18 Aug 2022 17:26:47 +0200 Subject: [PATCH 62/74] Move bindings files into metadata volume --- wapm-toml/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index 87e6ee6b..77e8b981 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -622,6 +622,13 @@ pub fn get_manifest_file_names() -> Vec { pub fn get_metadata_paths(bindings: &[serde_cbor::Value]) -> Vec { let mut paths = Vec::new(); + + for b in bindings { + if let Ok(wit) = serde_cbor::from_slice::(&serde_cbor::to_vec(b).unwrap()) { + paths.push(Path::new(&wit.wit.exports.replacen("metadata://", "", 1))); + } + } + for p in README_PATHS.iter() { paths.push(Path::new(p).to_path_buf()); } From 4ff72095ff286a009788419eecc5729791480cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 18 Aug 2022 17:27:33 +0200 Subject: [PATCH 63/74] Fixed typo in get_metadata_paths --- wapm-toml/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index 77e8b981..382bd14a 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -625,7 +625,7 @@ pub fn get_metadata_paths(bindings: &[serde_cbor::Value]) -> Vec { for b in bindings { if let Ok(wit) = serde_cbor::from_slice::(&serde_cbor::to_vec(b).unwrap()) { - paths.push(Path::new(&wit.wit.exports.replacen("metadata://", "", 1))); + paths.push(Path::new(&wit.wit.exports.replacen("metadata://", "", 1)).to_path_buf()); } } From 9c10993aef041d8357a654c86b32659e6d328b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 19 Aug 2022 10:39:05 +0200 Subject: [PATCH 64/74] Update pirita version --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 994fe043..f7afb4b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,8 +62,8 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "ssh://git@github.com/wasmerio/pirita.git" -rev = "5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" +git = "https://github.com/wasmerio/pirita.git" +rev = "8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" default-features = false features = ["autoconvert", "mmap"] optional = true From a927f9c13aae6812ad2d415102edfa6588401f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 19 Aug 2022 10:47:26 +0200 Subject: [PATCH 65/74] cargo update && fix error in cargo test --all-features --- Cargo.lock | 831 +------------------------------------------ wapm-toml/src/lib.rs | 2 +- 2 files changed, 20 insertions(+), 813 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ed921bc..ecfc12e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,46 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "aes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" -dependencies = [ - "aes-soft", - "aesni", - "cipher", -] - -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" -dependencies = [ - "cipher", - "opaque-debug 0.3.0", -] - [[package]] name = "ahash" version = "0.4.7" @@ -111,15 +71,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term 0.7.0", -] - [[package]] name = "async-compression" version = "0.3.14" @@ -155,15 +106,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -227,39 +169,12 @@ dependencies = [ "serde", ] -[[package]] -name = "bit-set" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitvec" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "blake2b_simd" version = "0.5.11" @@ -292,7 +207,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding 0.1.5", + "block-padding", "byte-tools", "byteorder", "generic-array 0.12.4", @@ -316,16 +231,6 @@ dependencies = [ "generic-array 0.14.5", ] -[[package]] -name = "block-modes" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" -dependencies = [ - "block-padding 0.2.1", - "cipher", -] - [[package]] name = "block-padding" version = "0.1.5" @@ -335,23 +240,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "blowfish" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b" -dependencies = [ - "byteorder", - "cipher", - "opaque-debug 0.3.0", -] - [[package]] name = "bstr" version = "0.2.17" @@ -370,15 +258,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e2c71c44e5bbc64de4ecfac946e05f9bba5cc296ea7bab4d3eda242a3ffa73c" -[[package]] -name = "buffered-reader" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f82920285502602088677aeb65df0909b39c347b38565e553ba0363c242f65" -dependencies = [ - "libc", -] - [[package]] name = "bumpalo" version = "3.10.0" @@ -403,17 +282,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" -[[package]] -name = "cast5" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1285caf81ea1f1ece6b24414c521e625ad0ec94d880625c20f2e65d8d3f78823" -dependencies = [ - "byteorder", - "cipher", - "opaque-debug 0.3.0", -] - [[package]] name = "cc" version = "1.0.73" @@ -438,13 +306,11 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "js-sys", "libc", "num-integer", "num-traits", "serde", "time", - "wasm-bindgen", "winapi", ] @@ -484,16 +350,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cmac" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d4de4f7724e5fe70addfb2bd37c2abd2f95084a429d7773b0b9645499b4272" -dependencies = [ - "crypto-mac 0.10.1", - "dbl", -] - [[package]] name = "colored" version = "1.9.3" @@ -549,12 +405,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "const-oid" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279bc8fc53f788a75c7804af68237d1fce02cde1e275a886a4b320604dc2aeda" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -617,12 +467,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - [[package]] name = "crypto-common" version = "0.1.5" @@ -648,17 +492,6 @@ name = "crypto-mac" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" -dependencies = [ - "cipher", - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ "generic-array 0.14.5", "subtle", @@ -686,37 +519,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ctr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "dbl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" -dependencies = [ - "generic-array 0.14.5", -] - [[package]] name = "debugid" version = "0.7.3" @@ -727,16 +529,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "der" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb9d92785d1facb50567852ce75d0858630630e7eabea59cf7eb7474051087" -dependencies = [ - "const-oid", - "typenum", -] - [[package]] name = "derivative" version = "2.2.0" @@ -748,17 +540,6 @@ dependencies = [ "syn", ] -[[package]] -name = "des" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b24e7c748888aa2fa8bce21d8c64a52efc810663285315ac7476f7197a982fae" -dependencies = [ - "byteorder", - "cipher", - "opaque-debug 0.3.0", -] - [[package]] name = "dialoguer" version = "0.10.1" @@ -770,12 +551,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.8.1" @@ -824,16 +599,6 @@ dependencies = [ "dirs-sys", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - [[package]] name = "dirs-sys" version = "0.3.7" @@ -845,17 +610,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users 0.4.3", - "winapi", -] - [[package]] name = "doc-comment" version = "0.3.3" @@ -868,90 +622,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea6672d73216c05740850c789368d371ca226dc8104d5f2e30c74252d5d6e5e" -[[package]] -name = "dyn-clone" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140206b78fb2bc3edbcfc9b5ccbd0b30699cfe8d348b8b31b330e47df5291a5a" - -[[package]] -name = "eax" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1f76e7a5e594b299a0fa9a99de627530725e341df41376aa342aecb2c5eb76e" -dependencies = [ - "aead", - "cipher", - "cmac", - "ctr", - "subtle", -] - -[[package]] -name = "ecdsa" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d33b390ab82f2e1481e331dbd0530895640179d2128ef9a79cc690b78d1eba" -dependencies = [ - "der", - "elliptic-curve", - "hmac 0.11.0", - "signature", -] - -[[package]] -name = "ed25519" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand 0.7.3", - "sha2 0.9.9", - "zeroize", -] - [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13e9b0c3c4170dcc2a12783746c4205d98e18957f57854251eea3f9750fe005" -dependencies = [ - "bitvec", - "ff", - "generic-array 0.14.5", - "group", - "pkcs8", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - -[[package]] -name = "ena" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" -dependencies = [ - "log 0.4.17", -] - [[package]] name = "encode_unicode" version = "0.3.6" @@ -1090,17 +766,6 @@ dependencies = [ "log 0.4.17", ] -[[package]] -name = "ff" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a4d941a5b7c2a75222e2d44fcdf634a67133d9db31e177ae5ff6ecda852bfe" -dependencies = [ - "bitvec", - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "filetime" version = "0.2.16" @@ -1113,12 +778,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.24" @@ -1181,12 +840,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "funty" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" - [[package]] name = "futures-channel" version = "0.3.21" @@ -1273,10 +926,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1286,10 +937,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", - "js-sys", "libc", "wasi 0.10.2+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1359,17 +1008,6 @@ dependencies = [ "syn", ] -[[package]] -name = "group" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3c1e8b4f1ca07e6605ea1be903a5f6956aec5c8a67fd44d56076631675ed8" -dependencies = [ - "ff", - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "h2" version = "0.3.13" @@ -1453,16 +1091,6 @@ dependencies = [ "digest 0.9.0", ] -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - [[package]] name = "hostname" version = "0.3.1" @@ -1583,16 +1211,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "idea" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdd4b114cf2265123bbdc5d32a39f96a343fbdf141267d2b5232b7e14caacb3" -dependencies = [ - "cipher", - "opaque-debug 0.3.0", -] - [[package]] name = "idna" version = "0.1.5" @@ -1621,7 +1239,7 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ - "autocfg 1.1.0", + "autocfg", "hashbrown 0.11.2", "serde", ] @@ -1653,15 +1271,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.4.8" @@ -1685,42 +1294,14 @@ dependencies = [ [[package]] name = "json5" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" -dependencies = [ - "pest", - "pest_derive", - "serde", -] - -[[package]] -name = "lalrpop" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30455341b0e18f276fa64540aff54deafb54c589de6aca68659c63dd2d5d823" -dependencies = [ - "ascii-canvas", - "atty", - "bit-set", - "diff", - "ena", - "itertools", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax", - "string_cache", - "term 0.7.0", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.19.8" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf796c978e9b4d983414f4caedc9273aa33ee214c5b887bd55fde84c85d2dc4" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] [[package]] name = "language-tags" @@ -1733,9 +1314,6 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin", -] [[package]] name = "leb128" @@ -1771,12 +1349,6 @@ version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" -[[package]] -name = "libm" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" - [[package]] name = "libsqlite3-sys" version = "0.20.1" @@ -1806,7 +1378,7 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ - "autocfg 1.1.0", + "autocfg", "scopeguard", ] @@ -1846,17 +1418,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" -[[package]] -name = "md-5" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - [[package]] name = "memchr" version = "2.5.0" @@ -1872,12 +1433,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memsec" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac78937f19a0c7807e45a931eac41f766f210173ec664ec046d58e6d388a5cb" - [[package]] name = "mime" version = "0.2.6" @@ -1969,12 +1524,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - [[package]] name = "nom" version = "5.1.2" @@ -1986,54 +1535,13 @@ dependencies = [ "version_check 0.9.4", ] -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg 1.1.0", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-bigint-dig" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d51546d704f52ef14b3c962b5776e53d5b862e5790e40a350d366c209bd7f7a" -dependencies = [ - "autocfg 0.1.8", - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand 0.7.3", - "serde", - "smallvec", - "zeroize", -] - [[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg 1.1.0", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg 1.1.0", - "num-integer", + "autocfg", "num-traits", ] @@ -2043,7 +1551,7 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] @@ -2127,24 +1635,13 @@ version = "0.9.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" dependencies = [ - "autocfg 1.1.0", + "autocfg", "cc", "libc", "pkg-config", "vcpkg", ] -[[package]] -name = "p256" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f05f5287453297c4c16af5e2b04df8fd2a3008d70f252729650bc6d7ace5844" -dependencies = [ - "ecdsa", - "elliptic-curve", - "sha2 0.9.9", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2183,17 +1680,6 @@ dependencies = [ "crypto-mac 0.10.1", ] -[[package]] -name = "pem" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" -dependencies = [ - "base64 0.13.0", - "once_cell", - "regex", -] - [[package]] name = "percent-encoding" version = "1.0.1" @@ -2246,26 +1732,7 @@ checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" dependencies = [ "maplit", "pest", - "sha-1 0.8.2", -] - -[[package]] -name = "petgraph" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", + "sha-1", ] [[package]] @@ -2283,23 +1750,13 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1#5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547#8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" dependencies = [ "anyhow", "wapm-targz-to-pirita", "webc", ] -[[package]] -name = "pkcs8" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9c2f795bc591cb3384cb64082a578b89207ac92bb89c9d98c1ea2ace7cd8110" -dependencies = [ - "der", - "spki", -] - [[package]] name = "pkg-config" version = "0.3.25" @@ -2312,12 +1769,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "prettytable-rs" version = "0.8.0" @@ -2328,7 +1779,7 @@ dependencies = [ "csv", "encode_unicode", "lazy_static", - "term 0.5.2", + "term", "unicode-width", ] @@ -2374,12 +1825,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" - [[package]] name = "rand" version = "0.4.6" @@ -2617,17 +2062,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ripemd160" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - [[package]] name = "rpassword" version = "5.0.1" @@ -2650,28 +2084,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rsa" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3648b669b10afeab18972c105e284a7b953a669b0be3514c27f9b17acab2f9cd" -dependencies = [ - "byteorder", - "digest 0.9.0", - "lazy_static", - "num-bigint-dig", - "num-integer", - "num-iter", - "num-traits", - "pem", - "rand 0.7.3", - "sha2 0.9.9", - "simple_asn1", - "subtle", - "thiserror", - "zeroize", -] - [[package]] name = "rusqlite" version = "0.24.2" @@ -2735,12 +2147,6 @@ dependencies = [ "base64 0.13.0", ] -[[package]] -name = "rustversion" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" - [[package]] name = "ryu" version = "1.0.10" @@ -2793,7 +2199,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da492dab03f925d977776a0b7233d7b934d6dc2b94faead48928e2e9bacedb9" dependencies = [ - "hmac 0.10.1", + "hmac", "pbkdf2", "salsa20", "sha2 0.9.9", @@ -2949,56 +2355,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "sequoia-openpgp" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee32fced98917f2c03d571658934aadae9b1527133ae9c7ac3cadb9d8252a05" -dependencies = [ - "aes", - "anyhow", - "base64 0.13.0", - "block-modes", - "block-padding 0.2.1", - "blowfish", - "buffered-reader", - "cast5", - "chrono", - "cipher", - "des", - "digest 0.9.0", - "dyn-clone", - "eax", - "ecdsa", - "ed25519-dalek", - "generic-array 0.14.5", - "getrandom 0.2.6", - "idea", - "idna 0.2.3", - "lalrpop", - "lalrpop-util", - "lazy_static", - "libc", - "md-5", - "memsec", - "num-bigint-dig", - "p256", - "rand 0.7.3", - "rand_core 0.6.3", - "regex", - "regex-syntax", - "ripemd160", - "rsa", - "sha-1 0.9.8", - "sha1collisiondetection", - "sha2 0.9.9", - "thiserror", - "twofish", - "typenum", - "x25519-dalek", - "xxhash-rust", -] - [[package]] name = "serde" version = "1.0.137" @@ -3076,29 +2432,6 @@ dependencies = [ "opaque-debug 0.2.3", ] -[[package]] -name = "sha-1" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha1collisiondetection" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31bf4e9fe5cd8cea8e0887e2e4eb1b4d736ff11b776c8537bf0912a4b381285" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.5", -] - [[package]] name = "sha2" version = "0.9.9" @@ -3142,33 +2475,6 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2807892cfa58e081aa1f1111391c7a0649d4fa127a4ffbe34bcbfb35a1171a4" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.3", -] - -[[package]] -name = "simple_asn1" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" -dependencies = [ - "chrono", - "num-bigint", - "num-traits", -] - -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - [[package]] name = "slab" version = "0.4.6" @@ -3197,34 +2503,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "spki" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dae7e047abc519c96350e9484a96c6bf1492348af912fd3446dd2dc323f6268" -dependencies = [ - "der", -] - [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "string_cache" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.8.0" @@ -3284,12 +2568,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tar" version = "0.4.38" @@ -3357,17 +2635,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "term_size" version = "0.3.2" @@ -3446,15 +2713,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3622,17 +2880,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "twofish" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0028f5982f23ecc9a1bc3008ead4c664f843ed5d78acd3d213b99ff50c441bc2" -dependencies = [ - "byteorder", - "cipher", - "opaque-debug 0.3.0", -] - [[package]] name = "typeable" version = "0.1.2" @@ -3909,14 +3156,13 @@ dependencies = [ [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1#5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547#8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" dependencies = [ "anyhow", "base64 0.13.0", "flate2", "json5", "rand 0.8.5", - "sequoia-openpgp", "serde", "serde_cbor", "serde_derive", @@ -4159,7 +3405,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1#5881dd2fac5f9b2a13e3c8020ed6eb30504cbfa1" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547#8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" dependencies = [ "anyhow", "base64 0.13.0", @@ -4170,7 +3416,6 @@ dependencies = [ "memmap2", "path-clean", "rand 0.8.5", - "sequoia-openpgp", "serde", "serde_cbor", "serde_json", @@ -4291,23 +3536,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "wyz" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" - -[[package]] -name = "x25519-dalek" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2392b6b94a576b4e2bf3c5b2757d63f10ada8020a2e4d08ac849ebcf6ea8e077" -dependencies = [ - "curve25519-dalek", - "rand_core 0.5.1", - "zeroize", -] - [[package]] name = "xattr" version = "0.2.3" @@ -4317,12 +3545,6 @@ dependencies = [ "libc", ] -[[package]] -name = "xxhash-rust" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074914ea4eec286eb8d1fd745768504f420a1f7b7919185682a4a267bed7d2e7" - [[package]] name = "yaml-rust" version = "0.4.5" @@ -4337,18 +3559,3 @@ name = "zeroize" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index 382bd14a..a168ad1a 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -423,7 +423,7 @@ pub enum FileKind { Json, } -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct Module { pub name: String, pub source: PathBuf, From 802ca6c31d1f184fcbbb98e785dcda336b7a4bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 19 Aug 2022 16:58:22 +0200 Subject: [PATCH 66/74] Fix small error in install command --- src/commands/install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/install.rs b/src/commands/install.rs index af6440f1..09c74e3c 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -432,6 +432,7 @@ async fn download_pirita( get_package_annotations: wapm_toml::get_package_annotations, get_modules: wapm_toml::get_modules, get_commands: wapm_toml::get_commands, + get_bindings: wapm_toml::get_bindings, get_manifest_file_names: wapm_toml::get_manifest_file_names, get_metadata_paths: wapm_toml::get_metadata_paths, get_wapm_manifest_file_name: wapm_toml::get_wapm_manifest_file_name, From 76f4743bdea278196fc46aeba2df3b8e6e6f3e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 25 Aug 2022 11:57:38 +0200 Subject: [PATCH 67/74] Fixed build error in wapm-toml --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- wapm-toml/src/lib.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecfc12e8..acad82ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1750,7 +1750,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547#8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" dependencies = [ "anyhow", "wapm-targz-to-pirita", @@ -3156,7 +3156,7 @@ dependencies = [ [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547#8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" dependencies = [ "anyhow", "base64 0.13.0", @@ -3405,7 +3405,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547#8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" +source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" dependencies = [ "anyhow", "base64 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index f7afb4b4..48a7e72b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,8 +62,8 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "https://github.com/wasmerio/pirita.git" -rev = "8f5a4adfdbd14b2a34cc88c45f82ab28de9b3547" +git = "ssh://git@github.com/wasmerio/pirita.git" +rev = "048e21ea3649008c11eb66a1e6919534182ded2b" default-features = false features = ["autoconvert", "mmap"] optional = true diff --git a/wapm-toml/src/lib.rs b/wapm-toml/src/lib.rs index c5ecb0ee..cef2a10d 100644 --- a/wapm-toml/src/lib.rs +++ b/wapm-toml/src/lib.rs @@ -515,7 +515,7 @@ pub fn get_bindings( if let Some(b) = module.bindings.as_ref() { let value = serde_cbor::from_slice(&serde_cbor::to_vec(&WitBindingsExtended { wit: WitBindings { - exports: format!("metadata://{}", b.wit.display()), + exports: format!("metadata://{}", b.wit_exports.display()), module: format!("atoms://{}", module.name), } })?)?; From 5a9bc6db059e92c25e47e283a3c57a84709c53ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Thu, 25 Aug 2022 12:02:24 +0200 Subject: [PATCH 68/74] Use https:// url instead of ssh:// --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 48a7e72b..fba726b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ serde_yaml = { version = "^0.8" } # Due to issues with SSH, the URL has to be in HTTPS format [dependencies.pirita] -git = "ssh://git@github.com/wasmerio/pirita.git" +git = "https://github.com/wasmerio/pirita.git" rev = "048e21ea3649008c11eb66a1e6919534182ded2b" default-features = false features = ["autoconvert", "mmap"] From 07b257ed2c0a398876b1a069830806c3370083f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 30 Aug 2022 15:50:18 +0200 Subject: [PATCH 69/74] Update Cargo.lock and fix merge issues --- Cargo.lock | 197 +++++++++------------------- graphql/queries/get_package.graphql | 13 ++ src/commands/install.rs | 29 +++- src/config.rs | 2 +- 4 files changed, 105 insertions(+), 136 deletions(-) create mode 100644 graphql/queries/get_package.graphql diff --git a/Cargo.lock b/Cargo.lock index dbb3f100..21e76eda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "android_system_properties" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ "libc", ] @@ -210,25 +210,13 @@ dependencies = [ "digest 0.9.0", ] -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -237,16 +225,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -273,12 +252,6 @@ version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.3" @@ -331,7 +304,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -479,11 +452,11 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.5", + "generic-array", "typenum", ] @@ -493,7 +466,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.5", + "generic-array", "subtle", ] @@ -503,7 +476,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ - "generic-array 0.14.5", + "generic-array", "subtle", ] @@ -552,32 +525,22 @@ dependencies = [ [[package]] name = "dialoguer" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c8ae48e400addc32a8710c8d62d55cb84249a7d58ac4cd959daecfbaddc545" +checksum = "a92e7e37ecef6857fdc0c0c5d42fd5b0938e46590c2183cc92dd310a6d078eb1" dependencies = [ "console 0.15.1", - "lazy_static", "tempfile", "zeroize", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -740,12 +703,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -853,30 +810,30 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "futures-channel" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1" +checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" +checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" [[package]] name = "futures-io" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5" +checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" [[package]] name = "futures-macro" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d" +checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" dependencies = [ "proc-macro2", "quote", @@ -885,21 +842,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" +checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" [[package]] name = "futures-task" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306" +checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" [[package]] name = "futures-util" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577" +checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" dependencies = [ "futures-core", "futures-io", @@ -911,15 +868,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.6" @@ -1203,7 +1151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ "http", - "hyper 0.14.19", + "hyper 0.14.20", "rustls", "tokio", "tokio-rustls", @@ -1264,7 +1212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown 0.12.3", "serde", ] @@ -1274,11 +1222,10 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" dependencies = [ - "console 0.15.0", + "console 0.15.1", "lazy_static", "number_prefix", "regex", - "hashbrown 0.12.3", ] [[package]] @@ -1399,9 +1346,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" dependencies = [ "autocfg", "scopeguard", @@ -1451,9 +1398,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" dependencies = [ "libc", ] @@ -1610,12 +1557,6 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -1654,15 +1595,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-src" -version = "111.22.0+1.1.1q" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853" -dependencies = [ - "cc", -] - [[package]] name = "openssl-sys" version = "0.9.75" @@ -1694,23 +1626,23 @@ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.13", + "redox_syscall 0.2.16", "smallvec", "windows-sys", ] -[[package]] -name = "path-clean" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" - [[package]] name = "paste" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22" +[[package]] +name = "path-clean" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" + [[package]] name = "pbkdf2" version = "0.6.0" @@ -1744,9 +1676,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +checksum = "905708f7f674518498c1f8d644481440f476d39ca6ecae83319bba7c6c12da91" dependencies = [ "pest", "pest_generator", @@ -1754,9 +1686,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.1.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +checksum = "5803d8284a629cc999094ecd630f55e91b561a1d1ba75e233b00ae13b91a69ad" dependencies = [ "pest", "pest_meta", @@ -1767,11 +1699,11 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.1.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +checksum = "1538eb784f07615c6d9a8ab061089c6c54a344c5b4301db51990ca1c241e8c04" dependencies = [ - "maplit", + "once_cell", "pest", "sha-1", ] @@ -1791,7 +1723,7 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" +source = "git+https://github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" dependencies = [ "anyhow", "wapm-targz-to-pirita", @@ -2059,6 +1991,7 @@ dependencies = [ "http", "http-body", "hyper 0.14.20", + "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -2101,6 +2034,7 @@ dependencies = [ "untrusted", "web-sys", "winapi", +] [[package]] name = "rmp" @@ -2202,9 +2136,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "0.3.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ "base64 0.13.0", ] @@ -2496,14 +2430,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.8.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", ] [[package]] @@ -2516,7 +2449,7 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -2566,9 +2499,9 @@ checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "10c98bba371b9b22a71a9414e420f92ddeb2369239af08200816169d5e2dd7aa" dependencies = [ "libc", "winapi", @@ -3221,7 +3154,7 @@ dependencies = [ [[package]] name = "wapm-targz-to-pirita" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" +source = "git+https://github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" dependencies = [ "anyhow", "base64 0.13.0", @@ -3488,7 +3421,7 @@ dependencies = [ [[package]] name = "webc" version = "0.1.0" -source = "git+ssh://git@github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" +source = "git+https://github.com/wasmerio/pirita.git?rev=048e21ea3649008c11eb66a1e6919534182ded2b#048e21ea3649008c11eb66a1e6919534182ded2b" dependencies = [ "anyhow", "base64 0.13.0", @@ -3645,6 +3578,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.3.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" diff --git a/graphql/queries/get_package.graphql b/graphql/queries/get_package.graphql new file mode 100644 index 00000000..a2665b15 --- /dev/null +++ b/graphql/queries/get_package.graphql @@ -0,0 +1,13 @@ +query GetPackageQuery ($name: String!) { + package: getPackage(name:$name) { + name + private + lastVersion { + version + distribution { + downloadUrl + } + manifest + } + } +} \ No newline at end of file diff --git a/src/commands/install.rs b/src/commands/install.rs index 8dd0e6fb..2df799bb 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -2,7 +2,7 @@ use crate::{ commands::install::get_package_query::GetPackageQueryPackageLastVersion, - dataflow::bindings::Language, graphql::execute_query, + dataflow::{WapmDistribution, bindings::Language}, graphql::execute_query, }; use anyhow::Context; @@ -83,8 +83,21 @@ enum InstallError { version )] NoPiritaFileForPackage { name: String, version: String }, + #[error( + "No versions available for package {0}", + name + )] + NoVersionsAvailable { name: String }, } +#[derive(GraphQLQuery)] +#[graphql( + schema_path = "graphql/schema.graphql", + query_path = "graphql/queries/get_package.graphql", + response_derives = "Debug" +)] +struct GetPackageQuery; + mod global_flag { pub const GLOBAL_INSTALL: bool = true; pub const LOCAL_INSTALL: bool = false; @@ -184,9 +197,18 @@ fn install_packages( packages.push(parse_package_and_version(name)?); } - let installed_packages: Vec<(&str, &str)> = packages + let installed_packages: Vec = packages .iter() - .map(|(name, version)| (name.as_str(), version.as_str())) + .map(|(name, version)| { + // TODO: correct? + WapmDistribution { + name: name.clone(), + version: version.clone(), + download_url: String::new(), + pirita_download_url: None, + is_last_version: true, + } + }) .collect(); // the install directory will determine which wapm.lock we are updating. For now, we @@ -339,6 +361,7 @@ impl Target { } } +#[cfg(target_feature = "pirita_file")] fn get_packages_with_versions(package_args: &[String]) -> anyhow::Result> { use wapm_resolve_url::get_tar_gz_url_of_package; diff --git a/src/config.rs b/src/config.rs index aca0d066..c8a06ff4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -200,7 +200,7 @@ struct TestIfRegistryPresent; fn test_if_registry_present(registry: &str) -> Result<(), String> { let q = TestIfRegistryPresent::build_query(test_if_registry_present::Variables {}); - let response: test_if_registry_present::ResponseData = + let _response: test_if_registry_present::ResponseData = crate::graphql::execute_query_custom_registry(registry, &q) .map_err(|e| format!("{e}"))?; Ok(()) From 14386704af36eb08c3be683e02ff147645a312fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 30 Aug 2022 18:10:33 +0200 Subject: [PATCH 70/74] Remove linux-aarch64 for now, CI does not work in docker --- .github/workflows/main.yaml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6097ed88..87b4a36a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -238,39 +238,6 @@ jobs: run: | chmod +x end-to-end-tests/ci/init-and-add.sh ./end-to-end-tests/ci/init-and-add.sh - - linux_aarch64: - name: Linux aarch64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: 1.59 - target: aarch64-unknown-linux-gnu - - name: Build cross image - run: | - docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ - env: - CROSS_DOCKER_IN_DOCKER: true - - name: Build wapm binary - run: | - make release - env: - CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross - CROSS_DOCKER_IN_DOCKER: true - CARGO_TARGET: --target aarch64-unknown-linux-gnu - PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig - PKG_CONFIG_ALLOW_CROSS: true - TARGET: aarch64-unknown-linux-gnu - TARGET_DIR: target/aarch64-unknown-linux-gnu/release - - name: Upload Artifacts - uses: actions/upload-artifact@v2 - with: - name: 'wapm-linux-aarch64' - path: dist/wapm-cli.tar.gz - if-no-files-found: error - retention-days: 2 release: needs: [setup, test, linux_aarch64] #, regression_tests] runs-on: ubuntu-latest From 444dcb3bfaa2a188fa4644d9cfe2866df995476f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 31 Aug 2022 10:36:37 +0200 Subject: [PATCH 71/74] Use CARGO_NET_GIT_FETCH_WITH_CLI to work around issues on aarch64 --- .github/workflows/main.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 11d15692..6846c74b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -200,6 +200,8 @@ jobs: chmod +x /home/runner/.wasmer/bin/wapm - name: Configure cargo data directory + private access tokens run: | + export CARGO_NET_GIT_FETCH_WITH_CLI=true + echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt git config --global credential.helper "store --file creds.txt" From ee3918c1470ed0491c57e6102d40a79b6cc3da05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 31 Aug 2022 10:42:19 +0200 Subject: [PATCH 72/74] Re-add linux-aarch64 workflow --- .github/workflows/main.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6846c74b..c21f05a3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -240,6 +240,38 @@ jobs: run: | chmod +x end-to-end-tests/ci/init-and-add.sh ./end-to-end-tests/ci/init-and-add.sh + linux_aarch64: + name: Linux aarch64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.59 + target: aarch64-unknown-linux-gnu + - name: Build cross image + run: | + docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ + env: + CROSS_DOCKER_IN_DOCKER: true + - name: Build wapm binary + run: | + make release + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --target aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + TARGET: aarch64-unknown-linux-gnu + TARGET_DIR: target/aarch64-unknown-linux-gnu/release + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: 'wapm-linux-aarch64' + path: dist/wapm-cli.tar.gz + if-no-files-found: error + retention-days: 2 release: needs: [setup, test, linux_aarch64] #, regression_tests] runs-on: ubuntu-latest From fd9bf04d8a3cfa2f2a1664e5dfd8210a8801fbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 31 Aug 2022 14:46:24 +0200 Subject: [PATCH 73/74] Set CARGO_NET_GIT_FETCH_WITH_CLI=true in docker image --- .github/cross-linux-aarch64/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/cross-linux-aarch64/Dockerfile b/.github/cross-linux-aarch64/Dockerfile index 0d09008b..b18d612c 100644 --- a/.github/cross-linux-aarch64/Dockerfile +++ b/.github/cross-linux-aarch64/Dockerfile @@ -3,7 +3,7 @@ FROM rust:1 # set CROSS_DOCKER_IN_DOCKER to inform `cross` that it is executed from within a container ENV CROSS_DOCKER_IN_DOCKER=true - +ENV CARGO_NET_GIT_FETCH_WITH_CLI=true RUN cargo install cross RUN dpkg --add-architecture arm64 && \ apt-get update && \ From 306712983d020da772062f9654ef16ebfff29647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 31 Aug 2022 15:27:34 +0200 Subject: [PATCH 74/74] set CARGO_NET_GIT_FETCH_WITH_CLI on CI env vars --- .github/workflows/main.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c21f05a3..2fc68212 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -254,12 +254,14 @@ jobs: docker build -t wasmer/aarch64 ${GITHUB_WORKSPACE}/.github/cross-linux-aarch64/ env: CROSS_DOCKER_IN_DOCKER: true + CARGO_NET_GIT_FETCH_WITH_CLI: true - name: Build wapm binary run: | make release env: CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v ${GITHUB_WORKSPACE}:/project -w /project wasmer/aarch64 cross CROSS_DOCKER_IN_DOCKER: true + CARGO_NET_GIT_FETCH_WITH_CLI: true CARGO_TARGET: --target aarch64-unknown-linux-gnu PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig PKG_CONFIG_ALLOW_CROSS: true