From: Thomas Walker Lynch Date: Thu, 16 Oct 2025 14:41:55 +0000 (+0000) Subject: build environment intermediate, to be updated X-Git-Url: https://git.reasoningtechnology.com/style/static/gitweb.js?a=commitdiff_plain;h=54baf28498f28ebf4f4319f82f94f88786793816;p=Harmony.git build environment intermediate, to be updated --- diff --git a/developer/.githolder b/developer/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/developer/cc/.githolder b/developer/cc/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/developer/cc/hello.cli.c b/developer/cc/hello.cli.c new file mode 100644 index 0000000..a626cac --- /dev/null +++ b/developer/cc/hello.cli.c @@ -0,0 +1,2 @@ +#include +int main(void){ puts("hello from Rabbit CLI"); return 0; } diff --git a/developer/machine/.githolder b/developer/machine/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/developer/scratchpad/.gitignore b/developer/scratchpad/.gitignore new file mode 100644 index 0000000..120f485 --- /dev/null +++ b/developer/scratchpad/.gitignore @@ -0,0 +1,2 @@ +* +!/.gitignore diff --git a/developer/tool/env b/developer/tool/env new file mode 100644 index 0000000..0b993ad --- /dev/null +++ b/developer/tool/env @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + diff --git a/developer/tool/make b/developer/tool/make new file mode 100755 index 0000000..dbd1f15 --- /dev/null +++ b/developer/tool/make @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +set -e +set -x + + cd "$REPO_HOME"/developer || exit 1 + /bin/make -f tool/makefile $@ + +set +x +echo "$(script_fn) done." diff --git a/developer/tool/makefile b/developer/tool/makefile new file mode 100644 index 0000000..9a068f3 --- /dev/null +++ b/developer/tool/makefile @@ -0,0 +1,19 @@ + +RT_project_share:=$(REPO_HOME)/tool_shared/third_party/RT-project-share/release + +include $(RT_project_share)/make/environment_RT_0 + +# To compile the example directory uncomment the following assignments: +SRCDIR_List=cc +CFLAGS+=-Icc + +CFLAGS+= -include "$(RT_project_share)/make/RT_0.h" +LINKFLAGS+= -l$(PROJECT) +LIBFILE=$(LIBDIR)/lib$(PROJECT).a + +include $(RT_project_share)/make/targets_developer +-include $(DEPFILE) + +# shared targets +.PHONY: clean +clean: _clean_developer diff --git a/developer/tool/release b/developer/tool/release new file mode 100755 index 0000000..582c84c --- /dev/null +++ b/developer/tool/release @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# before running this, make library is built and is in the scratchpad directory + +# input guards + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + + cd "$REPO_HOME"/developer || exit 1 + + if [ ! -d scratchpad ]; then + echo "$(script_fp):: no scratchpad directory" + exit 1 + fi + +#set -e +#set -x + + release_dir=$(release_dir) + mkdir -p ${release_dir} + + install_file scratchpad/libN.a ${release_dir} "ug+r" || true + install_file cc/*.lib.c ${release_dir} "ug+r" || true + install_file cc/*.lib.c ${release_dir} "ug+r" || true + +#set +x +echo "$(script_fn) done." + diff --git a/developer/tool/release_clean b/developer/tool/release_clean new file mode 100755 index 0000000..fc09a13 --- /dev/null +++ b/developer/tool/release_clean @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# before running this, make library is built and is in the scratchpad directory + +# input guards + + env_must_be="developer/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +set -e +set -x + + cd "$REPO_HOME"/developer || exit 1 + + release_dir=$(release_dir) + + if [ ! -d ${release_dir} ]; then + echo "$(script_fp):: no release directory: " ${release_dir} + exit 1 + fi + + rm_na -rf ${release_dir}/* + +set +x +echo "$(script_fn) done." + diff --git a/document/Harmony_isntall.sh b/document/Harmony_isntall.sh new file mode 100644 index 0000000..834e30d --- /dev/null +++ b/document/Harmony_isntall.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# template for script for creating a new project based on the Harmony skeleton +set -x + +# Edit and set these variables +# + # 1. URL or path of Harmony skeleton + harmony_repo_url="" + + # 2. project name + project_dname="" + + initial_commit_message="Initial commit derived from the Harmony skeleton" + +# Creates the project +# + git clone "$harmony_repo_url" "$project_dname" + if [ $? -ne 0 ]; then + echo "ERROR: Cloning failed. Check harmony_repo_url." + exit 1 + fi + cd "$project_dname" + + # Discard Harmony version history + rm -rf .git + git init + + # Set the default branch name + git checkout -b core_developer_branch + +# Initial Commit +# + git add . + git commit -m "$initial_commit_message" diff --git a/document/authored_files.org b/document/authored_files.org new file mode 100644 index 0000000..33fd304 --- /dev/null +++ b/document/authored_files.org @@ -0,0 +1,30 @@ + +1. Authored + + An authored file is one that is not to be edited by build scripts. Scripts should + treat them as read only. + + An authored directory is one where the contained files in the directory subtree + are considered to be authored files. + +2. First implementation now deprecated. + + Authored directories had a `🖉` character as the last character of their names. + + Files were considered to be authored if they were in an authored directory, or anywhere + in its subtree. Or if the file name had a `🖉` character as the last character of its name. + + Then the `rm_na` command was used in scripts. This version of `rm` would refuse to delete authored files. + + This approach had two drawbacks. Some tools still have difficulty with such Unicode characters, and many keyboard entry interfaces and editors provide no means for entering them. Secondly, `rm_na` does not enforce read-only semantics, rather it merely prevents deletion. + + As a result, the pencil characters and `rm_na` have been removed from the RT workflow. + +3. Status quo + + Read-only authored directories and files are planned to come back through another implementation, see point 4. In the meantime, we keep them as a contract with developers. Document, source, and executable directories are authored. Script driven synthesis and editing work is done in the `scratchpad` directories. The `scratchpad` directory contents is gitignored. + +4. The planned implementation. + + When the `subu` system reaches a production version, it will be used to create a sub user for the developer called 'builder'. The developer can then set file permissions for builder. + diff --git a/document/developer_buils_environment.org b/document/developer_buils_environment.org new file mode 100644 index 0000000..a882618 --- /dev/null +++ b/document/developer_buils_environment.org @@ -0,0 +1,146 @@ +#+TITLE: RT Harmony Build Environment (Orchestrator + Roles: lib_cli, kmod) +#+OPTIONS: toc:nil + +* 0. Scope +A concise contract for building user-space artifacts (static libraries + CLI executables) and Linux kernel modules (out-of-tree, *.ko) in one repo without target collisions. The design keeps authored sources read-only, writes artifacts to scratchpad, and exposes a small, stable public interface via an orchestrator Makefile. + +* 1. Core Principles +1.1 Minimize complexity (YAGNI). Prefer one happy path; add branches only when mandated. +1.2 Variable-driven config: the project declares *what* to build; role files define *how*. +1.3 Automatic discovery: detect work by suffix/patterns—~*.lib.c~, ~*.cli.c~, ~*.mod.c~—never hard-code basenames. +1.4 Authored sources are read-only to scripts; all synthesis happens in ~scratchpad/~. +1.5 Roles are independent and reusable; orchestration is done by separate ~make -f~ calls. + +* 2. Repo Layout & Authority +2.1 =REPO_HOME= is exported by the environment and is the **authoritative project root**. Never recompute or override it in Makefiles. +2.2 Invoke the build from =$REPO_HOME/developer=. +2.3 Shared includes live under: + =$(REPO_HOME)/tool_shared/third_party/RT-project-share/release/make/= + (project-vendored RT-project-share). +2.4 Directory semantics: + - =developer/cc/= **authored** C sources (read-only to scripts). + - =scratchpad/= **SCRATCHPAD** (intermediates, depfiles, kbuild outputs). Git-ignored. + - =machine/= released executables (version-controlled). Prefer arch suffix in names. + +* 3. Roles & Files +3.1 Orchestrator (project-local): =developer/tool/makefile= + - Public targets: ~all~, ~lib_cli~, ~kmod~, ~clean~ (~usage~ optional; ~all~ is first). + - Includes =environment_RT_1.mk= and invokes role files via ~make -f~. +3.2 Role: user-space build → =target_lib_cli.mk= (shared; under RT-project-share) + - Builds static lib from ~*.lib.c~ and CLI executables from ~*.cli.c~. + - Public targets: ~library~, ~cli~, ~clean~. ~cli~ depends on ~library~. +3.3 Role: kernel modules → =targets_kmod.mk= (shared; under RT-project-share) + - Builds out-of-tree modules (.ko) from ~*.mod.c~ using Kbuild. + - Public targets: ~kmod~, ~clean~. + +* 4. Public-Target Orchestration (strict) +4.1 The **orchestrator** owns public targets and their order. Roles expose callable, explicit targets but are not public entrypoints. +4.2 Example (shape): +#+BEGIN_SRC makefile +# developer/tool/makefile — public surface +RT_INCOMMON := $(REPO_HOME)/tool_shared/third_party/RT-project-share/release +include $(RT_INCOMMON)/make/environment_RT_1.mk + +.PHONY: all lib_cli kmod clean +all: lib_cli kmod + +lib_cli: + @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk cli + +kmod: + @$(MAKE) -f $(RT_INCOMMON)/make/targets_kmod.mk kmod + +clean: + @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk clean + @$(MAKE) -f $(RT_INCOMMON)/make/targets_kmod.mk clean +#+END_SRC +4.3 Result: no target collisions (each role runs in its own ~make -f~). ~all~ remains the single happy path. + +* 5. Discovery & Suffix Contract +5.1 Suffixes define intent; scripts don’t embed filenames: + - ~*.lib.c~ → compiled into a static archive. + - ~*.cli.c~ → linked into CLI executables. + - ~*.mod.c~ → compiled by Kbuild into ~.ko~. +5.2 Discovery happens in the role files; the orchestrator can optionally export a filtered list (e.g., subset kmods), but roles must work without it. + +* 6. Authored vs Write Areas (contract) +6.1 **Authored** (=developer/cc/= and other documented trees): tools do not write, delete, or generate within. +6.2 **SCRATCHPAD** (=scratchpad/=): all intermediates (.o, .d, temp .c for Kbuild) and module outputs (.ko). ~.gitignore~ contains this. +6.3 **machine/**: released executables (checked in). If shared across hosts, embed arch in filename (e.g., ~prog-$(shell uname -m)~). “Machine-like” *temporary* outputs go to ~scratchpad/~, not ~machine/~. + +* 7. Dependencies +7.1 User-space role enables per-object depfiles: ~CFLAGS += -MMD -MP~; role includes ~$(OBJECT:%.o=%.d)~. +7.2 Depfiles live beside objects in ~scratchpad/~ and are removed by ~clean~. +7.3 No separate “make dependency” step is required; changes to headers or structure are picked up automatically. +7.4 Kbuild manages its own deps internally when invoked for kmods. + +* 8. Kbuild Integration (kmod) +8.1 Kbuild interface directory: =/lib/modules/$(uname -r)/build=. +8.2 All Kbuild artifacts are directed to project SCRATCHPAD via ~O=$(REPO_HOME)/$(SCRATCHPAD)~; sources remain authored. +8.3 Pattern (shape): +#+BEGIN_SRC makefile +# make/targets_kmod.mk +ifndef REPO_HOME + $(error REPO_HOME is not set; build must be done in a project environment) +endif + +# If not provided by caller, discover from authored sources (recommended default) +ifndef KBUILD_BASE_List +KBUILD_BASE_List := $(basename $(notdir $(wildcard $(REPO_HOME)/developer/cc/*.mod.c))) +endif + +KDIR := /lib/modules/$(shell uname -r)/build +KBUILD_OUTPUT_DIR := $(REPO_HOME)/$(SCRATCHPAD) + +KERNEL_OBJS_M := $(addsuffix .o,$(KBUILD_BASE_List)) +KMOD_TARGETS := $(addsuffix .ko,$(addprefix $(KBUILD_OUTPUT_DIR)/,$(KBUILD_BASE_List))) + +.PHONY: kmod clean +kmod: $(KMOD_TARGETS) + +$(KBUILD_OUTPUT_DIR)/%.c: $(REPO_HOME)/developer/cc/%.mod.c + cp $< $@ + +$(KBUILD_OUTPUT_DIR)/%.ko: $(KBUILD_OUTPUT_DIR)/%.c + $(MAKE) -C $(KDIR) M=$(REPO_HOME) O=$(KBUILD_OUTPUT_DIR) obj-m=$*.o + +clean: + $(MAKE) -C $(KDIR) M=$(REPO_HOME) O=$(KBUILD_OUTPUT_DIR) obj-m="$(KERNEL_OBJS_M)" clean +#+END_SRC + +* 9. User-Space Role (lib + CLI) +9.1 Role name: =target_lib_cli.mk=. +9.2 Pattern (shape): +#+BEGIN_SRC makefile +# target_lib_cli.mk (shape only) +# Scan *.lib.c / *.cli.c; derive OBJECT_LIB / OBJECT_EXEC under $(SCRATCHPAD) +# -include $(OBJECT_LIB:.o=.d) $(OBJECT_EXEC:.o=.d) +# library target builds $(LIBFILE) from OBJECT_LIB (empty archive is OK) +# cli target depends on $(LIBFILE), then links each $(EXECDIR)/% from %.cli.o + $(LIBFILE) +#+END_SRC + +* 10. Variable Conventions +10.1 Only variables intended for export to sub-processes are ALL_CAPS (environment-style). +10.2 =REPO_HOME= is authoritative (exported by env); do not assign to it in Makefiles. +10.3 Use =SCRATCHPAD= (not TMPDIR) as the canonical name for the scratch directory in new code; keep a compatibility alias only if needed. +10.4 Prefer explicit paths to archives (e.g., link with ~$(LIBFILE)~) unless you intentionally maintain ~-L/-l~ naming. + +* 11. Usage & Defaults +11.1 Role files put ~usage~ as the first target (direct calls print help and exit non-zero). +11.2 Orchestrator keeps ~all~ as the first target (so ~make~ “just works”). +11.3 Skip-if-empty logic is *not required*: if no sources match, role targets naturally no-op (empty prereq lists). +11.4 Optional diagnostic: a ~check-pwd~ target in the orchestrator can warn if ~$(CURDIR) ≠ $(REPO_HOME)/developer~. + +* 12. Release Conventions (machine/) +12.1 Released executables go to ~machine/~ and are checked in. +12.2 When a shared ~machine/~ is used across hosts, embed an arch tag in the filename at *build time* (not only at publish time). +12.3 Temporary binaries or architecture-variant scratch builds go to ~scratchpad/~. + +* 13. Summary (Do / Don’t) +13.1 Do keep roles independent; orchestrator stitches them via ~make -f~. +13.2 Do derive *what to build* from suffixes; don’t hard-code filenames. +13.3 Do confine writes to ~scratchpad/~ (and ~machine/~ for releases); never write in authored trees. +13.4 Do use ~-MMD -MP~ and include per-object depfiles; don’t require humans to rebuild deps. +13.5 Don’t recompute ~REPO_HOME~; don’t pass ~PWD~ unnecessarily; environment inheritance suffices. +13.6 Use clear names: public targets = ~lib_cli~, ~kmod~, ~clean~; role files = ~target_lib_cli.mk~, ~targets_kmod.mk~. + diff --git a/document/environment_guide.org b/document/environment_guide.org deleted file mode 100644 index 65d25dc..0000000 --- a/document/environment_guide.org +++ /dev/null @@ -1,251 +0,0 @@ -#+title: Man_In_Grey Environment Guide -#+author: Toolsmith & Developers -#+options: toc:2 num:nil - -* Purpose -This document explains how the Man_In_Grey runtime environment is assembled and how -developers should work within it. It covers: -- Role-scoped shells (e.g., =developer=) -- PATH composition and tool discovery -- Shared helper functions/vars available to scripts -- Where and how developers customize their own environment safely - -* Quick Start (Developer) -From =$REPO_HOME=: -#+begin_src bash -source env_developer # must be *sourced*, not executed -hash -r # refresh the shell’s command cache -# you are now in $REPO_HOME/developer with role tools on PATH -#+end_src - -Common actions (cwd = =$REPO_HOME/developer=): -#+begin_src bash -compile # build gasket (dev/test) -release # publish to ../release (little loop) -clean_release # remove current-arch artifacts in ../release -#+end_src - -* Roles & Directory Conventions -- =ROLE=: one of =developer=, =tester=, … (you’re in =developer= here). -- Repo layout (selected): - - =tool_shared/= :: shared assets for all roles - - =developer/tool/= :: per-role tools (your =compile=, =release=, =clean_release=, …) - - =release/= :: binary drop (per arch + python3 + shell) - - =document/= :: project docs (this file is a good place for it) - -* Entry Scripts -** =env_developer= -Toolsmith-owned top-level entry. Responsibilities: -- Source shared =tool_shared/bespoke/env= -- Set =ROLE= and =ENV= -- Prepend =$REPO_HOME/$ROLE/tool= to PATH (if present) -- Ensure Python =bin= path is on PATH (=PYTHON_HOME/bin=) -- =cd $ROLE= -- Source =developer/tool/env= for developer’s customizations - -=env_developer= must be *sourced*: -#+begin_src bash -source env_developer -#+end_src - -** =developer/tool/env= -Developer-owned customization hook. Must also be *sourced*. Keep local tweaks here -(aliases, prompts, extra PATH additions), so top-level env stays stable. - -* Shared Environment (tool_shared/bespoke/env) -This script is sourced by all roles. It provides: - -** Core Vars -- =REPO_HOME= :: absolute repo root (auto-inferred) -- =PROJECT= :: repo basename -- =PROMPT_DECOR= :: defaults to =PROJECT= -- =VIRTUAL_ENV=, =PYTHON_HOME= :: local Python install (=tool_shared/third_party/Python=) - -** PATH Policy -Rightmost defined takes precedence (search is left-to-right). The shared script places: -- Shared third-party tools (RT project share, bespoke, customized, etc.) -- Then (after =env_developer=) the role’s own tool dir is prefixed: - =$REPO_HOME/$ROLE/tool= -- Then Python’s =bin= if not already present - -After sourcing, run =hash -r= to refresh the shell’s command cache. - -** Helper Functions (exported) -- =script_adp= :: absolute dirpath of the *current env script* -- =script_fp= :: path relative to =REPO_HOME= -- =script_dp= :: dirname of =script_fp= -- =script_fn= :: filename of current env script -- =install_file = :: thin wrapper over =install= with logging - -These are intended for use inside role tools (e.g., =developer/tool/release= scripts). - -* Release Layout (Little Loop) -The =release/= directory is a self-contained binary drop: -- =release/x86_64/= (=aarch64=, =armv7l=, =i686=, =ppc64le=, =riscv64=, =s390x=, …) - - compiled gasket (=man_in_grey_apply=) for that arch, setuid root (by =release= tool) -- =release/python3/= - - Python components (e.g., =Man_In_Grey.py=, =executor_inner.py=, =Planner.py=, …) -- =release/shell/= - - canonical human entrypoint script (=Man_In_Grey=) - -The developer’s =release= tool is responsible for: -- Building the gasket (from =developer/source=) -- Installing Python sources into =release/python3= -- Creating wrapper(s) in =release/shell= -- Hardening permissions/ownership (root for inner, setuid root for gasket) - -* Developer Tools (convention) -Your =developer/tool/= directory contains executable utilities on PATH: - -- =compile= :: build =man_in_grey_apply= in-place for local testing (no release write) -- =release= :: create/update =../release/= contents (little loop publisher) -- =clean_release= :: remove current-arch binaries & wrapper(s) (careful; Python stays) - -* Calling the Program (two ways) -1) From the wrapper (what testers use): -#+begin_src bash -../release/shell/Man_In_Grey --stage tester/stage_test_0 --phase-2-print -#+end_src -2) From dev tree orchestration (during development): -#+begin_src bash -python3 developer/source/Man_In_Grey.py --stage tester/stage_test_0 --phase-2-print -#+end_src - -The wrapper auto-detects arch (=uname -m= normalization) and prefers the gasket if present; -otherwise it falls back to the Python inner. - -* Sourcing vs Executing -All env scripts (=env_developer=, =tool_shared/bespoke/env=, =developer/tool/env=) are -designed to be *sourced*. Each file checks for accidental execution and exits with a -helpful message if run as a program. - -* What Developers May Customize -Put customizations in =developer/tool/env=, e.g.: -#+begin_src bash -# prompt tweak using PROMPT_DECOR -PS1="[\u@\h ${PROMPT_DECOR}:\w]$ " - -# quick jump helpers -alias repo='cd "$REPO_HOME"' -alias dev='cd "$REPO_HOME/developer"' - -# sanity -alias whichp='type -a' -#+end_src - -Avoid editing =env_developer= and shared files unless you are the toolsmith. - -* Role-based Unix groups & shared write access (developer / tester / toolsmith) - -Map the *roles* directly to Unix *groups* named =developer=, =tester=, and =toolsmith=. -Make role directories group-owned and group-writable so collaboration “just works”. -New files inherit the directory’s group via the setgid bit. - -** Define role groups and membership -#+begin_src bash -sudo groupadd developer -sudo groupadd tester -sudo groupadd toolsmith - -# add users to their roles (repeat per user) -sudo usermod -aG developer alice -sudo usermod -aG tester bob -sudo usermod -aG toolsmith charlie -#+end_src - -** Make role directories group-owned + setgid -#+begin_src bash -# assume $REPO_HOME is the repo root -sudo chgrp -R developer "$REPO_HOME/developer" -sudo chgrp -R tester "$REPO_HOME/tester" -sudo chgrp -R toolsmith "$REPO_HOME/release" - -# directories: g+rwx and setgid (2); usually o+rx is fine -sudo find "$REPO_HOME/developer" -type d -exec chmod 2775 {} + -sudo find "$REPO_HOME/tester" -type d -exec chmod 2775 {} + -sudo find "$REPO_HOME/release" -type d -exec chmod 2775 {} + - -# existing files: user+group writable (adjust to taste) -sudo find "$REPO_HOME/developer" -type f -exec chmod 0664 {} + -sudo find "$REPO_HOME/tester" -type f -exec chmod 0664 {} + -sudo find "$REPO_HOME/release" -type f -exec chmod 0664 {} + -#+end_src - -** Developer umask (inherit group write by default) -Set =umask 002= in the *developer* environment so new files are =0664= and dirs =0775=: -#+begin_src bash -# in developer/tool/env -umask 002 -#+end_src -If you want role-only access (no “other”), use =umask 007=. - -** Git repo configured for group sharing -#+begin_src bash -cd "$REPO_HOME" -git config --local core.sharedRepository group -#+end_src - -** Optional: default ACLs (stronger inheritance) -If some tools drop group bits, use default ACLs so everything inherits group rwx: -#+begin_src bash -sudo setfacl -R -m g:developer:rwx "$REPO_HOME/developer" -sudo setfacl -R -d -m g:developer:rwx "$REPO_HOME/developer" - -sudo setfacl -R -m g:tester:rwx "$REPO_HOME/tester" -sudo setfacl -R -d -m g:tester:rwx "$REPO_HOME/tester" -#+end_src -(Install the =acl= package if =setfacl/getfacl= are missing.) - -** Release & privileged artifacts -- Make =release/= group-owned by =toolsmith= so only toolsmiths modify binaries/wrappers. -- Privileged binaries (e.g. the setuid gasket) remain =root:root= with modes like =4755=; - directory group ownership still helps coordination. -- Use =install= with explicit owner/group/mode: -#+begin_src bash -install -D -o root -g toolsmith -m 0755 developer/source/Man_In_Grey.py \ - "$REPO_HOME/release/python3/Man_In_Grey.py" - -install -D -o root -g toolsmith -m 4755 developer/build/man_in_grey_apply \ - "$REPO_HOME/release/$(uname -m)/man_in_grey_apply" -#+end_src - -** Verification cheatsheet -#+begin_src bash -stat -c '%A %U:%G %n' "$REPO_HOME" "$REPO_HOME/developer" "$REPO_HOME/tester" "$REPO_HOME/release" -namei -l "$REPO_HOME/developer" -id -nG # confirm your groups -#+end_src - -*Note:* These *role groups* (developer/tester/toolsmith) are separate from any -*privileged gate* group used at runtime (e.g., =mig= for “allowed to apply”). Keep -both models: role groups for collaboration; a minimal privileged group for execution gates. - - - -* Notes on Python -The toolsmith-provided Python lives under: -- =tool_shared/third_party/Python= (a virtualenv-style tree) -- Its =bin= is appended to PATH by =env_developer= -- This keeps developer machines consistent without relying on system Python - -To confirm: -#+begin_src bash -python3 -V -which python3 -#+end_src - -* Troubleshooting Checklist -- “Command not found” for =compile/release/clean_release=: - - Ensure you =source env_developer= - - Verify =$REPO_HOME/developer/tool= is on PATH (=echo "$PATH" | tr : '\n' | nl=) - - =chmod +x= your tool scripts and run =hash -r= -- Wrong repo root: - - Echo =REPO_HOME= to verify auto-detection -- Release artifacts missing: - - Run =release= (little loop) and re-check =../release= layout -- Gasket permission errors: - - The =release= tool uses =sudo chown/chmod=; ensure your user can escalate - -* Glossary -- *Little loop*: Build & publish to =release/= for local testing (no system install). -- *Big loop*: System-level installation (later), outside the scope of this doc. diff --git a/env_developer b/env_developer index 1fb643e..892df91 100644 --- a/env_developer +++ b/env_developer @@ -1,30 +1,42 @@ #!/usr/bin/env bash + script_afp=$(realpath "${BASH_SOURCE[0]}") if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then echo "$script_afp:: This script must be sourced, not executed." exit 1 fi -# global environment is ROLE agnostic -source tool_shared/bespoke/env +# enter project environment +# + source tool_shared/bespoke/env -export ROLE=developer +# setup tools +# + export PYTHON_HOME="$REPO_HOME/tool_shared/third_party/python" + if [[ ":$PATH:" != *":$PYTHON_HOME/bin:"* ]]; then + export PATH="$PYTHON_HOME/bin:$PATH" + fi -PYTHON_HOME=tool_shared/third_party/python -if [[ ":$PATH:" != *":$PYTHON_HOME/bin:"* ]]; then - export PATH="$PYTHON_HOME/bin:$PATH" -fi + RT_gcc="$REPO_HOME/tool_shared/third_party/RT_gcc/release" + if [[ ":$PATH:" != *":$RT_gcc:"* ]]; then + export PATH="$RT_gcc:$PATH" + fi -RT_GCC=tool_shared/third_party/RT_gcc/release -if [[ ":$PATH:" != *":$RT_GCC:"* ]]; then - export PATH="$RT_GCC:$PATH" -fi +# enter the role environment +# + export ROLE=developer -if [[ -f "$ROLE/tool/env" ]]; then - source "$ROLE/tool/env" -else - cd "$ROLE" || return -fi + tool="$REPO_HOME/$ROLE/tool" + if [[ ":$PATH:" != *":$tool:"* ]]; then + export PATH="$tool:$PATH" + fi + + export ENV=$ROLE/tool/env -export ENV=$ROLE -echo "in environmennt: $ENV" + cd "$ROLE" + if [[ -f "tool/env" ]]; then + source "tool/env" + echo "in environment: $ENV" + else + echo "not found: $ENV" + fi