summaryrefslogtreecommitdiffstats
path: root/crates/runner/src/paths.rs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-10-31 12:27:00 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-10-31 20:20:04 +0100
commite462674c78a7c7dea7bac0eaf9e177cff0280df9 (patch)
tree73ade86a6b00451564d515840ff33f20bf43e406 /crates/runner/src/paths.rs
parenta762d729d3f07591d2fa26c154255ab43de1ad9c (diff)
downloadrebel-e462674c78a7c7dea7bac0eaf9e177cff0280df9.tar
rebel-e462674c78a7c7dea7bac0eaf9e177cff0280df9.zip
runner: unpack dependencies only once
Reuse unpacked dependencies across multiple tasks by mounting them into a single task's build directory. We lose support for file conflict detection for now.
Diffstat (limited to 'crates/runner/src/paths.rs')
-rw-r--r--crates/runner/src/paths.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/crates/runner/src/paths.rs b/crates/runner/src/paths.rs
index 5e183cb..2e174df 100644
--- a/crates/runner/src/paths.rs
+++ b/crates/runner/src/paths.rs
@@ -28,14 +28,14 @@
//! └── tmp/ # temporary files (cleaned on start)
//!    ├── dev/ # container /dev
//!    ├── rootfs/ # unpacked rootfs.tar
+//!    ├── depends/ # unpacked dependencies
//!    └── task/
//!    └── <input hash>/
//! ├── build/ # mount point for /build directory
//! │ ├── downloads/ # downloaded sources
//! │ ├── task/ # internal runner files
//! │ └── work/ # build overlay mountpoint
-//! ├── rootfs/ # rootfs overlay mountpoint
-//! └── depends/ # overlayed on rootfs in container
+//! └── rootfs/ # rootfs overlay mountpoint
//! ```
use common::string_hash::*;
@@ -47,10 +47,10 @@ pub const DOWNLOADS_DIR: &str = "build/downloads";
pub const TMP_DIR: &str = "build/tmp";
pub const DEV_DIR: &str = "build/tmp/dev";
pub const ROOTFS_DIR: &str = "build/tmp/rootfs";
+pub const DEPENDS_TMP_DIR: &str = "build/tmp/depends";
pub const TASK_TMP_DIR: &str = "build/tmp/task";
pub const TASK_TMP_ROOTFS_SUBDIR: &str = "rootfs";
-pub const TASK_TMP_DEPENDS_SUBDIR: &str = "depends";
pub const LOCKFILE: &str = "build/build.lock";
pub const OUTPUT_STATE_DIR: &str = "build/state/output";
@@ -97,6 +97,18 @@ pub fn layer_dir(hash: &LayerHash) -> String {
join(&[LAYER_STATE_DIR, &hash.to_string()])
}
+pub fn depend_tmp_dir(hash: &ArchiveHash) -> String {
+ join(&[DEPENDS_TMP_DIR, &hash.to_string()])
+}
+
+pub fn depend_dir(hash: &ArchiveHash) -> String {
+ join(&[DEPENDS_TMP_DIR, &hash.to_string()])
+}
+
+pub fn depend_lock_filename(hash: &ArchiveHash) -> String {
+ join(&[DEPENDS_TMP_DIR, &format!("{}.lock", hash.to_string())])
+}
+
pub fn archive_tmp_filename(hash: &InputHash) -> String {
join(&[OUTPUT_STATE_DIR, &format!("{}.tar.tmp", hash)])
}