mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-27 23:34:19 +08:00
Don't pass cargo offline for custom script
This commit is contained in:
parent
f58e11a168
commit
94a0355907
@ -356,6 +356,7 @@ pub fn build(
|
||||
return build_remote(stage_dirs, recipe, target_dir, cook_config);
|
||||
}
|
||||
|
||||
let mut allow_cargo_offline = false;
|
||||
//TODO: better integration with redoxer (library instead of binary)
|
||||
//TODO: configurable target
|
||||
//TODO: Add more configurability, convert scripts to Rust?
|
||||
@ -366,6 +367,7 @@ pub fn build(
|
||||
cargopackages,
|
||||
cargoexamples,
|
||||
} => {
|
||||
allow_cargo_offline = true;
|
||||
let mut script = format!(
|
||||
"DYNAMIC_INIT\n{}\nCOOKBOOK_CARGO_PATH={} ",
|
||||
flags_fn("COOKBOOK_CARGO_FLAGS", cargoflags),
|
||||
@ -455,8 +457,10 @@ pub fn build(
|
||||
if cli_verbose {
|
||||
command.env("COOKBOOK_VERBOSE", "1");
|
||||
}
|
||||
if cook_config.offline {
|
||||
if cook_config.offline && allow_cargo_offline {
|
||||
command.env("COOKBOOK_OFFLINE", "1");
|
||||
} else {
|
||||
command.env_remove("COOKBOOK_OFFLINE");
|
||||
}
|
||||
if let Ok(ident_source) = fetch::fetch_get_source_info(&cook_recipe) {
|
||||
command.env("COOKBOOK_SOURCE_IDENT", ident_source.source_identifier);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
use crate::config::translate_mirror;
|
||||
use crate::cook::cook_build;
|
||||
use crate::cook::fetch_repo;
|
||||
use crate::cook::fetch_repo::PlainPtyCallback;
|
||||
use crate::cook::fs::*;
|
||||
@ -392,8 +393,9 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result
|
||||
cargoexamples: _,
|
||||
} = &recipe.recipe.build.kind
|
||||
{
|
||||
// TODO: No need to fetch if !check_source and already fetched?
|
||||
fetch_cargo(&source_dir, cargopath.as_ref(), logger)?;
|
||||
if fetch_will_build(recipe) {
|
||||
fetch_cargo(&source_dir, cargopath.as_ref(), logger)?;
|
||||
}
|
||||
}
|
||||
|
||||
fetch_apply_source_info(recipe, ident)?;
|
||||
@ -401,6 +403,24 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result
|
||||
Ok(source_dir)
|
||||
}
|
||||
|
||||
/// This does the same check as in cook_build
|
||||
fn fetch_will_build(recipe: &CookRecipe) -> bool {
|
||||
let check_source = !recipe.is_deps;
|
||||
if !check_source {
|
||||
// there could be more check here, but it's heavy so just assume it will build
|
||||
return true;
|
||||
}
|
||||
|
||||
let stage_dirs =
|
||||
cook_build::get_stage_dirs(&recipe.recipe.optional_packages, &recipe.target_dir());
|
||||
let stage_pkgars: Vec<PathBuf> = stage_dirs
|
||||
.iter()
|
||||
.map(|p| p.with_added_extension("pkgar"))
|
||||
.collect();
|
||||
let stage_present = stage_pkgars.iter().all(|file| file.is_file());
|
||||
!stage_present
|
||||
}
|
||||
|
||||
pub(crate) fn fetch_make_symlink(source_dir: &PathBuf, same_as: &String) -> Result<(), String> {
|
||||
let target_dir = Path::new(same_as).join("source");
|
||||
if !source_dir.is_symlink() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user