mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 23:44:17 +08:00
Merge branch 'recipe-reload' into 'master'
Update build on recipe changes and fix host recipe reload on TUI See merge request redox-os/redox!1742
This commit is contained in:
commit
8cb5fa2ddf
@ -452,7 +452,8 @@ fn parse_args(args: Vec<String>) -> anyhow::Result<(CliConfig, CliCommand, Vec<C
|
||||
.collect(),
|
||||
}
|
||||
.iter()
|
||||
.map(|f| CookRecipe::from_path(f, !command.is_cleaning()))
|
||||
// TODO: Allow selecting recipes from category as host?
|
||||
.map(|f| CookRecipe::from_path(f, !command.is_cleaning(), false))
|
||||
.collect::<Result<Vec<CookRecipe>, PackageError>>()?
|
||||
} else {
|
||||
if recipe_names.is_empty() {
|
||||
|
||||
@ -89,7 +89,7 @@ fn publish_packages(config: &CliConfig) -> anyhow::Result<()> {
|
||||
eprintln!("recipe {} not found", recipe);
|
||||
continue;
|
||||
};
|
||||
let Ok(cookbook_recipe) = CookRecipe::from_path(recipe_path, true) else {
|
||||
let Ok(cookbook_recipe) = CookRecipe::from_path(recipe_path, true, false) else {
|
||||
eprintln!("recipe {} unable to read", recipe);
|
||||
continue;
|
||||
};
|
||||
|
||||
@ -208,7 +208,12 @@ pub fn build(
|
||||
return Ok((stage_dirs, auto_deps));
|
||||
}
|
||||
|
||||
let source_modified = modified_dir_ignore_git(source_dir).unwrap_or(SystemTime::UNIX_EPOCH);
|
||||
let mut source_modified = modified_dir_ignore_git(source_dir).unwrap_or(SystemTime::UNIX_EPOCH);
|
||||
if let Ok(recipe_modified) = modified(&recipe_dir.join("recipe.toml")) {
|
||||
if recipe_modified > source_modified {
|
||||
source_modified = recipe_modified
|
||||
}
|
||||
}
|
||||
let deps_modified = dep_pkgars
|
||||
.iter()
|
||||
.map(|(_dep, pkgar)| modified(pkgar))
|
||||
@ -221,7 +226,6 @@ pub fn build(
|
||||
.unwrap_or(Ok(SystemTime::UNIX_EPOCH))?;
|
||||
|
||||
// Rebuild sysroot if source is newer
|
||||
//TODO: rebuild on recipe changes
|
||||
if recipe.build.kind != BuildKind::Remote {
|
||||
build_deps_dir(
|
||||
logger,
|
||||
@ -248,7 +252,6 @@ pub fn build(
|
||||
}
|
||||
|
||||
// Rebuild stage if source is newer
|
||||
//TODO: rebuild on recipe changes
|
||||
if stage_dirs.iter().any(|dir| dir.is_dir()) {
|
||||
let stage_modified =
|
||||
modified_all(&stage_dirs, modified_dir).unwrap_or(SystemTime::UNIX_EPOCH);
|
||||
|
||||
@ -265,9 +265,12 @@ impl CookRecipe {
|
||||
Self::new(name, dir.to_path_buf(), recipe)
|
||||
}
|
||||
|
||||
pub fn from_path(dir: &Path, read_recipe: bool) -> Result<Self, PackageError> {
|
||||
pub fn from_path(dir: &Path, read_recipe: bool, is_host: bool) -> Result<Self, PackageError> {
|
||||
let file = dir.join("recipe.toml");
|
||||
let name: PackageName = dir.file_name().unwrap().try_into()?;
|
||||
let mut name: PackageName = dir.file_name().unwrap().try_into()?;
|
||||
if is_host {
|
||||
name = name.with_host();
|
||||
}
|
||||
let recipe = if read_recipe {
|
||||
Recipe::new(&file)?
|
||||
} else {
|
||||
@ -417,7 +420,7 @@ impl CookRecipe {
|
||||
}
|
||||
|
||||
pub fn reload_recipe(&mut self) -> Result<(), PackageError> {
|
||||
let r = Self::from_path(&self.dir, true)?;
|
||||
let r = Self::from_path(&self.dir, true, self.name.is_host())?;
|
||||
self.recipe = r.recipe;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user