diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-11-09 15:59:07 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-11-09 15:59:07 +0100 |
commit | bfdc973e28399916c1dfd60b331c697ee97e18a6 (patch) | |
tree | f308aa19089c5e71bb9c6ed0b36bfe1d8ea943f9 /src/filestore/staging.rs | |
parent | e225befa36513c47cdb218e22f88892a83bff8e2 (diff) |
Fix: Checking resulting paths into the staging store
Unfortunately, these are the kind of things that Rust does not find,
unfortunately.
I could have built the whole thing so that the rust compiler can find
such things, by even introducing more typing. But that would slow down
the development of this project by a huge bit, so we have to deal with
these kind of bugs for now.
The issue solved with this patch is, that with an empty staging store,
the example_1 failed.
This was because the job for pkgA did not find the already built pkgB.
When rerunning butido right after the error, though, everything worked.
This is due to the fact that we filteres the result-TAR archive for
files, to ignore directories when checking results into the staging
store.
This was done by filtering the archive with
.filter(|path| path.is_file())
but Path::is_file() checks _on the filesystem_, not whether the path
itself looks like a file-path.
Thus, we alter the iteration here to do the check whether a resulting
path is a file-path right when we want to load the artifact.
This fixes the bug.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/filestore/staging.rs')
-rw-r--r-- | src/filestore/staging.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/filestore/staging.rs b/src/filestore/staging.rs index 880b274..36da173 100644 --- a/src/filestore/staging.rs +++ b/src/filestore/staging.rs @@ -54,8 +54,6 @@ impl StagingStore { }) .map_ok(|path| dest.join(path)) .inspect(|p| trace!("Path in tar archive: {:?}", p)) - .filter_ok(|p| p.is_file()) - .inspect(|p| trace!("Taking from archive: {:?}", p)) .collect::<Result<Vec<_>>>() .context("Collecting outputs of TAR archive")?; @@ -69,12 +67,18 @@ impl StagingStore { .context("Concatenating the output bytestream")? .into_iter() .inspect(|p| trace!("Trying to load into staging store: {}", p.display())) - .map(|path| { - self.0.load_from_path(&path) - .inspect(|r| trace!("Loading from path = {:?}", r)) - .with_context(|| anyhow!("Loading from path: {}", path.display())) - .map_err(Error::from) - .map(|art| art.path().clone()) + .filter_map(|path| { + if path.is_dir() { + None + } else { + Some({ + self.0.load_from_path(&path) + .inspect(|r| trace!("Loading from path = {:?}", r)) + .with_context(|| anyhow!("Loading from path: {}", path.display())) + .map_err(Error::from) + .map(|art| art.path().clone()) + }) + } }) .collect() } |