From 7919fc54a5782a2f6e1d57355430d23847c52a51 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Fri, 21 Nov 2025 00:39:42 -0800 Subject: [PATCH] Remove repo.sh scripts --- config.sh | 63 ----------------------------------------- mk/ci.mk | 2 +- mk/config.mk | 12 ++------ mk/repo.mk | 6 ++-- repo.sh | 27 ------------------ src/bin/repo.rs | 11 ++++--- src/bin/repo_builder.rs | 2 +- 7 files changed, 14 insertions(+), 109 deletions(-) delete mode 100755 config.sh delete mode 100755 repo.sh diff --git a/config.sh b/config.sh deleted file mode 100755 index 9806b8ccf..000000000 --- a/config.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Configuration -if [ -z "${TARGET}" ] -then - export TARGET=x86_64-unknown-redox -fi -if [ $(uname -s) = 'Redox' ] -then - export IS_REDOX="1" -fi - -ARCH="${TARGET%%-*}" -HOST="$TARGET" -if [ x"${HOST}" == x"riscv64gc-unknown-redox" ] ; then - HOST="riscv64-unknown-redox" -fi - -# Cookbook requires correct CWD to work -cd `dirname "$0"` - -# Automatic variables -ROOT=`pwd` - -export AR="${HOST}-gcc-ar" -export AS="${HOST}-as" -export CC="${HOST}-gcc" -export CXX="${HOST}-g++" -export LD="${HOST}-ld" -export NM="${HOST}-gcc-nm" -export OBJCOPY="${HOST}-objcopy" -export OBJDUMP="${HOST}-objdump" -export PKG_CONFIG="${HOST}-pkg-config" -export RANLIB="${HOST}-gcc-ranlib" -export READELF="${HOST}-readelf" -export STRIP="${HOST}-strip" - -if [ -n "${CC_WRAPPER}" ] -then - export CC="${CC_WRAPPER} ${CC}" - export CXX="${CC_WRAPPER} ${CXX}" -fi - -BUILD="$(cc -dumpmachine)" - -export PKG_CONFIG_FOR_BUILD="pkg-config" - -if [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "FreeBSD" ]]; then - # GNU find - FIND="gfind"; -else - FIND="find"; -fi - -export FIND - -if [ -z "${IS_REDOX}" ] -then -function repo { - "$ROOT/target/release/repo" "$@" -} -fi diff --git a/mk/ci.mk b/mk/ci.mk index e150b8003..e1faf617f 100644 --- a/mk/ci.mk +++ b/mk/ci.mk @@ -28,7 +28,7 @@ ifeq ($(PODMAN_BUILD),1) else $(HOST_CARGO) build --manifest-path Cargo.toml --release export CI=1 COOKBOOK_LOGS=true PATH="$(PREFIX_PATH):$$PATH" COOKBOOK_HOST_SYSROOT="$(ROOT)/$(PREFIX_INSTALL)" && \ - ./repo.sh $(REPO_APPSTREAM) $(REPO_NONSTOP) --with-package-deps "--filesystem=config/$(ARCH)/ci.toml" + ./target/release/repo cook --with-package-deps "--filesystem=config/$(ARCH)/ci.toml" endif # CI toolchain diff --git a/mk/config.mk b/mk/config.mk index 5f6742e3e..b816271f0 100644 --- a/mk/config.mk +++ b/mk/config.mk @@ -78,19 +78,13 @@ endif endif ifeq ($(REPO_APPSTREAM),1) - REPO_APPSTREAM=--appstream -else ifeq ($(REPO_APPSTREAM),0) - REPO_APPSTREAM= + export COOKBOOK_APPSTREAM="1" endif ifeq ($(REPO_NONSTOP),1) - REPO_NONSTOP=--nonstop -else ifeq ($(REPO_NONSTOP),0) - REPO_NONSTOP= + export COOKBOOK_NONSTOP=true endif ifeq ($(REPO_OFFLINE),1) - REPO_OFFLINE=--offline -else ifeq ($(REPO_OFFLINE),0) - REPO_OFFLINE= + export COOKBOOK_OFFLINE=true endif ifeq ($(REPO_DEBUG),1) export COOKBOOK_NOSTRIP=true diff --git a/mk/repo.mk b/mk/repo.mk index 2a105bef0..df04615f0 100644 --- a/mk/repo.mk +++ b/mk/repo.mk @@ -6,7 +6,7 @@ ifeq ($(PODMAN_BUILD),1) else export PATH="$(PREFIX_PATH):$$PATH" && \ export COOKBOOK_HOST_SYSROOT="$(ROOT)/$(PREFIX_INSTALL)" && \ - ./repo.sh $(REPO_APPSTREAM) $(REPO_NONSTOP) $(REPO_OFFLINE) $(COOKBOOK_OPTS) --with-package-deps + ./target/release/repo cook $(COOKBOOK_OPTS) --with-package-deps mkdir -p $(BUILD) touch $@ endif @@ -54,7 +54,7 @@ ifeq ($(PODMAN_BUILD),1) else export PATH="$(PREFIX_PATH):$$PATH" && \ export COOKBOOK_HOST_SYSROOT="$(ROOT)/$(PREFIX_INSTALL)" && \ - ./repo.sh $(REPO_OFFLINE) $(foreach f,$(subst $(comma), ,$*),$(f)) $(COOKBOOK_OPTS) + ./target/release/repo cook $(foreach f,$(subst $(comma), ,$*),$(f)) $(COOKBOOK_OPTS) endif MOUNTED_TAG=$(MOUNT_DIR)~ @@ -70,7 +70,6 @@ else $(MAKE) mount; \ touch $(MOUNTED_TAG); \ fi - $(if $(findstring nonstop,$(REPO_NONSTOP)),export COOKBOOK_NONSTOP=true && ,) \ ./target/release/repo push $(foreach f,$(subst $(comma), ,$*),$(f)) "--sysroot=$(MOUNT_DIR)" @if [ -f $(MOUNTED_TAG) ]; then \ $(MAKE) unmount && rm -f $(MOUNTED_TAG); \ @@ -92,7 +91,6 @@ else $(MAKE) mount; \ touch $(MOUNTED_TAG); \ fi - $(if $(findstring nonstop,$(REPO_NONSTOP)),export COOKBOOK_NONSTOP=true && ,) \ ./target/release/repo push $(COOKBOOK_OPTS) --with-package-deps "--sysroot=$(MOUNT_DIR)" @if [ -f $(MOUNTED_TAG) ]; then \ $(MAKE) unmount && rm -f $(MOUNTED_TAG); \ diff --git a/repo.sh b/repo.sh deleted file mode 100755 index ab6ea895c..000000000 --- a/repo.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -e - -source `dirname "$0"`/config.sh - -COOK_OPT="" -recipes="" -for arg in "${@:1}" -do - if [[ "$arg" == "--appstream" ]] - then - export APPSTREAM="1" - elif [[ "$arg" == "--offline" ]] - then - export COOKBOOK_OFFLINE=true - elif [[ "$arg" == "--nonstop" ]] - then - export COOKBOOK_NONSTOP=true - elif [[ $arg == "--*" ]] - then - COOK_OPT+=" ${arg}" - else - recipes+=" $arg" - fi -done - -repo cook $COOK_OPT $recipes diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 429d23222..b3f09a226 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -65,6 +65,7 @@ const REPO_HELP_STR: &str = r#" CI= set to any value to disable TUI COOKBOOK_LOGS= whether to capture build logs (default is !CI) COOKBOOK_OFFLINE=false prevent internet access if possible + ignored when command "fetch" is used COOKBOOK_NONSTOP=false pkeep running even a recipe build failed COOKBOOK_VERBOSE=true print success/error on each recipe COOKBOOK_MAKE_JOBS= override build jobs count from nproc @@ -277,8 +278,9 @@ fn repo_inner( Ok(match *command { CliCommand::Fetch | CliCommand::Cook => { let repo_inner_fn = move |logger: &PtyOut| -> Result<(), anyhow::Error> { - let source_dir = handle_fetch(recipe, config, logger)?; - if *command == CliCommand::Cook { + let is_cook = *command == CliCommand::Cook; + let source_dir = handle_fetch(recipe, config, is_cook, logger)?; + if is_cook { handle_cook(recipe, config, source_dir, recipe.is_deps, logger)?; } Ok(()) @@ -534,10 +536,11 @@ fn parse_args(args: Vec) -> anyhow::Result<(CliConfig, CliCommand, Vec anyhow::Result { let recipe_dir = &recipe.dir; - let source_dir = match config.cook.offline { + let source_dir = match config.cook.offline && allow_offline { true => fetch_offline(recipe_dir, &recipe.recipe, logger), false => fetch(recipe_dir, &recipe.recipe, logger), } @@ -1102,7 +1105,7 @@ fn run_tui_cook( fetcher_status_tx .send(StatusUpdate::StartFetch(name.clone())) .unwrap(); - let handler = handle_fetch(&recipe, &fetcher_config, &logger); + 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 && handler.is_err() diff --git a/src/bin/repo_builder.rs b/src/bin/repo_builder.rs index 400391bd5..e50073d55 100644 --- a/src/bin/repo_builder.rs +++ b/src/bin/repo_builder.rs @@ -90,7 +90,7 @@ fn publish_packages(recipe_list: Vec, repo_dir: String) -> anyhow::Resul } // === 2. Optional AppStream generation === - if env::var("APPSTREAM").ok().as_deref() == Some("1") { + if env::var("COOKBOOK_APPSTREAM").ok().as_deref() == Some("1") { eprintln!("\x1b[01;38;5;155mrepo - generating appstream data\x1b[0m"); let root = env::var("ROOT").unwrap_or_else(|_| ".".into());