Compare commits

...

22 Commits

Author SHA1 Message Date
Ribbon
9420719f6f Merge branch 'install-jre-headless' into 'master'
Install JRE headless package

See merge request redox-os/redox!1686
2025-12-07 10:15:19 -03:00
Jeremy Soller
8cb5fa2ddf 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
2025-12-06 20:53:42 -07:00
Wildan M
27e35f645f
Update build on recipe changes and fix host recipe reload on TUI 2025-12-07 10:18:35 +07:00
Jeremy Soller
e3807caa84 Merge branch 'sysroot-update' into 'master'
Use file tags for sysroot invalidation

See merge request redox-os/redox!1741
2025-12-06 08:16:35 -07:00
Jeremy Soller
d168414747 Merge branch 'tidy-up-n-autoreload' into 'master'
Little tidy up and reload recipe.toml when retrying from TUI

See merge request redox-os/redox!1740
2025-12-06 08:16:12 -07:00
Jeremy Soller
ea5182e6ce Merge branch 'fix_urcu' into 'master'
Fix liburcu

See merge request redox-os/redox!1739
2025-12-06 08:15:53 -07:00
Wildan M
fce4236e9a
Use file tags for sysroot invalidation 2025-12-06 22:10:04 +07:00
bjorn3
bf6da7ccf9 liburcu: Fix compilation on Redox OS 2025-12-06 16:09:31 +01:00
Wildan M
96d2d5dfe7
Reread recipe TOML on TUI retry 2025-12-06 22:00:25 +07:00
Wildan M
3ae5da8d13
Code simplification 2025-12-06 21:58:28 +07:00
Jeremy Soller
d9af4e385a Merge branch 'fix-print' into 'master'
Drop print debug

See merge request redox-os/redox!1738
2025-12-05 07:15:43 -07:00
Wildan M
f66a09637f
Drop print debug 2025-12-05 20:57:29 +07:00
Jeremy Soller
6c95928280 Merge branch 'trademark' into 'master'
Redox OS Trademark Policy

See merge request redox-os/redox!1733
2025-12-05 06:16:51 -07:00
Jeremy Soller
e5b00a16e7 Merge branch 'fix-logs-dir' into 'master'
Fix log generation and stop key clobbering TUI

See merge request redox-os/redox!1736
2025-12-05 06:14:44 -07:00
Wildan M
5d0367f6ab
Fix log generation and stop key clobbering TUI 2025-12-05 14:29:56 +07:00
Jeremy Soller
99f61754b3 Merge branch 'use-treeless-clone' into 'master'
Use git filter to allow tracking of shallow clone

See merge request redox-os/redox!1735
2025-12-04 18:24:25 -07:00
Wildan M
a8452a20c4
Don't imply shallow clone default 2025-12-05 08:15:39 +07:00
Wildan M
d461f47aee
Use git filter to allow tracking of shallow clone 2025-12-05 07:31:36 +07:00
Jeremy Soller
d6fd1b3207 Merge branch 'try-fix-mr-ci' into 'master'
Try fixing CI on MR

See merge request redox-os/redox!1734
2025-12-04 17:06:31 -07:00
Wildan M
38e1927bff
Try fixing CI on MR 2025-12-05 06:05:29 +07:00
Jeremy Soller
0134ba2e87
Redox OS Trademark Policy 2025-12-03 14:54:53 -07:00
Ribbon
3e3c26203b Install JRE headless package 2025-11-17 08:35:53 -03:00
16 changed files with 184 additions and 82 deletions

View File

@ -9,12 +9,18 @@ stages:
fmt:
stage: lint
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_NAMESPACE == "redox-os"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
script:
- rustup component add rustfmt
- cargo fmt -- --check
cargo-test:
stage: lint
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_NAMESPACE == "redox-os"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
script:
# TODO: we should omit fuse from cargo install chains
- apt update && apt install -y fuse3 libfuse3-dev

6
Cargo.lock generated
View File

