From 8216268a5f9f9130ba1ff4bbd5f3e0324251e160 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Fri, 30 Aug 2024 21:44:05 -0700 Subject: [PATCH] more cleanup --- dev-tools/ls-apis/src/main.rs | 39 ++++------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/dev-tools/ls-apis/src/main.rs b/dev-tools/ls-apis/src/main.rs index 633ae6ea3b..cb9577bb3d 100644 --- a/dev-tools/ls-apis/src/main.rs +++ b/dev-tools/ls-apis/src/main.rs @@ -40,10 +40,6 @@ struct LsApis { #[arg(long)] api_manifest: Option, - /// path to metadata about Omicron packages - #[arg(long)] - package_manifest: Option, - /// path to directory with clones of dependent repositories #[arg(long)] extra_repos: Option, @@ -80,7 +76,6 @@ fn run_show(apis: &Apis, args: ShowArgs) -> Result<()> { struct LoadArgs { api_manifest_path: Utf8PathBuf, - package_manifest_path: Utf8PathBuf, extra_repos_path: Utf8PathBuf, } @@ -100,13 +95,6 @@ impl TryFrom<&LsApis> for LoadArgs { .join("..") .join("api-manifest.toml") }); - let package_manifest_path = - args.package_manifest.clone().unwrap_or_else(|| { - self_manifest_dir - .join("..") - .join("..") - .join("package-manifest.toml") - }); let extra_repos_path = args.extra_repos.clone().unwrap_or_else(|| { self_manifest_dir .join("..") @@ -116,11 +104,7 @@ impl TryFrom<&LsApis> for LoadArgs { .join("checkout") }); - Ok(LoadArgs { - api_manifest_path, - package_manifest_path, - extra_repos_path, - }) + Ok(LoadArgs { api_manifest_path, extra_repos_path }) } } @@ -385,7 +369,7 @@ impl ApisHelper { api_metadata.client_pkgnames().collect(); let mut errors = Vec::new(); for (_, workspace) in &workspaces { - for (client_pkgname, _) in &workspace.progenitor_clients { + for client_pkgname in &workspace.progenitor_clients { if api_metadata.client_pkgname_lookup(client_pkgname).is_some() { // It's possible that we will find multiple references @@ -439,18 +423,6 @@ impl ApisHelper { } } -struct ClientPackage { - me: MyPackage, - rdeps: Vec, -} - -impl ClientPackage { - fn new(workspace: &Metadata, me: MyPackage) -> Result { - let rdeps = direct_dependents(workspace, &me.name)?; - Ok(ClientPackage { me, rdeps }) - } -} - struct MyPackage { name: String, location: MyPackageLocation, @@ -662,7 +634,7 @@ impl ApiMetadata { struct Workspace { name: String, all_packages: BTreeMap, // XXX-dap memory usage - progenitor_clients: BTreeMap, + progenitor_clients: BTreeSet, } impl Workspace { @@ -681,15 +653,12 @@ impl Workspace { .into_iter() .filter_map(|mypkg| { if mypkg.name.ends_with("-client") { - Some(ClientPackage::new(&metadata, mypkg)) + Some(ClientPackageName::from(mypkg.name)) } else { eprintln!("ignoring apparent non-client: {}", mypkg.name); None } }) - .collect::>>()? - .into_iter() - .map(|cpkg| (cpkg.me.name.clone().into(), cpkg)) .collect(); let all_packages = metadata