From cf97a54ce162cfd6b9210f23c3fd587bd3d23987 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Wed, 9 Aug 2023 12:40:25 +0200 Subject: [PATCH] Don't report non-existing index as an error This can be expected in some situations, like if the docs failed to build. --- src/storage/mod.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 7eb9bf51d..e26bcede5 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -592,7 +592,17 @@ pub(crate) fn source_archive_path(name: &str, version: &str) -> String { #[instrument(skip(storage))] fn migrate_one(storage: &Storage, archive_path: &str, tmpdir: &Path) -> Result<()> { // this will also download the index if it doesn't exist locally - let local_index_filename = storage.get_index_filename(archive_path)?; + let local_index_filename = match storage.get_index_filename(archive_path) { + Ok(filename) => filename, + Err(err) => { + if err.is::() { + info!("index does not exist, skipping"); + return Ok(()); + } else { + return Err(err); + } + } + }; if archive_index::is_sqlite_file(&local_index_filename)? { info!("index already in SQLite format, skipping"); @@ -632,17 +642,17 @@ pub fn migrate_old_archive_indexes( for row in conn .query_raw( " - SELECT + SELECT crates.name, releases.version - FROM + FROM crates INNER JOIN releases ON releases.crate_id = crates.id - WHERE - releases.archive_storage = true AND + WHERE + releases.archive_storage = true AND releases.build_status = true - ORDER BY + ORDER BY crates.name, releases.id ",