diff --git a/libips/src/image/catalog.rs b/libips/src/image/catalog.rs index b74c35b..f2a78f8 100644 --- a/libips/src/image/catalog.rs +++ b/libips/src/image/catalog.rs @@ -362,8 +362,19 @@ impl ImageCatalog { } // Create a catalog manager for this publisher + // The catalog parts are in a subdirectory: publisher//catalog/ + let catalog_parts_dir = publisher_catalog_dir.join("publisher").join(publisher).join("catalog"); println!("Creating catalog manager for publisher: {}", publisher); - let mut catalog_manager = CatalogManager::new(&publisher_catalog_dir, publisher) + println!("Catalog parts directory: {:?}", catalog_parts_dir); + + // Check if the catalog parts directory exists + if !catalog_parts_dir.exists() { + println!("Catalog parts directory not found: {}", catalog_parts_dir.display()); + warn!("Catalog parts directory not found: {}", catalog_parts_dir.display()); + continue; + } + + let mut catalog_manager = CatalogManager::new(&catalog_parts_dir, publisher) .map_err(|e| CatalogError::Repository(crate::repository::RepositoryError::Other(format!("Failed to create catalog manager: {}", e))))?; // Get all catalog parts diff --git a/libips/src/image/installed.rs b/libips/src/image/installed.rs index 3aa08f7..2712fd1 100644 --- a/libips/src/image/installed.rs +++ b/libips/src/image/installed.rs @@ -7,7 +7,7 @@ use std::fs; use std::path::{Path, PathBuf}; use std::str::FromStr; use thiserror::Error; -use tracing::{info, warn}; +use tracing::info; /// Table definition for the installed packages database /// Key: full FMRI including publisher (pkg://publisher/stem@version) diff --git a/pkg6/src/main.rs b/pkg6/src/main.rs index 9796e75..bb75369 100644 --- a/pkg6/src/main.rs +++ b/pkg6/src/main.rs @@ -649,6 +649,13 @@ fn main() -> Result<()> { // List all available packages info!("Listing all available packages"); + // Build the catalog before querying it + info!("Building catalog..."); + if let Err(e) = image.build_catalog() { + error!("Failed to build catalog: {}", e); + return Err(e.into()); + } + match image.query_catalog(pattern) { Ok(packages) => { println!("PUBLISHER NAME VERSION STATE");