summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-12 19:34:13 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-13 20:07:55 +0200
commit6f11f3f247d8949401cd0afb676198b439053740 (patch)
treef3d244a97885e22f5a678f937ad44789aa5fb0d5
parent35e0cd907a89b751637f71ce910950a8a8865fe0 (diff)
downloadrebel-6f11f3f247d8949401cd0afb676198b439053740.tar
rebel-6f11f3f247d8949401cd0afb676198b439053740.zip
Replace 'inherit' recipe field with 'parent'
All occurrences of 'inherit' in the code are replaced with 'parent' or 'ancestors'.
-rw-r--r--crates/common/src/types.rs2
-rw-r--r--crates/driver/src/context.rs19
-rw-r--r--crates/driver/src/driver.rs23
-rw-r--r--crates/driver/src/resolve.rs8
-rw-r--r--crates/driver/src/task.rs4
-rw-r--r--crates/runner/src/task.rs8
-rw-r--r--examples/recipes/binutils/build.yml6
-rw-r--r--examples/recipes/busybox/build.yml6
-rw-r--r--examples/recipes/e2fsprogs/build.yml6
-rw-r--r--examples/recipes/gcc/build.libgcc-initial.yml6
-rw-r--r--examples/recipes/gcc/build.libgcc.yml4
-rw-r--r--examples/recipes/gcc/build.libs.yml4
-rw-r--r--examples/recipes/gcc/build.yml6
-rw-r--r--examples/recipes/glibc/build.yml6
-rw-r--r--examples/recipes/gmp/build.yml6
-rw-r--r--examples/recipes/linux/build.uapi-headers.yml2
-rw-r--r--examples/recipes/linux/build.yml6
-rw-r--r--examples/recipes/make_ext4fs/build.yml4
-rw-r--r--examples/recipes/mpc/build.yml6
-rw-r--r--examples/recipes/mpfr/build.yml6
-rw-r--r--examples/recipes/zlib/build.yml6
21 files changed, 71 insertions, 73 deletions
diff --git a/crates/common/src/types.rs b/crates/common/src/types.rs
index 32b9182..a5d6678 100644
--- a/crates/common/src/types.rs
+++ b/crates/common/src/types.rs
@@ -39,7 +39,7 @@ pub struct Task {
pub command: String,
pub workdir: String,
pub rootfs: ArchiveHash,
- pub inherit: Vec<LayerHash>,
+ pub ancestors: Vec<LayerHash>,
pub depends: HashSet<Dependency>,
pub outputs: HashMap<String, String>,
pub pins: HashMap<ArchiveHash, String>,
diff --git a/crates/driver/src/context.rs b/crates/driver/src/context.rs
index e6e60b1..3bf4bf5 100644
--- a/crates/driver/src/context.rs
+++ b/crates/driver/src/context.rs
@@ -424,7 +424,7 @@ impl Context {
Ok(Cow::Owned(ret))
}
- fn inherit_ref<'ctx>(&'ctx self, dep: &'ctx InheritDep, args: &TaskArgs) -> Result<TaskRef> {
+ fn parent_ref<'ctx>(&'ctx self, dep: &'ctx ParentDep, args: &TaskArgs) -> Result<TaskRef> {
let mapped_args = Context::map_args(&dep.dep.id, &dep.dep.args, args, false)?;
self.task_ref(&dep.dep.id, mapped_args.as_ref())
}
@@ -442,19 +442,18 @@ impl Context {
})
}
- pub fn get_inherit_depend<'ctx>(
+ pub fn get_parent_depend<'ctx>(
&'ctx self,
task_ref: &TaskRef<'ctx>,
) -> Result<Option<TaskRef>> {
let task = self.get(task_ref)?;
- let inherit = match &task.inherit {
- Some(inherit) => inherit,
- None => return Ok(None),
+ let Some(parent) = &task.parent else {
+ return Ok(None);
};
- Some(self.inherit_ref(inherit, &task_ref.args)).transpose()
+ Some(self.parent_ref(parent, &task_ref.args)).transpose()
}
- fn inherit_iter<'ctx>(
+ fn ancestor_iter<'ctx>(
&'ctx self,
task_ref: &TaskRef<'ctx>,
) -> impl Iterator<Item = Result<TaskRef>> {
@@ -468,7 +467,7 @@ impl Context {
Ok(task_ref) => task_ref,
Err(err) => return Some(Err(err)),
};
- self.1 = self.0.get_inherit_depend(&task_ref).transpose();
+ self.1 = self.0.get_parent_depend(&task_ref).transpose();
Some(Ok(task_ref))
}
}
@@ -483,7 +482,7 @@ impl Context {
let mut ret = HashSet::new();
let mut allow_noinherit = true;
- for current in self.inherit_iter(task_ref) {
+ for current in self.ancestor_iter(task_ref) {
let current_ref = current?;
let task = self.get(&current_ref)?;
let entries = task
@@ -507,7 +506,7 @@ impl Context {
let mut ret = HashSet::new();
let mut allow_noinherit = true;
- for current in self.inherit_iter(task_ref) {
+ for current in self.ancestor_iter(task_ref) {
let current_ref = current?;
let task = self.get(&current_ref)?;
let entries = task
diff --git a/crates/driver/src/driver.rs b/crates/driver/src/driver.rs
index 28c8578..212f4cf 100644
--- a/crates/driver/src/driver.rs
+++ b/crates/driver/src/driver.rs
@@ -37,7 +37,7 @@ impl<'ctx> CompletionState<'ctx> {
}
}
- // Treats both "depends" and "inherit" as dependencies
+ // Treats both "depends" and "parent" as dependencies
fn deps_satisfied(&self, task_ref: &TaskRef) -> bool {
resolve::get_dependent_tasks(self.ctx, task_ref)
.map_err(|_| Error::new(format!("invalid dependency for {}", task_ref)))
@@ -103,18 +103,17 @@ impl<'ctx> CompletionState<'ctx> {
Ok(fetch_deps.chain(build_deps).chain(host_deps).collect())
}
- fn task_inherit_chain(&self, task_ref: &TaskRef<'ctx>) -> Vec<LayerHash> {
- let inherit = match self
+ fn task_ancestors(&self, task_ref: &TaskRef<'ctx>) -> Vec<LayerHash> {
+ let Some(parent) = self
.ctx
- .get_inherit_depend(task_ref)
- .expect("invalid inherit depends")
- {
- Some(inherit) => inherit,
- None => return vec![],
+ .get_parent_depend(task_ref)
+ .expect("invalid parent depends")
+ else {
+ return vec![];
};
- let mut chain = self.task_inherit_chain(&inherit);
- if let Some(layer) = self.tasks_done[&inherit].layer {
+ let mut chain = self.task_ancestors(&parent);
+ if let Some(layer) = self.tasks_done[&parent].layer {
chain.push(layer);
}
chain
@@ -314,7 +313,7 @@ impl<'ctx> Driver<'ctx> {
})
.collect();
- let inherit_chain = self.state.task_inherit_chain(task_ref);
+ let ancestors = self.state.task_ancestors(task_ref);
let mut run = Self::task_setup(task_ref);
run.push(&task_def.action.run);
@@ -331,7 +330,7 @@ impl<'ctx> Driver<'ctx> {
command,
workdir: paths::TASK_WORKDIR.to_string(),
rootfs: rootfs.0,
- inherit: inherit_chain,
+ ancestors,
depends: task_deps,
outputs: task_output,
pins: HashMap::from([rootfs.clone()]),
diff --git a/crates/driver/src/resolve.rs b/crates/driver/src/resolve.rs
index c13fcd2..102c483 100644
--- a/crates/driver/src/resolve.rs
+++ b/crates/driver/src/resolve.rs
@@ -214,7 +214,7 @@ pub fn get_dependent_tasks<'ctx>(
task_ref: &TaskRef<'ctx>,
) -> Result<HashSet<TaskRef<'ctx>>, Vec<Error<'ctx>>> {
Ok(ctx
- .get_inherit_depend(task_ref)
+ .get_parent_depend(task_ref)
.map_err(|err| vec![err.into()])?
.into_iter()
.chain(
@@ -281,9 +281,9 @@ impl<'ctx> Resolver<'ctx> {
};
let _ = (|| -> Result<(), ()> {
- match self.ctx.get_inherit_depend(task) {
- Ok(Some(inherit)) => {
- handle_errors(self.add_task(&inherit, None))?;
+ match self.ctx.get_parent_depend(task) {
+ Ok(Some(parent)) => {
+ handle_errors(self.add_task(&parent, None))?;
}
Ok(None) => {}
Err(err) => {
diff --git a/crates/driver/src/task.rs b/crates/driver/src/task.rs
index e30f214..e84766e 100644
--- a/crates/driver/src/task.rs
+++ b/crates/driver/src/task.rs
@@ -28,7 +28,7 @@ fn default_output_name() -> String {
}
#[derive(Clone, Debug, Deserialize)]
-pub struct InheritDep {
+pub struct ParentDep {
#[serde(flatten)]
pub dep: TaskDep,
}
@@ -78,7 +78,7 @@ pub struct TaskDef {
#[serde(default)]
pub args: HashMap<String, ArgType>,
#[serde(default)]
- pub inherit: Option<InheritDep>,
+ pub parent: Option<ParentDep>,
#[serde(default)]
pub fetch: HashSet<Fetch>,
#[serde(default)]
diff --git a/crates/runner/src/task.rs b/crates/runner/src/task.rs
index 5c27e78..19b74f4 100644
--- a/crates/runner/src/task.rs
+++ b/crates/runner/src/task.rs
@@ -52,7 +52,7 @@ fn input_hash(task: &Task) -> InputHash {
pub command: &'a str,
pub workdir: &'a str,
pub rootfs: &'a ArchiveHash,
- pub inherit: &'a [LayerHash],
+ pub ancestors: &'a [LayerHash],
pub depends: HashMap<DependencyHash, &'a Dependency>,
pub outputs: &'a HashMap<String, String>,
}
@@ -60,7 +60,7 @@ fn input_hash(task: &Task) -> InputHash {
command: &task.command,
workdir: &task.workdir,
rootfs: &task.rootfs,
- inherit: &task.inherit,
+ ancestors: &task.ancestors,
depends: task
.depends
.iter()
@@ -94,7 +94,7 @@ fn init_task(input_hash: &InputHash, task: &Task) -> Result<fs::Mount> {
.with_context(|| format!("Failed to write {}", runfile))?;
let mount_target = paths::join(&[&task_tmp_dir, &task.workdir]);
- let mount = if task.inherit.is_empty() {
+ let mount = if task.ancestors.is_empty() {
fs::mount(task_layer_dir, &mount_target, None, MsFlags::MS_BIND, None)
.with_context(|| format!("Failed to bind mount to {:?}", mount_target))?
} else {
@@ -104,7 +104,7 @@ fn init_task(input_hash: &InputHash, task: &Task) -> Result<fs::Mount> {
fs::fixup_permissions(&task_work_dir)?;
let lower = task
- .inherit
+ .ancestors
.iter()
.rev()
.map(paths::layer_dir)
diff --git a/examples/recipes/binutils/build.yml b/examples/recipes/binutils/build.yml
index a82723f..dd82d2e 100644
--- a/examples/recipes/binutils/build.yml
+++ b/examples/recipes/binutils/build.yml
@@ -12,7 +12,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -44,7 +44,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -55,7 +55,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/busybox/build.yml b/examples/recipes/busybox/build.yml
index e8019bb..fa87bc3 100644
--- a/examples/recipes/busybox/build.yml
+++ b/examples/recipes/busybox/build.yml
@@ -10,7 +10,7 @@ tasks:
configure:
- inherit:
+ parent:
task: 'unpack'
run: |
mkdir {{name}}-build
@@ -23,7 +23,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
build_depends:
- recipe: 'toolchain'
@@ -46,7 +46,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/e2fsprogs/build.yml b/examples/recipes/e2fsprogs/build.yml
index e1fc0e0..508d1d4 100644
--- a/examples/recipes/e2fsprogs/build.yml
+++ b/examples/recipes/e2fsprogs/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -31,7 +31,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -41,7 +41,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/gcc/build.libgcc-initial.yml b/examples/recipes/gcc/build.libgcc-initial.yml
index 38414aa..ed230ba 100644
--- a/examples/recipes/gcc/build.libgcc-initial.yml
+++ b/examples/recipes/gcc/build.libgcc-initial.yml
@@ -3,7 +3,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
recipe: 'gcc'
task: 'compile'
depends:
@@ -28,7 +28,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -38,7 +38,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default: {}
diff --git a/examples/recipes/gcc/build.libgcc.yml b/examples/recipes/gcc/build.libgcc.yml
index ed7fa66..67e21f7 100644
--- a/examples/recipes/gcc/build.libgcc.yml
+++ b/examples/recipes/gcc/build.libgcc.yml
@@ -3,7 +3,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
recipe: 'gcc'
task: 'compile'
depends:
@@ -19,7 +19,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default: {}
diff --git a/examples/recipes/gcc/build.libs.yml b/examples/recipes/gcc/build.libs.yml
index 4a20ad1..856fd1c 100644
--- a/examples/recipes/gcc/build.libs.yml
+++ b/examples/recipes/gcc/build.libs.yml
@@ -2,7 +2,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
recipe: 'gcc/libgcc'
task: 'compile'
args:
@@ -15,7 +15,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/gcc/build.yml b/examples/recipes/gcc/build.yml
index cd4166e..3352b2d 100644
--- a/examples/recipes/gcc/build.yml
+++ b/examples/recipes/gcc/build.yml
@@ -26,7 +26,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -95,7 +95,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'configure'
depends:
- task: 'header-stubs'
@@ -109,7 +109,7 @@ tasks:
args:
host: 'platform'
target: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/glibc/build.yml b/examples/recipes/glibc/build.yml
index 3538d90..f1bf890 100644
--- a/examples/recipes/glibc/build.yml
+++ b/examples/recipes/glibc/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'gcc'
@@ -47,7 +47,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -56,7 +56,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/gmp/build.yml b/examples/recipes/gmp/build.yml
index 3a07f44..322f0f0 100644
--- a/examples/recipes/gmp/build.yml
+++ b/examples/recipes/gmp/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -31,7 +31,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -40,7 +40,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/linux/build.uapi-headers.yml b/examples/recipes/linux/build.uapi-headers.yml
index ea398d3..a302aa9 100644
--- a/examples/recipes/linux/build.uapi-headers.yml
+++ b/examples/recipes/linux/build.uapi-headers.yml
@@ -9,7 +9,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
output:
default: {}
diff --git a/examples/recipes/linux/build.yml b/examples/recipes/linux/build.yml
index ad32813..3f84291 100644
--- a/examples/recipes/linux/build.yml
+++ b/examples/recipes/linux/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'gcc'
@@ -28,7 +28,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
export KBUILD_BUILD_TIMESTAMP="@${SOURCE_DATE_EPOCH}"
@@ -42,7 +42,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
boot:
diff --git a/examples/recipes/make_ext4fs/build.yml b/examples/recipes/make_ext4fs/build.yml
index f50fa85..183389a 100644
--- a/examples/recipes/make_ext4fs/build.yml
+++ b/examples/recipes/make_ext4fs/build.yml
@@ -19,7 +19,7 @@ tasks:
task: 'depends'
- recipe: 'zlib'
task: 'install'
- inherit:
+ parent:
task: 'unpack'
run: |
cd {{name}}-{{version}}
@@ -28,7 +28,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/mpc/build.yml b/examples/recipes/mpc/build.yml
index 816bed0..e415c60 100644
--- a/examples/recipes/mpc/build.yml
+++ b/examples/recipes/mpc/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -33,7 +33,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -42,7 +42,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/mpfr/build.yml b/examples/recipes/mpfr/build.yml
index b77cf81..619bec7 100644
--- a/examples/recipes/mpfr/build.yml
+++ b/examples/recipes/mpfr/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -33,7 +33,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -42,7 +42,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default:
diff --git a/examples/recipes/zlib/build.yml b/examples/recipes/zlib/build.yml
index a9f09d7..3e72844 100644
--- a/examples/recipes/zlib/build.yml
+++ b/examples/recipes/zlib/build.yml
@@ -11,7 +11,7 @@ tasks:
configure:
args:
host: 'platform'
- inherit:
+ parent:
task: 'unpack'
build_depends:
- recipe: 'toolchain'
@@ -29,7 +29,7 @@ tasks:
compile:
args:
host: 'platform'
- inherit:
+ parent:
task: 'configure'
run: |
cd {{name}}-build
@@ -38,7 +38,7 @@ tasks:
install:
args:
host: 'platform'
- inherit:
+ parent:
task: 'compile'
output:
default: