Compare commits
3 changed files with 6 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -32,7 +32,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "anode-cache-common"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.dzuchun.ing/actions/cache-common-src.git?tag=v3#a460ddb58f8b2006a9edfd231d12882cc95bcca0"
|
||||
source = "git+https://git.dzuchun.ing/actions/cache-common-src.git?tag=v2#0a3a59229111c6a96a2565de8a3e097c7bc2808b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"isahc",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ tag = "v1"
|
|||
|
||||
[dependencies.anode-cache-common]
|
||||
git = "https://git.dzuchun.ing/actions/cache-common-src.git"
|
||||
tag = "v3"
|
||||
tag = "v2"
|
||||
|
||||
[build-dependencies.anode-build]
|
||||
git = "https://git.dzuchun.ing/dzu/anode.git"
|
||||
|
|
|
|||
11
src/main.rs
11
src/main.rs
|
|
@ -49,11 +49,8 @@ fn main() -> Result<()> {
|
|||
let mut archive = Builder::new(out_comp);
|
||||
archive.mode(HeaderMode::Complete);
|
||||
archive.follow_symlinks(false);
|
||||
|
||||
let common = anode_cache_common::common_parent(&path);
|
||||
debug!(common_path = %common.display(), paths = ?path);
|
||||
|
||||
for (path, name) in path.iter().map(|p| (p, p.strip_prefix(&common).unwrap())) {
|
||||
debug!(paths = ?path);
|
||||
for path in path {
|
||||
let _span = info_span!("cache-entry");
|
||||
let _span = _span.enter();
|
||||
if !path.exists() {
|
||||
|
|
@ -63,11 +60,11 @@ fn main() -> Result<()> {
|
|||
if path.is_dir() {
|
||||
debug!("Caching directory");
|
||||
// we actually want to write out all the directory contents
|
||||
archive.append_dir_all(name, path).unwrap();
|
||||
archive.append_dir_all(&path, &path).unwrap();
|
||||
} else if path.is_file() {
|
||||
debug!("Caching a file");
|
||||
// rest of the file types are handled by the existing inner code
|
||||
archive.append_path_with_name(path, name).unwrap();
|
||||
archive.append_path(path).unwrap();
|
||||
} else {
|
||||
warn!("Path is neither directory, nor a file and will not be cached");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue