Skip to content

Commit 0b34bba

Browse files
committed
Don't warn when the tarball has already been unpacked
1 parent 3e6e95f commit 0b34bba

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ jobs:
112112
yarn
113113
wget --quiet https://github.com/trail-of-forks/sbpf-coverage/releases/download/$AGAVE_TAG/patched-agave-tools-$AGAVE_TAG-Linux.tar.gz
114114
tar xzf patched-agave-tools-$AGAVE_TAG-Linux.tar.gz
115-
rm -f patched-agave-tools-$AGAVE_TAG-Linux.tar.gz
116115
PATH="$PWD/patched-agave-tools-$AGAVE_TAG-Linux/bin:$PATH"
117116
anchor test
118117
popd

src/tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use assert_cmd::cargo::CommandCargoExt;
44
use std::{
55
collections::HashSet,
66
env::current_dir,
7-
fs::{read_to_string, remove_file},
7+
fs::read_to_string,
88
path::{Path, PathBuf},
99
process::Command,
1010
sync::{LazyLock, Mutex, MutexGuard},
@@ -242,8 +242,6 @@ fn download_patched_agave_tools(dir: impl AsRef<Path>) -> Result<()> {
242242
let status = command.status()?;
243243
ensure!(status.success(), "command failed: {command:?}");
244244

245-
remove_file(dir.as_ref().join(filename))?;
246-
247245
Ok(())
248246
}
249247

src/util/mod.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,20 @@ pub fn patched_agave_tools(path: impl AsRef<Path>) -> Result<Option<PathBuf>> {
2525
for result in read_dir(path)? {
2626
let entry = result?;
2727
let path = entry.path();
28-
let Some(file_name) = path.file_name() else {
28+
let Some(file_name) = path.file_name().and_then(OsStr::to_str) else {
2929
continue;
3030
};
31-
if file_name
32-
.to_str()
33-
.is_none_or(|s| !s.starts_with("patched-agave-tools-"))
34-
{
31+
if !file_name.starts_with("patched-agave-tools-") {
3532
continue;
3633
}
3734
if !path.is_dir() {
35+
// smoelius: Don't warn if there is an adjacent directory with the same basename.
36+
if let Some(file_stem) = file_name.strip_suffix(".tar.gz")
37+
&& let Some(parent) = path.parent()
38+
&& parent.join(file_stem).is_dir()
39+
{
40+
continue;
41+
}
3842
eprintln!(
3943
"Warning: Found `{}` but it is not a directory. If it contains patched Agave \
4044
tools that you want to use, please unzip and untar it.",

0 commit comments

Comments
 (0)