From 9a40ccfa780244f0f6a3a84ca1a39fc5d6d5cbd6 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 24 Jun 2026 17:16:30 -0600 Subject: [PATCH 1/3] build_docs* scripts now work with git-fleximod or regular submods. --- build_docs | 15 +++++++++++---- build_docs_to_publish | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/build_docs b/build_docs index 03d488d..6dc8be4 100755 --- a/build_docs +++ b/build_docs @@ -7,12 +7,19 @@ if [ ! -e doc-builder ]; then files_to_copy_to_source="conf.py substitutions.py _templates _static" cp -a ${files_to_copy_to_source} source/ else - # We're in a repo that has doc-builder as a submodule + # We're in a repo that *includes* doc-builder script="./doc-builder/tools/build_docs.py" - # Make sure the submodule is checked out. For now, we assume the repo is using git-fleximod to - # manage submodules. - "$(git rev-parse --show-toplevel)"/bin/git-fleximod update doc-builder + # Make sure the doc-builder submodule is checked out. If doc-builder isn't a submodule but is + # instead manually included, we will perform the `else`, which is safe because it's a no-op in + # that situation. + # (Assume that if the repo uses git-fleximod, doc-builder is handled with it.) + git_fleximod_path="$(git rev-parse --show-toplevel)/bin/git-fleximod" + if [[ -e "${git_fleximod_path}" ]]; then + "${git_fleximod_path}" update doc-builder + else + git submodule update --init -- doc-builder + fi fi # Check if --verbose or -V was passed diff --git a/build_docs_to_publish b/build_docs_to_publish index d5eeaf7..a9d8d43 100755 --- a/build_docs_to_publish +++ b/build_docs_to_publish @@ -7,12 +7,19 @@ if [ ! -e doc-builder ]; then files_to_copy_to_source="conf.py substitutions.py _templates _static" cp -a ${files_to_copy_to_source} source/ else - # We're in a repo that has doc-builder as a submodule + # We're in a repo that *includes* doc-builder script="./doc-builder/tools/build_docs_to_publish.py" - # Make sure the submodule is checked out. For now, we assume the repo is using git-fleximod to - # manage submodules. - "$(git rev-parse --show-toplevel)"/bin/git-fleximod update doc-builder + # Make sure the doc-builder submodule is checked out. If doc-builder isn't a submodule but is + # instead manually included, we will perform the `else`, which is safe because it's a no-op in + # that situation. + # (Assume that if the repo uses git-fleximod, doc-builder is handled with it.) + git_fleximod_path="$(git rev-parse --show-toplevel)/bin/git-fleximod" + if [[ -e "${git_fleximod_path}" ]]; then + "${git_fleximod_path}" update doc-builder + else + git submodule update --init -- doc-builder + fi fi # Check if --verbose or -V was passed From b9f2c020ee85eb45e5e7233a27c866b8eab3ba6d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 24 Jun 2026 17:28:33 -0600 Subject: [PATCH 2/3] Avoid code duplication b/w build_docs* scripts. --- build_docs | 10 ++++++-- build_docs_to_publish | 56 +------------------------------------------ 2 files changed, 9 insertions(+), 57 deletions(-) diff --git a/build_docs b/build_docs index 6dc8be4..16bdb3f 100755 --- a/build_docs +++ b/build_docs @@ -1,14 +1,20 @@ #!/usr/bin/env bash set -e +# $scriptname will already be set if build_docs is getting called from build_docs_to_publish. +# Otherwise, we need to set it to the basename of this script. +if [[ -z "${scriptname}" ]]; then + scriptname="${0##*/}" +fi + if [ ! -e doc-builder ]; then # We're in the doc-builder directory itself - script="./tools/build_docs.py" + script="./tools/${scriptname}.py" files_to_copy_to_source="conf.py substitutions.py _templates _static" cp -a ${files_to_copy_to_source} source/ else # We're in a repo that *includes* doc-builder - script="./doc-builder/tools/build_docs.py" + script="./doc-builder/tools/${scriptname}.py" # Make sure the doc-builder submodule is checked out. If doc-builder isn't a submodule but is # instead manually included, we will perform the `else`, which is safe because it's a no-op in diff --git a/build_docs_to_publish b/build_docs_to_publish index a9d8d43..6928d51 100755 --- a/build_docs_to_publish +++ b/build_docs_to_publish @@ -1,58 +1,4 @@ #!/usr/bin/env bash set -e -if [ ! -e doc-builder ]; then - # We're in the doc-builder directory itself - script="./tools/build_docs_to_publish.py" - files_to_copy_to_source="conf.py substitutions.py _templates _static" - cp -a ${files_to_copy_to_source} source/ -else - # We're in a repo that *includes* doc-builder - script="./doc-builder/tools/build_docs_to_publish.py" - - # Make sure the doc-builder submodule is checked out. If doc-builder isn't a submodule but is - # instead manually included, we will perform the `else`, which is safe because it's a no-op in - # that situation. - # (Assume that if the repo uses git-fleximod, doc-builder is handled with it.) - git_fleximod_path="$(git rev-parse --show-toplevel)/bin/git-fleximod" - if [[ -e "${git_fleximod_path}" ]]; then - "${git_fleximod_path}" update doc-builder - else - git submodule update --init -- doc-builder - fi -fi - -# Check if --verbose or -V was passed -verbose=false -for arg in "$@"; do - case "$arg" in - --verbose|-V) verbose=true; break ;; - esac -done - -cd "${script_dir}" - -if $verbose; then - echo "Running: make fetch-images" - make fetch-images -else - make fetch-images > /dev/null 2>&1 -fi - -if $verbose; then - echo "Running: ${script} $@" - pwd -fi -set +e -${script} "$@" -exit_code=$? -set -e - -if [ ! -e doc-builder ]; then - # Clean up these things we copied - for f in ${files_to_copy_to_source}; do - rm -r "source/$f" - done -fi - -exit $exit_code +. ./build_docs build_docs_to_publish From d5f566a34e003eaa4171cb08d03017267aa30c06 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 24 Jun 2026 17:34:15 -0600 Subject: [PATCH 3/3] build_docs_to_publish.py: Fix messaging. --- tools/build_docs_to_publish.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/build_docs_to_publish.py b/tools/build_docs_to_publish.py index 6a42e05..3163357 100755 --- a/tools/build_docs_to_publish.py +++ b/tools/build_docs_to_publish.py @@ -78,7 +78,6 @@ def setup_this_ref(args): permanent_files.append("doc-builder") # Check some things about "permanent" files before checkout - print(f"{os.getcwd()=}") for filename in permanent_files: check_permanent_file(filename) @@ -130,7 +129,7 @@ def checkout_and_build(version, permanent_files, args): build_args += ["--container-cli-tool", args.container_cli_tool] if args.verbose: build_args.append("--verbose") - print(" ".join(build_args)) + print(f"build_logs command-line args: {build_args}") build_docs(build_args)