diff --git a/libips/src/digest/mod.rs b/libips/src/digest/mod.rs index 4081a35..64786e7 100644 --- a/libips/src/digest/mod.rs +++ b/libips/src/digest/mod.rs @@ -130,11 +130,6 @@ impl Digest { DigestAlgorithm::SHA3512 => { format!("{:x}", sha3::Sha3_512::digest(b)) } - x => { - return Err(DigestError::UnknownAlgorithm { - algorithm: x.to_string(), - }); - } }; Ok(Digest { @@ -186,11 +181,6 @@ impl Digest { std::io::copy(&mut r, &mut hasher).map_err(DigestError::from)?; format!("{:x}", hasher.finalize()) } - x => { - return Err(DigestError::UnknownAlgorithm { - algorithm: x.to_string(), - }); - } }; Ok(Digest { diff --git a/libips/src/lib.rs b/libips/src/lib.rs index ab107b4..40da64b 100644 --- a/libips/src/lib.rs +++ b/libips/src/lib.rs @@ -1,9 +1,11 @@ +#![allow(unused_assignments)] // This Source Code Form is subject to the terms of // the Mozilla Public License, v. 2.0. If a copy of the // MPL was not distributed with this file, You can // obtain one at https://mozilla.org/MPL/2.0/. #[allow(clippy::result_large_err)] +#[allow(unused_assignments)] pub mod actions; pub mod api; pub mod depend; diff --git a/libips/src/recv.rs b/libips/src/recv.rs index 4810361..8dc94cf 100644 --- a/libips/src/recv.rs +++ b/libips/src/recv.rs @@ -246,7 +246,7 @@ mod tests { let mut source_repo = FileBackend::create(source_dir.path(), RepositoryVersion::V4)?; source_repo.add_publisher("test")?; - let fmri = Fmri::parse("pkg://test/pkgA@1.0").unwrap(); + let _fmri = Fmri::parse("pkg://test/pkgA@1.0").unwrap(); let manifest_content = "set name=pkg.fmri value=pkg://test/pkgA@1.0\nset name=pkg.summary value=test\n"; // Manually write the manifest in IPS format to the source repo diff --git a/libips/src/repository/file_backend.rs b/libips/src/repository/file_backend.rs index 1542e64..b47da2a 100644 --- a/libips/src/repository/file_backend.rs +++ b/libips/src/repository/file_backend.rs @@ -190,87 +190,6 @@ impl SearchIndex { .push(entry); } - /// Add a package to the index - fn add_package(&mut self, package: &PackageInfo, contents: Option<&PackageContents>) { - // Get the FMRI as a string - let fmri = package.fmri.to_string(); - let stem = package.fmri.stem(); - - // Add package mapping - self.packages.insert(fmri.clone(), stem.to_string()); - - // 1. Index package stem (action=pkg, index=name) - // Note: Legacy pkg search often uses 'set' action for package attributes, but let's use what we have. - // Actually man page says `pkg_name` is implicit. - // Let's index it as: action="pkg", index="name", value=stem - self.add_term(stem, &fmri, "pkg", "name", stem, None); - - // Also index parts of the stem if it contains '/'? - // Legacy behavior might index tokens. - for part in stem.split('/') { - if part != stem { - self.add_term(part, &fmri, "pkg", "name", stem, None); - } - } - - // 2. Index Publisher (action=pkg, index=publisher) - if let Some(publisher) = &package.fmri.publisher { - self.add_term(publisher, &fmri, "pkg", "publisher", publisher, None); - } - - // 3. Index Version (action=pkg, index=version) - let version = package.fmri.version(); - if !version.is_empty() { - self.add_term(&version, &fmri, "pkg", "version", &version, None); - } - - // 4. Index Contents - if let Some(content) = contents { - // Add files - if let Some(files) = &content.files { - for file in files { - // index=path - self.add_term(file, &fmri, "file", "path", file, None); - // index=basename - if let Some(basename) = Path::new(file).file_name().and_then(|s| s.to_str()) { - self.add_term(basename, &fmri, "file", "basename", file, None); - } - } - } - - // Add directories - if let Some(directories) = &content.directories { - for dir in directories { - // index=path - self.add_term(dir, &fmri, "dir", "path", dir, None); - // index=basename - if let Some(basename) = Path::new(dir).file_name().and_then(|s| s.to_str()) { - self.add_term(basename, &fmri, "dir", "basename", dir, None); - } - } - } - - // Add dependencies - if let Some(dependencies) = &content.dependencies { - for dep in dependencies { - // dep is an FMRI string usually. - // index=fmri, value=dep - self.add_term(dep, &fmri, "depend", "fmri", dep, None); - // maybe parse stem from dep fmri? - if let Ok(dep_fmri) = Fmri::parse(dep) { - self.add_term(dep_fmri.stem(), &fmri, "depend", "fmri", dep, None); - } - } - } - } - - // Update the timestamp - self.updated = SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap_or_default() - .as_secs(); - } - /// Search the index for packages matching a query fn search(&self, query: &str, case_sensitive: bool, limit: Option) -> Vec { // Split the query into terms (whitespace) diff --git a/pkg6depotd/src/repo.rs b/pkg6depotd/src/repo.rs index d844d6b..f125cd2 100644 --- a/pkg6depotd/src/repo.rs +++ b/pkg6depotd/src/repo.rs @@ -57,7 +57,7 @@ impl DepotRepo { } pub fn get_manifest_text(&self, publisher: &str, fmri: &Fmri) -> Result { - let backend = self + let mut backend = self .backend .lock() .map_err(|e| DepotError::Server(format!("Lock poisoned: {}", e)))?; diff --git a/pkg6depotd/tests/integration_tests.rs b/pkg6depotd/tests/integration_tests.rs index da7a38a..978adfa 100644 --- a/pkg6depotd/tests/integration_tests.rs +++ b/pkg6depotd/tests/integration_tests.rs @@ -213,7 +213,7 @@ async fn test_depot_server() { #[tokio::test] async fn test_ini_only_repo_serving_catalog() { use libips::repository::BatchOptions; - use libips::repository::{ReadableRepository, WritableRepository}; + use libips::repository::WritableRepository; use std::io::Write as _; // Setup temp repo