mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-07-02 17:48:42 +08:00
Compare commits
22 Commits
359cd577a8
...
9420719f6f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9420719f6f | ||
|
|
8cb5fa2ddf | ||
|
|
27e35f645f | ||
|
|
e3807caa84 | ||
|
|
d168414747 | ||
|
|
ea5182e6ce | ||
|
|
fce4236e9a | ||
|
|
bf6da7ccf9 | ||
|
|
96d2d5dfe7 | ||
|
|
3ae5da8d13 | ||
|
|
d9af4e385a | ||
|
|
f66a09637f | ||
|
|
6c95928280 | ||
|
|
e5b00a16e7 | ||
|
|
5d0367f6ab | ||
|
|
99f61754b3 | ||
|
|
a8452a20c4 | ||
|
|
d461f47aee | ||
|
|
d6fd1b3207 | ||
|
|
38e1927bff | ||
|
|
0134ba2e87 | ||
|
|
3e3c26203b |
@ -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
6
Cargo.lock
generated
@ -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
39
TRADEMARK.md
Normal 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 logo’s 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.
|
||||
@ -420,6 +420,7 @@ ubuntu()
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
default-jre-headless \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
expect \
|
||||
|
||||
@ -17,6 +17,7 @@ RUN apt-get update \
|
||||
clang \
|
||||
cmake \
|
||||
curl \
|
||||
default-jre-headless \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
expect \
|
||||
|
||||
@ -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]
|
||||
|
||||
25
recipes/libs/liburcu/0001-Fix-compilation-on-Redox-OS.patch
Normal file
25
recipes/libs/liburcu/0001-Fix-compilation-on-Redox-OS.patch
Normal 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
|
||||
|
||||
@ -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"
|
||||
@ -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");
|
||||
}
|
||||
|
||||
@ -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));
|
||||
|
||||
|
||||
@ -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 '{}': {:?}",
|
||||
|
||||
@ -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)?;
|
||||
}
|
||||
|
||||
@ -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(())
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user