@ -912,7 +912,7 @@ dependencies = [
[[package]]
name = "redox-pkg"
version = "0.2.8"
source = "git+https://gitlab.redox-os.org/redox-os/pkgutils.git#b89f08df540b597949207147e0645aed24eb2a80"
source = "git+https://gitlab.redox-os.org/redox-os/pkgutils.git#6ed6a265cbe9abaf9d747e700f72cad9cea5a5d0"
dependencies = [
"anyhow",
"ignore",
@ -986,7 +986,7 @@ dependencies = [
[[package]]
name = "redoxer"
version = "0.2.61"
source = "git+https://gitlab.redox-os.org/redox-os/redoxer.git#ccf8df39804a3b405c239a7b2bdddceb77612911"
source = "git+https://gitlab.redox-os.org/redox-os/redoxer.git#a4c4dac4550bc234aa04e30efd4058daf8377678"
dependencies = [
"anyhow",
"dirs",
@ -1321,7 +1321,7 @@ version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if 1.0.4",
"cfg-if 0.1.10",
"static_assertions",
]

39
TRADEMARK.md Normal file
View File

@ -0,0 +1,39 @@
# Redox OS Trademark Policy
This document outlines the policy regarding the use of the Redox OS trademark owned by the Redox OS nonprofit. The purpose of this policy is to ensure that the Redox OS trademark is used correctly and consistently, maintaining the integrity and reputation of the Redox OS brand.
1. Usage of the Redox OS Trademark
1. The Redox OS trademark includes, but is not limited to, the name "Redox OS", the Redox OS logo, and any associated symbols or designs.
2. The Redox OS trademark may only be used in accordance with this policy. Unauthorized use of the trademark is prohibited.
2. Permissible Use
1. Community Projects: Community projects may use the Redox OS trademark to refer to the operating system, provided that such use is not misleading and does not imply endorsement by the Redox OS nonprofit without explicit permission.
2. Educational and Informational Use: The Redox OS trademark may be used in educational and informational materials, including books, websites, and articles, to refer to the operating system, provided that such use complies with the guidelines set forth in this policy.
3. Marketing and Promotional Use: Partners and affiliates of the Redox OS nonprofit may use the Redox OS trademark in marketing and promotional materials with prior written consent from the Redox OS nonprofit.
3. Prohibited Use
1. Misrepresentation: The Redox OS trademark must not be used in a way that misrepresents or implies false association with, endorsement by, or sponsorship from the Redox OS nonprofit.
2. Modification: The Redox OS trademark must not be altered, modified, or used as part of another trademark or logo without prior written permission from the Redox OS nonprofit.
3. Merchandising: The Redox OS trademark must not be used on merchandise (e.g., T-shirts, mugs) for commercial purposes without explicit authorization from the Redox OS nonprofit.
4. Logo Usage Guidelines
1. The Redox OS logo must be used as provided by the Redox OS nonprofit without any modifications. This includes maintaining the logos colors, proportions, and overall design.
2. The Redox OS logo must be displayed in a manner that is clear and legible. Sufficient clear space should be maintained around the logo to ensure it is not crowded by other visual elements.
3. The Redox OS name should be identified as a trademark using the “™” symbol.
5. Official Redox OS Software
1. Software hosted at [the Redox OS GitLab group](https://gitlab.redox-os.org/redox-os/) is considered official Redox OS software. Only software that has been approved by the Redox OS nonprofit is permitted to use the Redox OS trademarks to refer to itself. Software that is official Redox OS software may use the “redox-os-” package namespace and “org.redox_os.” prefixed reverse-DNS ID. Other software should avoid using these prefixes.
2. Third-party software that integrates with or extend the Redox OS operating system must not use the Redox OS trademark in a way that implies official status or endorsement without prior approval from the Redox OS nonprofit. Third-party developers are encouraged to use the "redox-os-ext-" package namespace. This software may be described as "for the Redox OS™ operating system".
3. Third-party software may request inclusion as official Redox OS software. To request inclusion, please contact the Redox OS nonprofit at trademark@redox-os.org.
6. Request for Permission
1. To request permission for uses of the Redox OS trademark not covered by this policy, please contact the Redox OS nonprofit at trademark@redox-os.org.
2. All requests will be reviewed on a case-by-case basis, and the Redox OS nonprofit reserves the right to grant or deny permission at its sole discretion.
7. Enforcement
1. The Redox OS nonprofit reserves the right to take appropriate legal action against any unauthorized use of the Redox OS trademark.
2. The Redox OS nonprofit may, at its discretion, require the cessation of use of the Redox OS trademark by any party that fails to comply with this policy.
## Contact Information
For any questions or to request permission to use the Redox OS trademark, please contact:<br><br>
Redox OS<br>
trademark@redox-os.org<br><br>
This trademark policy is effective as of December 3, 2025 and may be updated from time to time at the discretion of the Redox OS nonprofit.
---
By adhering to these guidelines, you help us protect the Redox OS brand and ensure it remains a symbol of quality and innovation. Thank you for your cooperation.

View File

@ -420,6 +420,7 @@ ubuntu()
clang \
cmake \
curl \
default-jre-headless \
dos2unix \
doxygen \
expect \

View File

@ -17,6 +17,7 @@ RUN apt-get update \
clang \
cmake \
curl \
default-jre-headless \
dos2unix \
doxygen \
expect \

View File

@ -1,8 +1,6 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/rust.git"
branch = "redox-2025-10-03"
# due to heavy git operation, this will only clone once and will not refetch
# if you want to refetch or changing the branch, please run `make ucr.rust`
shallow_clone = true
[build]

View File

@ -0,0 +1,25 @@
From: bjorn3 <17426603+bjorn3@users.noreply.github.com>
Date: Sat, 6 Dec 2025 15:59:20 +0100
Subject: [PATCH] Fix compilation on Redox OS
---
include/urcu/syscall-compat.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/urcu/syscall-compat.h b/include/urcu/syscall-compat.h
index 23b266e..2c3b03f 100644
--- a/include/urcu/syscall-compat.h
+++ b/include/urcu/syscall-compat.h
@@ -33,7 +33,8 @@
#include <syscall.h>
#elif defined(__CYGWIN__) || defined(__APPLE__) || \
- defined(__FreeBSD__) || defined(__DragonFly__)
+ defined(__FreeBSD__) || defined(__DragonFly__) || \
+ defined(__redox__)
/* Don't include anything on these platforms. */
#else
--
2.47.3

View File

@ -1,5 +1,6 @@
#TODO can't configure pthread support
[source]
tar = "https://lttng.org/files/urcu/userspace-rcu-0.14.0.tar.bz2"
patches = ["0001-Fix-compilation-on-Redox-OS.patch"]
[build]
template = "configure"

View File

@ -4,7 +4,7 @@ use cookbook::config::{CookConfig, get_config, init_config};
use cookbook::cook::cook_build::build;
use cookbook::cook::fetch::{fetch, fetch_offline};
use cookbook::cook::fs::{create_target_dir, run_command};
use cookbook::cook::package::{package, package_target};
use cookbook::cook::package::package;
use cookbook::cook::pty::{PtyOut, UnixSlavePty, flush_pty, setup_pty};
use cookbook::cook::script::KILL_ALL_PID;
use cookbook::cook::tree::{WalkTreeEntry, display_tree_entry, format_size, walk_tree_entry};
@ -418,7 +418,8 @@ fn parse_args(args: Vec<String>) -> anyhow::Result<(CliConfig, CliCommand, Vec<C
config.category = Some(PathBuf::from("recipes").join(c));
}
if let Some(c) = config.logs_dir.as_mut() {
fs::create_dir_all(c).map_err(|e| anyhow!(e))?;
fs::create_dir_all(c.join(redoxer::target())).map_err(|e| anyhow!(e))?;
fs::create_dir_all(c.join(redoxer::host_target())).map_err(|e| anyhow!(e))?;
}
if override_filesystem_repo_binary {
if let Some(conf) = config.filesystem.as_mut() {
@ -451,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() {
@ -1007,7 +1009,7 @@ fn run_tui_cook(
let cooker_status_tx = status_tx.clone();
let cooker_prompting = prompting.clone();
let cooker_handle = thread::spawn(move || {
'done: for (recipe, source_dir) in work_rx {
'done: for (mut recipe, source_dir) in work_rx {
let name = recipe.name.clone();
let is_deps = recipe.is_deps;
let (mut stdout_writer, mut stderr_writer) = setup_logger(&cooker_status_tx, &name);
@ -1016,6 +1018,7 @@ fn run_tui_cook(
cooker_status_tx
.send(StatusUpdate::StartCook(name.clone()))
.unwrap();
let _ = recipe.reload_recipe(); // reread recipe.toml in case we're retrying
let handler = handle_cook(
&recipe,
&cooker_config,
@ -1028,8 +1031,7 @@ fn run_tui_cook(
log_to_pty!(&logger, "\n{:?}", err_ctx)
}
flush_pty(&mut logger);
let log_path =
log_path.join(format!("{}/{}.log", package_target(&name), name.name()));
let log_path = log_path.join(format!("{}/{}.log", recipe.target, name.name()));
cooker_status_tx
.send(StatusUpdate::FlushLog(name.clone(), log_path))
.unwrap_or_default();
@ -1113,7 +1115,7 @@ fn run_tui_cook(
let fetcher_config = config.clone();
let fetcher_prompting = prompting.clone();
let fetcher_handle = thread::spawn(move || {
'done: for recipe in fetcher_recipes {
'done: for mut recipe in fetcher_recipes {
let name = recipe.name.clone();
let (mut stdout_writer, mut stderr_writer) = setup_logger(&fetcher_status_tx, &name);
let mut logger = Some((&mut stdout_writer, &mut stderr_writer));
@ -1121,6 +1123,7 @@ fn run_tui_cook(
fetcher_status_tx
.send(StatusUpdate::StartFetch(name.clone()))
.unwrap();
let _ = recipe.reload_recipe(); // reread recipe.toml in case we're retrying
let handler = handle_fetch(&recipe, &fetcher_config, true, &logger);
if let Some(log_path) = fetcher_config.logs_dir.as_ref()
// successful fetch log usually not that helpful
@ -1577,6 +1580,8 @@ fn kill_everything() {
Command::new("bash")
.arg("-c")
.arg(KILL_ALL_PID.replace("$PID", &pid.to_string()))
.stdout(process::Stdio::null())
.stderr(process::Stdio::null())
.spawn()
.expect("unable to spawn kill");
}

View File

@ -1,7 +1,7 @@
use anyhow::anyhow;
use cookbook::WALK_DEPTH;
use cookbook::config::{get_config, init_config};
use cookbook::cook::package::{get_package_name, package_stage_paths, package_target};
use cookbook::cook::package as cook_package;
use cookbook::recipe::CookRecipe;
use pkg::{Package, PackageName, recipes};
use std::collections::{BTreeMap, HashMap};
@ -89,19 +89,16 @@ 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;
};
let target = package_target(recipe);
let target_dir = cookbook_recipe.dir.join("target").join(&target);
let packages = cookbook_recipe.recipe.get_packages_list();
for package in packages {
let (stage_dir, pkgar_src, toml_src) = package_stage_paths(package, &target_dir);
let recipe_name = get_package_name(recipe.name(), package);
let target_dir = cookbook_recipe.target_dir();
for package in cookbook_recipe.recipe.get_packages_list() {
let (stage_dir, pkgar_src, toml_src) =
cook_package::package_stage_paths(package, &target_dir);
let recipe_name = recipe.without_host();
let pkgar_dst = repo_path.join(format!("{}.pkgar", recipe_name));
let toml_dst = repo_path.join(format!("{}.toml", recipe_name));

View File

@ -195,11 +195,7 @@ pub fn build(
build_deps.push(CookRecipe::from_name(dep.clone()).map_err(|e| format!("{:?}", e))?);
}
for dependency in build_deps.iter() {
let pkgar = dependency
.dir
.join("target")
.join(dependency.target)
.join("stage.pkgar");
let (_, pkgar, _) = dependency.stage_paths();
if dependency.name.is_host() {
dep_host_pkgars.insert((dependency.name.clone(), pkgar));
} else {
@ -212,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))
@ -225,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,
@ -252,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);
@ -434,8 +433,14 @@ fn build_deps_dir(
deps_modified: SystemTime,
) -> Result<(), String> {
if deps_dir.is_dir() {
let sysroot_modified = modified_dir(deps_dir)?;
if sysroot_modified < source_modified || sysroot_modified < deps_modified {
let tags_dir = deps_dir.join(".tags");
let sysroot_modified = modified_dir(&tags_dir).unwrap_or(SystemTime::UNIX_EPOCH);
if sysroot_modified < source_modified
|| sysroot_modified < deps_modified
|| dep_pkgars
.iter()
.any(|(pkg, _)| !tags_dir.join(pkg.as_str()).is_file())
{
log_to_pty!(logger, "DEBUG: updating '{}'", deps_dir.display());
remove_all(deps_dir)?;
}
@ -443,20 +448,25 @@ fn build_deps_dir(
if !deps_dir.is_dir() {
// Create sysroot.tmp
create_dir_clean(&deps_dir_tmp)?;
let tags_dir = deps_dir_tmp.join(".tags");
let usr_dir = deps_dir_tmp.join("usr");
create_dir(&tags_dir)?;
create_dir(&usr_dir)?;
// Make sure sysroot/usr exists
create_dir(&deps_dir_tmp.join("usr"))?;
for folder in &["bin", "include", "lib", "share"] {
// Make sure sysroot/usr/$folder exists
create_dir(&deps_dir_tmp.join("usr").join(folder))?;
create_dir(&usr_dir.join(folder))?;
// Link sysroot/$folder sysroot/usr/$folder
symlink(Path::new("usr").join(folder), &deps_dir_tmp.join(folder))?;
}
for (_dep, archive_path) in dep_pkgars {
let public_path = "build/id_ed25519.pub.toml";
pkgar::extract(public_path, &archive_path, deps_dir_tmp.to_str().unwrap()).map_err(
let pkey_path = "build/id_ed25519.pub.toml";
for (name, archive_path) in dep_pkgars {
let tag_file = tags_dir.join(name.without_host().as_str());
fs::write(&tag_file, "")
.map_err(|e| format!("failed to write tag file {}: {:?}", tag_file.display(), e))?;
pkgar::extract(pkey_path, &archive_path, deps_dir_tmp.to_str().unwrap()).map_err(
|err| {
format!(
"failed to install '{}' in '{}': {:?}",

View File

@ -162,15 +162,16 @@ pub fn fetch(recipe_dir: &Path, recipe: &Recipe, logger: &PtyOut) -> Result<Path
command.arg("--branch").arg(branch);
}
if shallow_clone {
command.arg("--depth").arg("1").arg("--shallow-submodules");
command
.arg("--filter=tree:0")
.arg("--also-filter-submodules");
}
command.arg(&source_dir_tmp);
run_command(command, logger)?;
// Move source.tmp to source atomically
rename(&source_dir_tmp, &source_dir)?;
} else if !shallow_clone {
// Don't let this code reset the origin for the cookbook repo
} else {
let source_git_dir = source_dir.join(".git");
if !source_git_dir.is_dir() {
return Err(format!(
@ -205,7 +206,14 @@ pub fn fetch(recipe_dir: &Path, recipe: &Recipe, logger: &PtyOut) -> Result<Path
command.arg("-C").arg(&source_dir);
command.arg("checkout").arg(rev);
run_command(command, logger)?;
} else if !shallow_clone && !is_redox() {
} else if !is_redox() {
//If patches exists, we have to drop it
if patches.len() > 0 {
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command.arg("reset").arg("--hard");
run_command(command, logger)?;
}
//TODO: complicated stuff to check and reset branch to origin
//TODO: redox can't undestand this (got exit status 1)
let mut command = Command::new("bash");
@ -225,23 +233,25 @@ pub fn fetch(recipe_dir: &Path, recipe: &Recipe, logger: &PtyOut) -> Result<Path
run_command(command, logger)?;
}
if !shallow_clone {
// Sync submodules URL
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command.arg("submodule").arg("sync").arg("--recursive");
run_command(command, logger)?;
// Sync submodules URL
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command.arg("submodule").arg("sync").arg("--recursive");
// Update submodules
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command
.arg("submodule")
.arg("update")
.arg("--init")
.arg("--recursive");
run_command(command, logger)?;
run_command(command, logger)?;
// Update submodules
let mut command = Command::new("git");
command.arg("-C").arg(&source_dir);
command
.arg("submodule")
.arg("update")
.arg("--init")
.arg("--recursive");
if shallow_clone {
command.arg("--filter=tree:0");
}
run_command(command, logger)?;
fetch_apply_patches(recipe_dir, patches, script, &source_dir, logger)?;
}

View File

@ -94,7 +94,6 @@ fn move_dir_all_inner_fn<'a>(
for (src, srcrel, dst) in files {
let path = dst.join(&srcrel);
fs::create_dir_all(&path.parent().unwrap())?;
println!("{:?} -> {:?}", src.display(), path.display());
std::fs::rename(&src, &path)?;
}
Ok(())

View File

@ -150,12 +150,7 @@ pub fn package_toml(
};
let package = Package {
name: PackageName::new(if name.is_host() {
&name.as_str()["host:".len()..]
} else {
name.as_str()
})
.unwrap(),
name: name.without_host(),
version: package_version(recipe),
target: package_target(name).to_string(),
blake3: hash,

View File

@ -4,10 +4,10 @@ use std::{
path::PathBuf,
};
use anyhow::{Context, anyhow};
use anyhow::Context;
use pkg::{Package, PackageName};
use crate::{cook::fs::create_target_dir, recipe::CookRecipe};
use crate::recipe::CookRecipe;
pub enum WalkTreeEntry<'a> {
Built(&'a PathBuf, u64),
@ -53,10 +53,7 @@ pub fn walk_tree_entry(
}
};
let package_dir = &cook_recipe.dir;
let target_dir = create_target_dir(package_dir, redoxer::target()).map_err(|e| anyhow!(e))?;
let pkg_path = target_dir.join("stage.pkgar");
let pkg_toml = target_dir.join("stage.toml");
let (_, pkg_path, pkg_toml) = cook_recipe.stage_paths();
let deduped = visited.contains(package_name);
let entry = match (std::fs::metadata(&pkg_path), deduped) {

View File

@ -12,7 +12,7 @@ use serde::{
de::{Error as DeErrorT, value::Error as DeError},
};
use crate::{WALK_DEPTH, cook::package::package_target};
use crate::{WALK_DEPTH, cook::package as cook_package};
/// Specifies how to download the source for a recipe
#[derive(Debug, Clone, Deserialize, PartialEq, Serialize)]
@ -43,8 +43,7 @@ pub enum SourceRecipe {
/// The optional revision of the git repository to use for builds. Please specify for
/// reproducible builds
rev: Option<String>,
/// The optional config to run as shallow fetch. Only use this for heavy git like "rust"
/// This will disable recipe autofetching because of its cost on git server
/// The optional config to clone with treeless clone. Default is true if "rev" added
shallow_clone: Option<bool>,
/// A list of patch files to apply to the source
#[serde(default)]
@ -226,14 +225,14 @@ impl Recipe {
impl CookRecipe {
pub fn new(name: PackageName, dir: PathBuf, mut recipe: Recipe) -> Result<Self, PackageError> {
let target = package_target(&name);
let target = cook_package::package_target(&name);
if name.is_host() {
let thisname = name.name();
let fn_map = |p: PackageName| {
if p.is_host() {
if p.name() == thisname { None } else { Some(p) }
} else {
Some(PackageName::new(format!("host:{}", p.as_str())).unwrap())
Some(p.with_host())
}
};
recipe.build.dependencies = recipe
@ -266,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 {
@ -416,6 +418,25 @@ impl CookRecipe {
Ok(packages.into_iter().map(|p| p.name).collect())
}
pub fn reload_recipe(&mut self) -> Result<(), PackageError> {
let r = Self::from_path(&self.dir, true, self.name.is_host())?;
self.recipe = r.recipe;
Ok(())
}
/// returns stage dir, pkgar file and toml file.
pub fn stage_paths(&self) -> (PathBuf, PathBuf, PathBuf) {
let r = self.name.suffix().map(|p| OptionalPackageRecipe {
name: p.to_string(),
..Default::default()
});
cook_package::package_stage_paths(r.as_ref(), &self.target_dir())
}
pub fn target_dir(&self) -> PathBuf {
self.dir.join("target").join(self.target)
}
}
#[derive(Serialize, Deserialize)]
@ -449,12 +470,9 @@ mod tests {
Recipe {
source: Some(SourceRecipe::Git {
git: "https://gitlab.redox-os.org/redox-os/acid.git".to_string(),
upstream: None,
branch: Some("master".to_string()),
rev: Some("06344744d3d55a5ac9a62a6059cb363d40699bbc".to_string()),
patches: Vec::new(),
script: None,
shallow_clone: None,
..Default::default()
}),
build: BuildRecipe::new(BuildKind::Cargo {
package_path: None,