diff --git a/mk/repo.mk b/mk/repo.mk index 7dc9ff807..71ce48477 100644 --- a/mk/repo.mk +++ b/mk/repo.mk @@ -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 diff --git a/recipes/other/relibc-doc/recipe.toml b/recipes/other/relibc-doc/recipe.toml new file mode 100644 index 000000000..018bfc3ea --- /dev/null +++ b/recipes/other/relibc-doc/recipe.toml @@ -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/" +""" diff --git a/scripts/relibc-doc.sh b/scripts/relibc-doc.sh new file mode 100755 index 000000000..dda8b1cdf --- /dev/null +++ b/scripts/relibc-doc.sh @@ -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/ diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 39901f8e5..7a772c483 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -68,6 +68,7 @@ const REPO_HELP_STR: &str = r#" --filesystem= override recipes config using installer file --repo-binary override recipes config to use repo_binary --sysroot= 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= 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, set_rule: Option, 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) -> Result<(CliConfig, CliCommand, Vec 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 = OnceLock::new(); +static PUSH_CONFIG: OnceLock = OnceLock::new(); fn handle_push(recipes: &Vec, 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, config: &CliConfig) -> Result<()> { let mut total_count: u64 = 0; let mut visited: HashSet = 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, 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"))?; } diff --git a/src/cook/package.rs b/src/cook/package.rs index 4d43e5724..e11d639ec 100644 --- a/src/cook/package.rs +++ b/src/cook/package.rs @@ -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 { 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>)?; }