mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-07-03 10:08:45 +08:00
Add a script for relibc documentation
This commit is contained in:
parent
1b80fb4b48
commit
257d0211dc
@ -236,12 +236,11 @@ ucrp.%: $(FSTOOLS_TAG) FORCE
|
||||
$(MAKE) ucr.$*,--with-package-deps
|
||||
$(MAKE) p.$*
|
||||
|
||||
ifeq ($(HOSTED_REDOX),1)
|
||||
DESTDIR?=/
|
||||
|
||||
# Install all recipes specified by the filesystem config
|
||||
install:
|
||||
$(REPO_BIN) push $(COOKBOOK_OPTS) --with-package-deps "--sysroot=$(DESTDIR)"
|
||||
$(REPO_BIN) push $(COOKBOOK_OPTS) --no-metadata --with-package-deps "--sysroot=$(DESTDIR)"
|
||||
|
||||
# Rebuild and install all recipes specified by the filesystem config
|
||||
rebuild-install: $(FSTOOLS_TAG) FORCE
|
||||
@ -250,7 +249,7 @@ rebuild-install: $(FSTOOLS_TAG) FORCE
|
||||
$(MAKE) install
|
||||
|
||||
i.%: $(FSTOOLS_TAG) FORCE
|
||||
$(REPO_BIN) push $(COOKBOOK_OPTS) --with-package-deps "--sysroot=$(DESTDIR)"
|
||||
$(REPO_BIN) push $* $(COOKBOOK_OPTS) --no-metadata --with-package-deps "--sysroot=$(DESTDIR)"
|
||||
|
||||
# Invoke rebuild and install for one of more targets separated by comma
|
||||
ri.%: $(FSTOOLS_TAG) FORCE
|
||||
@ -266,7 +265,6 @@ cri.%: $(FSTOOLS_TAG) FORCE
|
||||
ucri.%: $(FSTOOLS_TAG) FORCE
|
||||
$(MAKE) ucr.$*,--with-package-deps
|
||||
$(MAKE) i.$*
|
||||
endif
|
||||
|
||||
# Set recipe rule to "binary" then invoke clean
|
||||
bc.%: $(FSTOOLS_TAG) FORCE
|
||||
|
||||
14
recipes/other/relibc-doc/recipe.toml
Normal file
14
recipes/other/relibc-doc/recipe.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[source]
|
||||
same_as = "../../core/relibc"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
cd "${COOKBOOK_SOURCE}${COOKBOOK_CARGO_PATH:+/$COOKBOOK_CARGO_PATH}"
|
||||
export RUSTDOCFLAGS="--enable-index-page -Zunstable-options"
|
||||
"${COOKBOOK_CARGO}" doc \
|
||||
--target-dir "${COOKBOOK_BUILD}" --no-deps \
|
||||
-j "${COOKBOOK_MAKE_JOBS}" ${COOKBOOK_CARGO_FLAGS[@]}
|
||||
mkdir -p "${COOKBOOK_STAGE}/usr/share/doc/relibc"
|
||||
cp -rv "${COOKBOOK_BUILD}/${TARGET}/doc"/* "${COOKBOOK_STAGE}/usr/share/doc/relibc/"
|
||||
"""
|
||||
7
scripts/relibc-doc.sh
Executable file
7
scripts/relibc-doc.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script generates build/relibc-doc and build/relibc-doc.tar.gz
|
||||
|
||||
rm -rf build/relibc-doc build/relibc-doc.tar.gz
|
||||
make ri.relibc-doc DESTDIR=./build/relibc-doc
|
||||
tar -czvf ./build/relibc-doc.tar.gz ./build/relibc-doc/usr/share/doc/relibc/
|
||||
@ -68,6 +68,7 @@ const REPO_HELP_STR: &str = r#"
|
||||
--filesystem=<filesystem> override recipes config using installer file
|
||||
--repo-binary override recipes config to use repo_binary
|
||||
--sysroot=<sysroot_dir> used in "push", the "root" dir, default to $PWD/sysroot
|
||||
--no-metadata used in "push", do not write pkgar_head or etc dir
|
||||
--set-rule=<rule> used in "change-rule", set wanted config rule
|
||||
--rollback used in "capture-rev", allow git to rollback
|
||||
--unset used in "capture-rev" and "change-rule", unset locks
|
||||
@ -97,6 +98,7 @@ struct CliConfig {
|
||||
filesystem: Option<redox_installer::Config>,
|
||||
set_rule: Option<String>,
|
||||
unset: bool,
|
||||
no_metadata: bool,
|
||||
with_rollback: bool,
|
||||
with_package_deps: bool,
|
||||
all: bool,
|
||||
@ -200,6 +202,7 @@ impl CliConfig {
|
||||
cook: get_config().cook.clone(),
|
||||
all: false,
|
||||
unset: false,
|
||||
no_metadata: false,
|
||||
filesystem: None,
|
||||
with_rollback: false,
|
||||
set_rule: None,
|
||||
@ -474,6 +477,7 @@ fn parse_args(args: Vec<String>) -> Result<(CliConfig, CliCommand, Vec<CookRecip
|
||||
match arg.as_str() {
|
||||
"--repo-binary" => override_filesystem_repo_binary = true,
|
||||
"--with-package-deps" => config.with_package_deps = true,
|
||||
"--no-metadata" => config.no_metadata = true,
|
||||
"--rollback" => config.with_rollback = true,
|
||||
"--unset" => config.unset = true,
|
||||
"--all" => config.all = true,
|
||||
@ -855,7 +859,7 @@ fn handle_clean(recipe: &CookRecipe, _config: &CliConfig, command: &CliCommand)
|
||||
Ok(cached)
|
||||
}
|
||||
|
||||
static PUSH_SYSROOT_DIR: OnceLock<PathBuf> = OnceLock::new();
|
||||
static PUSH_CONFIG: OnceLock<CliConfig> = OnceLock::new();
|
||||
fn handle_push(recipes: &Vec<CookRecipe>, config: &CliConfig) -> Result<()> {
|
||||
let recipe_map: HashMap<&PackageName, &CookRecipe> =
|
||||
recipes.iter().map(|r| (&r.name, r)).collect();
|
||||
@ -863,7 +867,9 @@ fn handle_push(recipes: &Vec<CookRecipe>, config: &CliConfig) -> Result<()> {
|
||||
let mut total_count: u64 = 0;
|
||||
let mut visited: HashSet<PackageName> = HashSet::new();
|
||||
let num_recipes = recipes.len();
|
||||
PUSH_SYSROOT_DIR.set(config.sysroot_dir.clone()).unwrap();
|
||||
PUSH_CONFIG
|
||||
.set(config.clone())
|
||||
.unwrap_or_else(|_| panic!("PUSH_CONFIG is initialized"));
|
||||
let handle_push_inner = move |package_name: &PackageName,
|
||||
_prefix: &str,
|
||||
_is_last: bool,
|
||||
@ -874,11 +880,17 @@ fn handle_push(recipes: &Vec<CookRecipe>, config: &CliConfig) -> Result<()> {
|
||||
}
|
||||
let r = match entry {
|
||||
WalkTreeEntry::Built(archive_path, _) => {
|
||||
let install_path = PUSH_SYSROOT_DIR.get().unwrap();
|
||||
let mut state = PackageState::from_sysroot(install_path).map_err(Error::from)?;
|
||||
let r = package_handle_push(&mut state, archive_path, &install_path, false);
|
||||
if matches!(r, Ok(false)) {
|
||||
let config = PUSH_CONFIG.get().unwrap();
|
||||
let install_path = &config.sysroot_dir;
|
||||
let mut state = if !config.no_metadata {
|
||||
Some(PackageState::from_sysroot(&install_path).map_err(Error::from)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let r = package_handle_push(state.as_mut(), archive_path, &install_path);
|
||||
if matches!(r, Ok(false)) && state.is_some() {
|
||||
state
|
||||
.unwrap()
|
||||
.to_sysroot(install_path)
|
||||
.map_err(|e| Error::from_io_error(e, "Extracting package"))?;
|
||||
}
|
||||
|
||||
@ -244,18 +244,26 @@ fn get_package_name_inner(name: &str, package: Option<&str>) -> String {
|
||||
}
|
||||
|
||||
pub fn package_handle_push(
|
||||
state: &mut PackageState,
|
||||
state: Option<&mut PackageState>,
|
||||
archive_path: &Path,
|
||||
sysroot_dir: &Path,
|
||||
reinstall: bool,
|
||||
) -> crate::Result<bool> {
|
||||
let archive_toml = archive_path.with_extension("toml");
|
||||
let pkey_path = "build/id_ed25519.pub.toml";
|
||||
let pkg_toml = Package::from_file(&archive_toml)?;
|
||||
// "local" is what remote name from installer is hardcoded into
|
||||
let remote_name = "local".to_string();
|
||||
let Some(state) = state else {
|
||||
// Bare install without metadata, cache mechanism or anything
|
||||
if archive_path.is_file() {
|
||||
let pkey = PublicKeyFile::open(pkey_path)?.pkey;
|
||||
let mut package = PackageFile::new(archive_path, &pkey)?;
|
||||
Transaction::install(&mut package, sysroot_dir)?.commit()?;
|
||||
}
|
||||
return Ok(false);
|
||||
};
|
||||
let (cached, pstate) = match state.installed.get(&pkg_toml.name) {
|
||||
Some(s) if !reinstall && pkg_toml.blake3 == s.blake3 => (true, None),
|
||||
Some(s) if pkg_toml.blake3 == s.blake3 => (true, None),
|
||||
Some(s) => (false, Some((s.manual, s.dependents.clone()))),
|
||||
None => {
|
||||
// TODO: Handle manual & dependents
|
||||
@ -272,6 +280,10 @@ pub fn package_handle_push(
|
||||
"var/lib/packages/{}.pkgar_head",
|
||||
pkg_toml.name.as_str()
|
||||
));
|
||||
let head_parent = head_path.parent();
|
||||
if head_parent.is_some_and(|s| !s.is_dir()) {
|
||||
create_dir(head_parent.unwrap())?;
|
||||
}
|
||||
package.split(&head_path, None::<&Path>)?;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user