From be534c34e865b878353e58e4bbd4f094bf7c0ffe Mon Sep 17 00:00:00 2001 From: Mitchell Scott <10804314+rmitchellscott@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:54:30 -0700 Subject: [PATCH] fix: search all on-disk indexes for os-compatible packages --- bootstrap.sh | 2 +- src/commands/add.rs | 9 ++++++++- src/commands/check_os.rs | 9 ++++++++- src/commands/upgrade.rs | 9 ++++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index e991909..7241c39 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -216,7 +216,7 @@ trap - EXIT echo "" echo "Vellum installed successfully!" -echo "Run 'source ~/.bashrc' or start a new shell to use vellum." +echo "Run 'exec bash --login' to use vellum." if [ -n "$OFFLINE_DIR" ]; then echo "" echo "Offline install complete. When network is available, run:" diff --git a/src/commands/add.rs b/src/commands/add.rs index 054edbb..ee883c8 100644 --- a/src/commands/add.rs +++ b/src/commands/add.rs @@ -80,6 +80,7 @@ fn run_add_directly(apk: &Apk, args: &[String]) { fn get_index() -> anyhow::Result> { let cache_dir = format!("{VELLUM_ROOT}/etc/apk/cache"); + let mut all_packages = Vec::new(); if let Ok(entries) = fs::read_dir(&cache_dir) { for entry in entries.flatten() { @@ -87,13 +88,19 @@ fn get_index() -> anyhow::Result> { if let Some(name) = path.file_name().and_then(|n| n.to_str()) { if name.starts_with("APKINDEX.") && name.ends_with(".tar.gz") { if let Some(path_str) = path.to_str() { - return parse_index_tar_gz(path_str); + if let Ok(packages) = parse_index_tar_gz(path_str) { + all_packages.extend(packages); + } } } } } } + if !all_packages.is_empty() { + return Ok(all_packages); + } + let repo_url = match get_repo_url() { Some(url) => url, None => return Err(anyhow::anyhow!("no cached index and could not determine repository URL")), diff --git a/src/commands/check_os.rs b/src/commands/check_os.rs index 14e4318..768879d 100644 --- a/src/commands/check_os.rs +++ b/src/commands/check_os.rs @@ -96,6 +96,7 @@ pub fn handle_check_os(apk: &Apk, target_os: &str) { fn get_index() -> anyhow::Result> { let cache_dir = format!("{VELLUM_ROOT}/etc/apk/cache"); + let mut all_packages = Vec::new(); if let Ok(entries) = fs::read_dir(&cache_dir) { for entry in entries.flatten() { @@ -103,13 +104,19 @@ fn get_index() -> anyhow::Result> { if let Some(name) = path.file_name().and_then(|n| n.to_str()) { if name.starts_with("APKINDEX.") && name.ends_with(".tar.gz") { if let Some(path_str) = path.to_str() { - return parse_index_tar_gz(path_str); + if let Ok(packages) = parse_index_tar_gz(path_str) { + all_packages.extend(packages); + } } } } } } + if !all_packages.is_empty() { + return Ok(all_packages); + } + let repo_url = get_repo_url().ok_or_else(|| { anyhow::anyhow!("no cached index and could not determine repository URL") })?; diff --git a/src/commands/upgrade.rs b/src/commands/upgrade.rs index 4e5cd44..b002979 100644 --- a/src/commands/upgrade.rs +++ b/src/commands/upgrade.rs @@ -225,6 +225,7 @@ fn check_os_compatibility_internal(apk: &Apk, target_os: &str) -> Option anyhow::Result> { let cache_dir = format!("{VELLUM_ROOT}/etc/apk/cache"); + let mut all_packages = Vec::new(); if let Ok(entries) = fs::read_dir(&cache_dir) { for entry in entries.flatten() { @@ -232,13 +233,19 @@ fn get_index() -> anyhow::Result> { if let Some(name) = path.file_name().and_then(|n| n.to_str()) { if name.starts_with("APKINDEX.") && name.ends_with(".tar.gz") { if let Some(path_str) = path.to_str() { - return parse_index_tar_gz(path_str); + if let Ok(packages) = parse_index_tar_gz(path_str) { + all_packages.extend(packages); + } } } } } } + if !all_packages.is_empty() { + return Ok(all_packages); + } + let repo_url = match get_repo_url() { Some(url) => url, None => return Err(anyhow::anyhow!("no cached index and could not determine repository URL")),