Compare commits

..
3 changed files with 6 additions and 9 deletions

2
Cargo.lock generated
View file

@ -32,7 +32,7 @@ dependencies = [
[[package]] [[package]]
name = "anode-cache-common" name = "anode-cache-common"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"isahc", "isahc",

View file

@ -16,7 +16,7 @@ tag = "v1"
[dependencies.anode-cache-common] [dependencies.anode-cache-common]
git = "https://git.dzuchun.ing/actions/cache-common-src.git" git = "https://git.dzuchun.ing/actions/cache-common-src.git"
tag = "v3" tag = "v2"
[build-dependencies.anode-build] [build-dependencies.anode-build]
git = "https://git.dzuchun.ing/dzu/anode.git" git = "https://git.dzuchun.ing/dzu/anode.git"

View file

@ -49,11 +49,8 @@ fn main() -> Result<()> {
let mut archive = Builder::new(out_comp); let mut archive = Builder::new(out_comp);
archive.mode(HeaderMode::Complete); archive.mode(HeaderMode::Complete);
archive.follow_symlinks(false); archive.follow_symlinks(false);
debug!(paths = ?path);
let common = anode_cache_common::common_parent(&path); for path in path {
debug!(common_path = %common.display(), paths = ?path);
for (path, name) in path.iter().map(|p| (p, p.strip_prefix(&common).unwrap())) {
let _span = info_span!("cache-entry"); let _span = info_span!("cache-entry");
let _span = _span.enter(); let _span = _span.enter();
if !path.exists() { if !path.exists() {
@ -63,11 +60,11 @@ fn main() -> Result<()> {
if path.is_dir() { if path.is_dir() {
debug!("Caching directory"); debug!("Caching directory");
// we actually want to write out all the directory contents // 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() { } else if path.is_file() {
debug!("Caching a file"); debug!("Caching a file");
// rest of the file types are handled by the existing inner code // 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 { } else {
warn!("Path is neither directory, nor a file and will not be cached"); warn!("Path is neither directory, nor a file and will not be cached");
} }