summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-10-28 22:30:16 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-10-28 23:28:04 +0200
commitfb6fa0720400d8fa7d9ae29d02c2db58a57a6c8a (patch)
tree43d984227f1e10bb327ff2a37c0f0ed656eaf559
parent00f1c87d3d841f5b24c89d370868cf0306896877 (diff)
downloadrebel-fb6fa0720400d8fa7d9ae29d02c2db58a57a6c8a.tar
rebel-fb6fa0720400d8fa7d9ae29d02c2db58a57a6c8a.zip
Split paths module into driver and runner parts
There are still a few remaining paths that are defined in both driver and runner.
-rw-r--r--crates/driver/src/context.rs12
-rw-r--r--crates/driver/src/driver.rs8
-rw-r--r--crates/driver/src/main.rs1
-rw-r--r--crates/driver/src/paths.rs4
-rw-r--r--crates/runner/src/lib.rs2
-rw-r--r--crates/runner/src/paths.rs4
6 files changed, 16 insertions, 15 deletions
diff --git a/crates/driver/src/context.rs b/crates/driver/src/context.rs
index daed230..4fcc3e5 100644
--- a/crates/driver/src/context.rs
+++ b/crates/driver/src/context.rs
@@ -15,10 +15,10 @@ use common::{
error::{self, Contextualizable},
types::TaskID,
};
-use runner::paths;
use crate::{
args::{self, arg, Arg, ArgMapping, ArgType, PlatformRelation, TaskArgs},
+ paths,
task::*,
};
@@ -128,7 +128,7 @@ fn platform_relation(args: &TaskArgs, from: &str, to: &str) -> Option<PlatformRe
} else {
PlatformRelation {
is_same: false,
- sysroot: paths::abs(paths::TASK_SYSROOT),
+ sysroot: paths::TASK_SYSROOT.to_string(),
cross_compile: format!("{}/bin/{}-", plat_from.prefix, plat_to.gnu_triplet),
}
};
@@ -169,10 +169,10 @@ impl Context {
let globals = TaskArgs::from_iter([
("build".to_string(), platforms["build"].clone()),
- arg("workdir", paths::abs(paths::TASK_WORKDIR)),
- arg("dldir", paths::abs(paths::TASK_DLDIR)),
- arg("destdir", paths::abs(paths::TASK_DESTDIR)),
- arg("sysroot", paths::abs(paths::TASK_SYSROOT)),
+ arg("workdir", paths::TASK_WORKDIR.to_string()),
+ arg("dldir", paths::TASK_DLDIR.to_string()),
+ arg("destdir", paths::TASK_DESTDIR.to_string()),
+ arg("sysroot", paths::TASK_SYSROOT.to_string()),
]);
Context {
diff --git a/crates/driver/src/driver.rs b/crates/driver/src/driver.rs
index 683e111..75aff02 100644
--- a/crates/driver/src/driver.rs
+++ b/crates/driver/src/driver.rs
@@ -7,11 +7,11 @@ use indoc::indoc;
use nix::poll;
use common::{error::*, string_hash::*, types::*};
-use runner::{paths, Runner};
+use runner::Runner;
use crate::{
context::{Context, TaskRef},
- resolve,
+ paths, resolve,
task::*,
template,
};
@@ -88,7 +88,7 @@ impl<'ctx> CompletionState<'ctx> {
.filter_map(|dep| self.tasks_done[&dep.task].outputs.get(dep.output))
.map(|&output| Dependency::Task {
output,
- path: paths::abs(paths::TASK_SYSROOT),
+ path: paths::TASK_SYSROOT.to_string(),
}),
)
.collect())
@@ -269,7 +269,7 @@ impl<'ctx> Driver<'ctx> {
.iter()
.map(|(name, Output { path, .. })| {
let output_path = if let Some(path) = path {
- paths::join(&[paths::TASK_DESTDIR, path])
+ format!("{}/{}", paths::TASK_DESTDIR, path)
} else {
paths::TASK_DESTDIR.to_string()
};
diff --git a/crates/driver/src/main.rs b/crates/driver/src/main.rs
index 286480d..6e783ea 100644
--- a/crates/driver/src/main.rs
+++ b/crates/driver/src/main.rs
@@ -1,6 +1,7 @@
mod args;
mod context;
mod driver;
+mod paths;
mod recipe;
mod resolve;
mod task;
diff --git a/crates/driver/src/paths.rs b/crates/driver/src/paths.rs
new file mode 100644
index 0000000..274dda1
--- /dev/null
+++ b/crates/driver/src/paths.rs
@@ -0,0 +1,4 @@
+pub const TASK_DESTDIR: &str = "/build/dest";
+pub const TASK_DLDIR: &str = "/build/downloads";
+pub const TASK_WORKDIR: &str = "/build/work";
+pub const TASK_SYSROOT: &str = "/opt/toolchain/sysroot";
diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs
index 636c112..9ca6c23 100644
--- a/crates/runner/src/lib.rs
+++ b/crates/runner/src/lib.rs
@@ -1,7 +1,7 @@
mod init;
mod jobserver;
mod ns;
-pub mod paths;
+mod paths;
mod tar;
mod task;
mod util;
diff --git a/crates/runner/src/paths.rs b/crates/runner/src/paths.rs
index 5bfef25..e436948 100644
--- a/crates/runner/src/paths.rs
+++ b/crates/runner/src/paths.rs
@@ -31,8 +31,6 @@
//!    └── <input hash>/
//! ├── build/ # mount point for /build directory
//! │ ├── downloads/ # downloaded sources
-//! │ ├── dest/ # collected as output after build
-//! │ ├── sysroot/ # sysroot mountpoint
//! │ ├── task/ # internal runner files
//! │ └── work/ # build overlay mountpoint
//! ├── rootfs/ # rootfs overlay mountpoint
@@ -61,11 +59,9 @@ pub const TASK_STATE_LAYER_SUBDIR: &str = "layer";
pub const TASK_STATE_WORK_SUBDIR: &str = "work";
pub const TASK_BUILDDIR: &str = "build";
-pub const TASK_DESTDIR: &str = "build/dest";
pub const TASK_DLDIR: &str = "build/downloads";
pub const TASK_TASKDIR: &str = "build/task";
pub const TASK_WORKDIR: &str = "build/work";
-pub const TASK_SYSROOT: &str = "opt/toolchain/sysroot";
pub const TASK_RUN: &str = "run";