fix(cookbook): copy path source in fetch_offline() too (was only in fetch())
fetch_offline() is called for protected recipes (base, kernel, relibc, etc.) when REDBEAR_ALLOW_PROTECTED_FETCH=1 is set. Previously, its Path source arm called only redbear_ensure_offline_source() which fails with 'is not exist' if the source dir is empty. The fix: do the same copy_dir_all() in fetch_offline()'s Path arm as in fetch()'s Path arm. This means local fork paths (local/sources/base, local/sources/relibc, etc.) are correctly copied into recipes/<name>/source during protected recipe fetch.
This commit is contained in:
+17
-4
@@ -354,10 +354,23 @@ pub fn fetch_offline(recipe: &CookRecipe, logger: &PtyOut) -> Result<FetchResult
|
||||
}
|
||||
|
||||
let result = match &recipe.recipe.source {
|
||||
Some(SourceRecipe::Path { path: _ }) => {
|
||||
redbear_ensure_offline_source(recipe_dir, &source_dir, logger)?;
|
||||
let ident = fetch_apply_source_info(recipe, "".to_string())?;
|
||||
FetchResult::cached(source_dir, ident)
|
||||
Some(SourceRecipe::Path { path }) => {
|
||||
let path = recipe_dir.join(path);
|
||||
let cached = source_dir.is_dir() && modified_dir(&path)? <= modified_dir(&source_dir)?;
|
||||
if !cached {
|
||||
log_to_pty!(
|
||||
logger,
|
||||
"[DEBUG]: {:?} is newer than {:?}",
|
||||
path.display(),
|
||||
source_dir.display()
|
||||
);
|
||||
copy_dir_all(&path, &source_dir).map_err(wrap_io_err!(
|
||||
&path,
|
||||
source_dir,
|
||||
"Copying source"
|
||||
))?;
|
||||
}
|
||||
FetchResult::new(source_dir, "local_source".to_string(), cached)
|
||||
}
|
||||
None => {
|
||||
let ident = fetch_apply_source_info(recipe, "".to_string())?;
|
||||
|
||||
Reference in New Issue
Block a user