From be569ba4accf8a4e08ab3e810d6420e501ec6595 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 8 Jul 2025 21:20:29 -0400 Subject: [PATCH 01/97] fix(taskfiles)!: Check the specified FILE_SHA256 matches the downloaded file in `remote:curl`. --- exports/taskfiles/utils/remote.yaml | 8 +++++--- taskfiles/remote/tests.yaml | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/exports/taskfiles/utils/remote.yaml b/exports/taskfiles/utils/remote.yaml index c7f1fa3..116de4c 100644 --- a/exports/taskfiles/utils/remote.yaml +++ b/exports/taskfiles/utils/remote.yaml @@ -23,9 +23,8 @@ tasks: status: - >- diff - <(echo "{{.FILE_SHA256}}") - <(openssl dgst -sha256 "{{.OUTPUT_FILE}}" - | awk '{print $2}') + <(echo "{{.FILE_SHA256}}") + <(openssl dgst -sha256 "{{.OUTPUT_FILE}}" | awk '{print $2}') cmds: - |- mkdir -p "{{dir .OUTPUT_FILE}}" @@ -50,6 +49,9 @@ tasks: echo "Failed to download after $max_attempts attempts." exit 1 fi + diff \ + <(echo "{{.FILE_SHA256}}") \ + <(openssl dgst -sha256 "{{.OUTPUT_FILE}}" | awk '{print $2}') # Uses curl to download a tar file from the given URL and extracts its contents. # diff --git a/taskfiles/remote/tests.yaml b/taskfiles/remote/tests.yaml index 59cffa7..0275695 100644 --- a/taskfiles/remote/tests.yaml +++ b/taskfiles/remote/tests.yaml @@ -4,21 +4,38 @@ includes: remote: "../../exports/taskfiles/utils/remote.yaml" vars: - G_EXTRACTED_ZIP_CODEOWNERS_PATH: "yscope-dev-utils-main/.github/CODEOWNERS" - G_EXTRACTED_ZIP_LICENSE_PATH: "yscope-dev-utils-main/LICENSE" + G_EXTRACTED_ROOT_DIR: "yscope-dev-utils-fd7c42dd7b59f8f4ab0eccba5078393e10cddb00" + G_EXTRACTED_ZIP_CODEOWNERS_PATH: "{{.G_EXTRACTED_ROOT_DIR}}/.github/CODEOWNERS" + G_EXTRACTED_ZIP_LICENSE_PATH: "{{.G_EXTRACTED_ROOT_DIR}}/LICENSE" G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH: >- - yscope-dev-utils-main/.github/PULL_REQUEST_TEMPLATE.md - G_TEST_ZIP_FILE_SHA256: "2c9a21f83484e004c41c28be759451dbdc787190eb044365ba58f7bb846418f6" - G_TEST_ZIP_FILE_URL: "https://github.com/y-scope/yscope-dev-utils/archive/refs/heads/main.zip" + {{.G_EXTRACTED_ROOT_DIR}}/.github/PULL_REQUEST_TEMPLATE.md + G_TEST_ZIP_FILE_SHA256: "141e807e9b4b9e28c254165c5a402ff54c0c9d3f9153178dfcff5354ace0c3d4" + G_TEST_ZIP_FILE_URL: "https://github.com/y-scope/yscope-dev-utils/archive/fd7c42d.zip" tasks: default: internal: true cmds: + - task: "curl-test-success" - task: "download-and-extract-zip-test-basic" - task: "download-and-extract-zip-test-exclusions" - task: "download-and-extract-zip-test-inclusions" + curl-test-success: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + OUTPUT_FILE: "{{.OUTPUT_DIR}}.zip" + cmds: + - task: "remote:curl" + vars: + FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" + OUTPUT_FILE: "{{.OUTPUT_FILE}}" + URL: "{{.G_TEST_ZIP_FILE_URL}}" + - |- + diff \ + <(echo "{{.G_TEST_ZIP_FILE_SHA256}}") \ + <(openssl dgst -sha256 "{{.OUTPUT_FILE}}" | awk '{print $2}') + download-and-extract-zip-test-basic: vars: OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" From 3a9334e3fad3bb671a99015fc6b3a7d441ea27d6 Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 11 Jul 2025 20:50:07 -0400 Subject: [PATCH 02/97] Add checksum unit tests. --- taskfiles/checksum/tests.yaml | 148 ++++++++++++++++++++++++++++++++++ taskfiles/tests.yaml | 2 + 2 files changed, 150 insertions(+) create mode 100644 taskfiles/checksum/tests.yaml diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml new file mode 100644 index 0000000..542d701 --- /dev/null +++ b/taskfiles/checksum/tests.yaml @@ -0,0 +1,148 @@ +version: "3" + +includes: + checksum: + internal: true + taskfile: "../../exports/taskfiles/utils/checksum.yaml" + +tasks: + default: + cmds: + - task: "checksum-test-rerun" + - task: "checksum-test-skip" + - task: "checksum-test-update" + + checksum-test-rerun: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + SRC_DIR: "{{.OUTPUT_DIR}}/src" + + CHECKSUM_FILE: "{{.SRC_DIR}}.md5" + CHECKSUM_FILE_REF: "{{.CHECKSUM_FILE}}.ref" + FILE_0: "{{.SRC_DIR}}/0.txt" + FILE_1: "{{.SRC_DIR}}/1.txt" + cmds: + - task: "checksum-test-init" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_0}}" + - "mv '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_1}}" + + # Test create-dir-with-checksum ran the second time. + - "test ! -e '{{.FILE_0}}'" + - "test -e '{{.FILE_1}}'" + - |- + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." + exit 1 + fi + + + checksum-test-skip: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + SRC_DIR: "{{.OUTPUT_DIR}}/src" + + CHECKSUM_FILE: "{{.SRC_DIR}}.md5" + CHECKSUM_MOD_TS: "{{.CHECKSUM_FILE}}-mod-ts.txt" + FILE_0: "{{.SRC_DIR}}/0.txt" + FILE_1: "{{.SRC_DIR}}/1.txt" + cmds: + - task: "checksum-test-init" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_0}}" + - "date -r '{{.CHECKSUM_FILE}}' > '{{.CHECKSUM_MOD_TS}}'" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_1}}" + + # Test create-dir-with-checksum didn't run the second time. + - "test -e '{{.FILE_0}}'" + - "test ! -e '{{.FILE_1}}'" + - "diff '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" + + checksum-test-update: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + SRC_DIR: "{{.OUTPUT_DIR}}/src" + + CHECKSUM_FILE: "{{.SRC_DIR}}.md5" + CHECKSUM_FILE_REF0: "{{.CHECKSUM_FILE}}.ref0" + CHECKSUM_FILE_REF1: "{{.CHECKSUM_FILE}}.ref1" + FILE_0: "{{.SRC_DIR}}/0.txt" + FILE_1: "{{.SRC_DIR}}/1.txt" + cmds: + - task: "checksum-test-init" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_0}}" + - "cp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + + - "cat '{{.CHECKSUM_FILE}}' > '{{.FILE_0}}'" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + INCLUDE_PATTERNS: ["{{.SRC_DIR}}"] + - "cp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_1}}" + + # Test create-dir-with-checksum didn't run the second time. + - "test -e '{{.FILE_0}}'" + - "test ! -e '{{.FILE_1}}'" + - "diff <(cat '{{.FILE_0}}') <(cat '{{.CHECKSUM_FILE_REF0}}')" + - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - |- + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then + echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF0}}' should differ." + exit 1 + fi + + checksum-test-init: + internal: true + requires: + vars: ["OUTPUT_DIR"] + cmds: + - "rm -rf {{.OUTPUT_DIR}}*" + - "mkdir -p '{{.OUTPUT_DIR}}'" + + create-dir-with-checksum: + internal: true + vars: + DIR: "{{dir .FILE_PATH}}" + requires: + vars: ["CHECKSUM_FILE", "FILE_PATH"] + sources: ["{{.TASKFILE}}"] + generates: ["{{.CHECKSUM_FILE}}"] + deps: + - task: "checksum:validate" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + INCLUDE_PATTERNS: ["{{.DIR}}"] + cmds: + - |- + rm -rf "{{.DIR}}" + mkdir -p "{{.DIR}}" + touch "{{.FILE_PATH}}" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + INCLUDE_PATTERNS: ["{{.DIR}}"] diff --git a/taskfiles/tests.yaml b/taskfiles/tests.yaml index 7c99a64..84626f9 100644 --- a/taskfiles/tests.yaml +++ b/taskfiles/tests.yaml @@ -2,6 +2,7 @@ version: "3" includes: boost: "boost/tests.yaml" + checksum: "checksum/tests.yaml" remote: "remote/tests.yaml" ystdlib-py: "ystdlib-py/tests.yaml" @@ -10,6 +11,7 @@ tasks: internal: true cmds: - task: "boost" + - task: "checksum" - task: "remote" - task: "ystdlib-py" From 9e41b40bd210b182ffd651845bffd8e2eada78c4 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sat, 23 Aug 2025 00:48:14 -0400 Subject: [PATCH 03/97] feat(taskfile)!: Use checksum tasks to prevent unnecessary repetition of Boost tasks; Add checksum unit tests. --- exports/taskfiles/utils/boost.yaml | 221 +++++++++++++++----------- exports/taskfiles/utils/checksum.yaml | 25 ++- taskfiles/boost/CMakeLists.txt | 2 - taskfiles/boost/tests.yaml | 7 +- 4 files changed, 149 insertions(+), 106 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 33fec0a..d02b2b2 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -8,38 +8,41 @@ set: ["u", "pipefail"] shopt: ["globstar"] tasks: - # Generates `GENERATE_DIR` by copying `SOURCE_DIR` and then running boost's bootstrap step. + # Runs the Boost generate (bootstrap) step. # - # @param {string} SOURCE_DIR Project source directory. - # @param {string} GENERATE_DIR Directory in which to generate `b2` and the build configuration. - # @param {string} GENERATE_CHECKSUM_FILE Checksum file for `GENERATE_DIR`. # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. + # @param {string} SOURCE_DIR Project source directory. # @param {string[]} TARGETS Target libraries to build. + # @param {string} [CHECKSUM_FILE={{.SOURCE_DIR}}.md5] Checksum file path for `SOURCE_DIR`. # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the generate command. generate: internal: true + label: "{{.TASK}}:{{.SOURCE_DIR}}" vars: + CHECKSUM_FILE: >- + {{default (printf "%s.md5" .SOURCE_DIR) .CHECKSUM_FILE}} EXTRA_ARGS: ref: "default (list) .EXTRA_ARGS" + SOURCE_SENTINEL_FILE: "{{.SOURCE_DIR}}/{{.TASK}}.sentinel" requires: - vars: ["SOURCE_DIR", "GENERATE_DIR", "GENERATE_CHECKSUM_FILE", "INSTALL_PREFIX", "TARGETS"] + vars: + - "INSTALL_PREFIX" + - "TARGETS" + - "SOURCE_DIR" sources: - - "{{.SOURCE_DIR}}/**/*" + - "{{.TASKFILE}}" generates: - - "{{.GENERATE_CHECKSUM_FILE}}" + - "{{.CHECKSUM_FILE}}" + - "{{.SOURCE_SENTINEL_FILE}}" deps: - task: "checksum:validate" vars: - CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}" + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" INCLUDE_PATTERNS: - - "{{.GENERATE_DIR}}" + - "{{.SOURCE_DIR}}" cmds: - >- - rm -rf "{{.GENERATE_DIR}}" - - >- - cp -R "{{.SOURCE_DIR}}" "{{.GENERATE_DIR}}" - - >- - pushd "{{.GENERATE_DIR}}"; + pushd "{{.SOURCE_DIR}}"; ./bootstrap.sh --prefix="{{.INSTALL_PREFIX}}" --exec-prefix="{{.INSTALL_PREFIX}}" @@ -48,37 +51,79 @@ tasks: "{{.}}" {{- end}}; popd + - "touch '{{.SOURCE_SENTINEL_FILE}}'" - task: "checksum:compute" vars: - CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}" + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" INCLUDE_PATTERNS: - - "{{.GENERATE_DIR}}" + - "{{.SOURCE_DIR}}" - # Runs boost's b2 build and install step, and creates a CMake settings file. The caller must have - # previously called `generate` on `SOURCE_DIR` (to produce the `GENERATE_DIR`) for this task to - # succeed. + # Runs Boost's b2 build and install step. + # Fails if the caller has not successfully called `generate` on `SOURCE_DIR`. # - # @param {string} GENERATE_DIR Directory containing boost's source and build files. + # Required parameters # @param {string} BUILD_DIR Directory in which to build boost. # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. - # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command. + # @param {string} SOURCE_DIR Directory containing boost's source and build files. + # + # Checksum parameters + # @param {string} [BUILD_CHECKSUM_FILE={{.BUILD_DIR}}.md5] Checksum file path for `BUILD_DIR`. + # @param {string} [INSTALL_CHECKSUM_FILE={{.INSTALL_PREFIX}}.md5] Checksum file path for + # `INSTALL_PREFIX` + # @param {string} [SOURCE_CHECKSUM_FILE={{.SOURCE_DIR}}.md5] Checksum file path for `SOURCE_DIR`. + # + # Build command parameters # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings - # file should be stored. + # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command. build-and-install: internal: true + label: "{{.TASK}}:{{.BUILD_DIR}}-{{.INSTALL_PREFIX}}" vars: + # Checksum files + BUILD_CHECKSUM_FILE: >- + {{default (printf "%s.md5" .BUILD_DIR) .BUILD_CHECKSUM_FILE}} + INSTALL_CHECKSUM_FILE: >- + {{default (printf "%s.md5" .INSTALL_PREFIX) .INSTALL_CHECKSUM_FILE}} + SOURCE_CHECKSUM_FILE: >- + {{default (printf "%s.md5" .SOURCE_DIR) .SOURCE_CHECKSUM_FILE}} + EXTRA_ARGS: ref: "default (list) .EXTRA_ARGS" - JOBS: >- - {{default "" .JOBS}} + SOURCE_SENTINEL_FILE: "{{.SOURCE_DIR}}/{{.TASK}}.sentinel" requires: - vars: ["GENERATE_DIR", "BUILD_DIR", "INSTALL_PREFIX"] + vars: + - "BUILD_DIR" + - "INSTALL_PREFIX" + - "SOURCE_DIR" + sources: + - "{{.TASKFILE}}" + generates: + - "{{.BUILD_CHECKSUM_FILE}}" + - "{{.INSTALL_CHECKSUM_FILE}}" + - "{{.SOURCE_CHECKSUM_FILE}}" + - "{{.SOURCE_SENTINEL_FILE}}" + deps: + - task: "checksum:validate" + vars: + CHECKSUM_FILE: "{{.BUILD_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.BUILD_DIR}}" + - task: "checksum:validate" + vars: + CHECKSUM_FILE: "{{.INSTALL_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.INSTALL_PREFIX}}" + - task: "checksum:validate" + vars: + CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.SOURCE_DIR}}" + FAIL: "true" cmds: - >- - pushd "{{.GENERATE_DIR}}"; + pushd "{{.SOURCE_DIR}}"; ./b2 install --build-dir="{{.BUILD_DIR}}" @@ -89,102 +134,90 @@ tasks: "-j{{.JOBS}}" {{- end}}; popd; - - >- - {{- if .CMAKE_SETTINGS_DIR}} - echo "set(Boost_ROOT - \"{{.INSTALL_PREFIX}}\" - CACHE PATH - \"Package root for Boost.\" - )" >> "{{.CMAKE_SETTINGS_DIR}}/Boost.cmake" - {{- end}} + - "touch '{{.SOURCE_SENTINEL_FILE}}'" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.BUILD_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.BUILD_DIR}}" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.INSTALL_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.INSTALL_PREFIX}}" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.SOURCE_DIR}}" - # Downloads boost from `URL` and installs boost. + # Downloads Boost from `URL` and then generates, builds, and installs Boost inside `WORK_DIR`. If + # `CMAKE_SETTINGS_DIR` is set, a settings file will be created in that directory, containing a + # `Boost_ROOT` CMake variable that points to `INSTALL_PREFIX`. # # General parameters - # @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory in which to store the source, generate, - # build, and install directories. - # @param {string} [SOURCE_DIR={{.WORK_DIR}}/boost-src] Directory in which to extract the tar - # file. - # - # Download parameters - # @param {string} FILE_SHA256 Content hash to verify the downloaded tar file against. - # @param {string} URL + # @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against. + # @param {string} TAR_URL URL of the tar file to download. + # @param {string} WORK_DIR Directory in which to store the source, build, and install directories. + # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings + # file should be stored. # - # Boost generate parameters - # @param {string} [GENERATE_DIR={{.WORK_DIR}}/boost-generate] Directory in which to generate the - # project build files. - # @param {string} [GENERATE_CHECKSUM_FILE={{.WORK_DIR}}/boost-generate.md5] Checksum file for the - # generate directory. - # @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/boost-install] Path prefix of where the project - # should be installed. - # @param {string[]} [TARGETS] Target libraries to build. + # Boost parameters + # @param {string[]} [BUILD_AND_INSTALL_ARGS] Any additional arguments to pass to boost's build and + # install command. # @param {string[]} [GENERATE_ARGS] Any additional arguments to pass to the generate command. - # - # Boost build-and-install parameters - # @param {string} [BUILD_DIR={{.WORK_DIR}}/boost-build] Directory in which to build the project. # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - # @param {string[]} [BUILD_AND_INSTALL_ARGS] Any additional arguments to pass to boost's build - # and install command. - # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings - # file should be stored. + # @param {string[]} [TARGETS] Target libraries to build. download-and-install: internal: true - label: "{{.TASK}}:{{.URL}}-{{.INSTALL_PREFIX}}" + label: "{{.TASK}}:{{.URL}}-{{.WORK_DIR}}" vars: - # General parameters - WORK_DIR: >- - {{default .ROOT_DIR .WORK_DIR}} - SOURCE_DIR: >- - {{default (printf "%s/boost-src" .WORK_DIR) .SOURCE_DIR}} - - # Boost generate parameters - GENERATE_DIR: >- - {{default (printf "%s/boost-generate" .WORK_DIR) .GENERATE_DIR}} - GENERATE_CHECKSUM_FILE: >- - {{default (printf "%s/boost-generate.md5" .WORK_DIR) .GENERATE_CHECKSUM_FILE}} - INSTALL_PREFIX: >- - {{default (printf "%s/boost-install" .WORK_DIR) .INSTALL_PREFIX}} - TARGETS: - ref: "default (list) .TARGETS" - GENERATE_ARGS: - ref: "default (list) .GENERATE_ARGS" + # Directory parameters + BUILD_DIR: "{{.WORK_DIR}}/boost-build" + INSTALL_PREFIX: "{{.WORK_DIR}}/boost-install" + SOURCE_DIR: "{{.WORK_DIR}}/boost-src" - # Boost build-and-install parameters - BUILD_DIR: >- - {{default (printf "%s/boost-build" .WORK_DIR) .BUILD_DIR}} - BUILD_AND_INSTALL_ARGS: - ref: "default (list) .BUILD_AND_INSTALL_ARGS" - JOBS: >- - {{default "" .JOBS}} - CMAKE_SETTINGS_DIR: >- - {{default "" .CMAKE_SETTINGS_DIR}} + # Checksum parameters + BUILD_AND_INSTALL_CHECKSUM_FILE: "{{.WORK_DIR}}/boost-build-install.md5" + SOURCE_CHECKSUM_FILE: "{{.SOURCE_DIR}}.md5" requires: - vars: ["FILE_SHA256", "URL"] + vars: + - "TAR_SHA256" + - "TAR_URL" + - "WORK_DIR" deps: - task: "remote:download-and-extract-tar" vars: - FILE_SHA256: "{{.FILE_SHA256}}" + FILE_SHA256: "{{.TAR_SHA256}}" OUTPUT_DIR: "{{.SOURCE_DIR}}" - URL: "{{.URL}}" + URL: "{{.TAR_URL}}" cmds: - task: "generate" vars: - SOURCE_DIR: "{{.SOURCE_DIR}}" - GENERATE_DIR: "{{.GENERATE_DIR}}" - GENERATE_CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}" + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" + SOURCE_DIR: "{{.SOURCE_DIR}}" TARGETS: ref: ".TARGETS" EXTRA_ARGS: ref: ".GENERATE_ARGS" - task: "build-and-install" vars: - GENERATE_DIR: "{{.GENERATE_DIR}}" + BUILD_AND_INSTALL_CHECKSUM_FILE: "{{.BUILD_AND_INSTALL_CHECKSUM_FILE}}" BUILD_DIR: "{{.BUILD_DIR}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" + SOURCE_CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" + SOURCE_DIR: "{{.SOURCE_DIR}}" EXTRA_ARGS: ref: ".BUILD_AND_INSTALL_ARGS" JOBS: "{{.JOBS}}" - CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}" + - >- + {{- if .CMAKE_SETTINGS_DIR}} + echo "set(Boost_ROOT + \"{{.INSTALL_PREFIX}}\" + CACHE PATH + \"Package root for Boost.\" + )" > "{{.CMAKE_SETTINGS_DIR}}/Boost.cmake" + {{- end}} diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index e9b5ec7..0641087 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -46,20 +46,29 @@ tasks: # Ignore errors so that dependent tasks don't fail ignore_error: true + # Validates the checksum of the given path include patterns matches the checksum in the given + # file. If `FAIL` is set to "true" the task will fail, otherwise the checksum file is deleted. + # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to validate the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. + # @param {string} [FAIL="false"] If set to "true" the task fails. validate: - desc: "Validates the checksum of the given directory matches the checksum in the given file, or - deletes the checksum file otherwise." internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" - silent: true vars: + FAIL: >- + {{- if (eq "true" .FAIL) -}} + true + {{- else}} + false + {{- end}} TMP_CHECKSUM_FILE: "{{.CHECKSUM_FILE}}.tmp" requires: - vars: ["CHECKSUM_FILE", "INCLUDE_PATTERNS"] + vars: + - "CHECKSUM_FILE" + - "INCLUDE_PATTERNS" cmds: - task: "compute" vars: @@ -69,7 +78,6 @@ tasks: ref: "default (list) .EXCLUDE_PATTERNS" CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" - defer: "rm -f '{{.TMP_CHECKSUM_FILE}}'" - # Check that all paths exist and the checksum matches; otherwise delete the checksum file. - |- ( {{- range .INCLUDE_PATTERNS}} @@ -78,4 +86,9 @@ tasks: done {{- end}} diff -q "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" 2> /dev/null - ) || rm -f "{{.CHECKSUM_FILE}}" + ) \ + {{- if eq "true" .FAIL}} + || false + {{- else}} + || rm -f "{{.CHECKSUM_FILE}}" + {{- end}} diff --git a/taskfiles/boost/CMakeLists.txt b/taskfiles/boost/CMakeLists.txt index fd3e1aa..1480ba4 100644 --- a/taskfiles/boost/CMakeLists.txt +++ b/taskfiles/boost/CMakeLists.txt @@ -30,7 +30,6 @@ find_package( process program_options regex - system url ) if(Boost_FOUND) @@ -49,6 +48,5 @@ target_link_libraries( Boost::process Boost::program_options Boost::regex - Boost::system Boost::url ) diff --git a/taskfiles/boost/tests.yaml b/taskfiles/boost/tests.yaml index f6544bc..85570c1 100644 --- a/taskfiles/boost/tests.yaml +++ b/taskfiles/boost/tests.yaml @@ -48,9 +48,9 @@ tasks: - task: "utils:boost:download-and-install" vars: WORK_DIR: "{{.G_BOOST_DEPS_DIR}}/boost" - FILE_SHA256: "2128a4c96862b5c0970c1e34d76b1d57e4a1016b80df85ad39667f30b1deba26" - URL: "https://github.com/boostorg/boost/releases/download/boost-1.86.0/\ - boost-1.86.0-b2-nodocs.tar.gz" + TAR_SHA256: "aa25e7b9c227c21abb8a681efd4fe6e54823815ffc12394c9339de998eb503fb" + TAR_URL: "https://github.com/boostorg/boost/releases/download/boost-1.89.0/\ + boost-1.89.0-b2-nodocs.tar.gz" CMAKE_SETTINGS_DIR: "{{.G_BOOST_DEPS_CMAKE_SETTINGS_DIR}}" TARGETS: - "filesystem" @@ -59,7 +59,6 @@ tasks: - "process" - "program_options" - "regex" - - "system" - "url" run-boost-test: From 3329f52521b88e6c9d87f2ed492c942f1f8897ec Mon Sep 17 00:00:00 2001 From: davidlion Date: Sat, 23 Aug 2025 00:58:56 -0400 Subject: [PATCH 04/97] Follow yaml guidelines. --- exports/taskfiles/utils/boost.yaml | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index d02b2b2..65e03d0 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -29,8 +29,7 @@ tasks: - "INSTALL_PREFIX" - "TARGETS" - "SOURCE_DIR" - sources: - - "{{.TASKFILE}}" + sources: ["{{.TASKFILE}}"] generates: - "{{.CHECKSUM_FILE}}" - "{{.SOURCE_SENTINEL_FILE}}" @@ -38,8 +37,7 @@ tasks: - task: "checksum:validate" vars: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.SOURCE_DIR}}" + INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] cmds: - >- pushd "{{.SOURCE_DIR}}"; @@ -55,8 +53,7 @@ tasks: - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.SOURCE_DIR}}" + INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] # Runs Boost's b2 build and install step. # Fails if the caller has not successfully called `generate` on `SOURCE_DIR`. @@ -97,8 +94,7 @@ tasks: - "BUILD_DIR" - "INSTALL_PREFIX" - "SOURCE_DIR" - sources: - - "{{.TASKFILE}}" + sources: ["{{.TASKFILE}}"] generates: - "{{.BUILD_CHECKSUM_FILE}}" - "{{.INSTALL_CHECKSUM_FILE}}" @@ -108,18 +104,15 @@ tasks: - task: "checksum:validate" vars: CHECKSUM_FILE: "{{.BUILD_CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.BUILD_DIR}}" + INCLUDE_PATTERNS: ["{{.BUILD_DIR}}"] - task: "checksum:validate" vars: CHECKSUM_FILE: "{{.INSTALL_CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.INSTALL_PREFIX}}" + INCLUDE_PATTERNS: ["{{.INSTALL_PREFIX}}"] - task: "checksum:validate" vars: CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.SOURCE_DIR}}" + INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] FAIL: "true" cmds: - >- @@ -138,18 +131,15 @@ tasks: - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.BUILD_CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.BUILD_DIR}}" + INCLUDE_PATTERNS: ["{{.BUILD_DIR}}"] - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.INSTALL_CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.INSTALL_PREFIX}}" + INCLUDE_PATTERNS: ["{{.INSTALL_PREFIX}}"] - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" - INCLUDE_PATTERNS: - - "{{.SOURCE_DIR}}" + INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] # Downloads Boost from `URL` and then generates, builds, and installs Boost inside `WORK_DIR`. If # `CMAKE_SETTINGS_DIR` is set, a settings file will be created in that directory, containing a From 5572a89c57a0983e6b0ebe0adba24d42936788d2 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sat, 23 Aug 2025 01:19:57 -0400 Subject: [PATCH 05/97] Fix yaml lint. --- taskfiles/checksum/tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 542d701..ebe3245 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -44,7 +44,6 @@ tasks: exit 1 fi - checksum-test-skip: vars: OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" From c8d706c7c95bb1ad50c9dfd21c03f48b05629223 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sat, 23 Aug 2025 01:20:13 -0400 Subject: [PATCH 06/97] Fix boost 1.89 header change. --- taskfiles/boost/test_boost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskfiles/boost/test_boost.cpp b/taskfiles/boost/test_boost.cpp index 61d9007..7f9cf9f 100644 --- a/taskfiles/boost/test_boost.cpp +++ b/taskfiles/boost/test_boost.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include From aca9e63182143192e9d1f198b0653ed3de493bc2 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 10:22:11 -0400 Subject: [PATCH 07/97] Try diff? --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index ebe3245..fcef9a0 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -39,7 +39,7 @@ tasks: - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + if diff -q "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." exit 1 fi @@ -110,7 +110,7 @@ tasks: - "diff <(cat '{{.FILE_0}}') <(cat '{{.CHECKSUM_FILE_REF0}}')" - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then + if diff -q "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF0}}' should differ." exit 1 fi From aef078666bc4cf88e15d5af68fb0ec9dd772c95e Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 10:48:25 -0400 Subject: [PATCH 08/97] Full switch to cmp. --- taskfiles/checksum/tests.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index fcef9a0..a58eb78 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -39,9 +39,9 @@ tasks: - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - |- - if diff -q "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." - exit 1 + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." + exit 1 fi checksum-test-skip: @@ -70,7 +70,7 @@ tasks: # Test create-dir-with-checksum didn't run the second time. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "diff '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" + - "cmp --silent '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" checksum-test-update: vars: @@ -107,12 +107,12 @@ tasks: # Test create-dir-with-checksum didn't run the second time. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "diff <(cat '{{.FILE_0}}') <(cat '{{.CHECKSUM_FILE_REF0}}')" - - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - if diff -q "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then - echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF0}}' should differ." - exit 1 + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then + echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF0}}' should differ." + exit 1 fi checksum-test-init: From b0ea5bc48263528ebadd3df63da8a27e130b8427 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 10:48:39 -0400 Subject: [PATCH 09/97] Debug logs. --- .github/workflows/unit-tests.yaml | 2 +- taskfiles/checksum/tests.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index cce541c..a74b510 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -39,4 +39,4 @@ jobs: run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test" + run: "task test -v" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index a58eb78..28a01be 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -22,6 +22,8 @@ tasks: FILE_0: "{{.SRC_DIR}}/0.txt" FILE_1: "{{.SRC_DIR}}/1.txt" cmds: + - defer: |- + echo "[debug] rerun {{.EXIT_CODE}}" - task: "checksum-test-init" vars: OUTPUT_DIR: "{{.OUTPUT_DIR}}" From 3d661082b6e70c64b988c911e6b289c91544a0ea Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 10:58:29 -0400 Subject: [PATCH 10/97] Resolve some rabbit coments. --- exports/taskfiles/utils/boost.yaml | 6 +++--- taskfiles/boost/test_boost.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 65e03d0..0569eec 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -141,8 +141,8 @@ tasks: CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] - # Downloads Boost from `URL` and then generates, builds, and installs Boost inside `WORK_DIR`. If - # `CMAKE_SETTINGS_DIR` is set, a settings file will be created in that directory, containing a + # Downloads Boost from `TAR_URL` and then generates, builds, and installs Boost inside `WORK_DIR`. + # If `CMAKE_SETTINGS_DIR` is set, a settings file will be created in that directory, containing a # `Boost_ROOT` CMake variable that points to `INSTALL_PREFIX`. # # General parameters @@ -162,7 +162,7 @@ tasks: # @param {string[]} [TARGETS] Target libraries to build. download-and-install: internal: true - label: "{{.TASK}}:{{.URL}}-{{.WORK_DIR}}" + label: "{{.TASK}}:{{.TAR_URL}}-{{.WORK_DIR}}" vars: # Directory parameters BUILD_DIR: "{{.WORK_DIR}}/boost-build" diff --git a/taskfiles/boost/test_boost.cpp b/taskfiles/boost/test_boost.cpp index 7f9cf9f..6f0137a 100644 --- a/taskfiles/boost/test_boost.cpp +++ b/taskfiles/boost/test_boost.cpp @@ -103,7 +103,7 @@ auto test_process() -> bool { io_context, boost::dll::program_location(), {"--help"}, - boost::process::process_stdio{.in{}, .out{nullptr}, .err{nullptr}} + boost::process::v2::process_stdio{.in{}, .out{nullptr}, .err{nullptr}} }; std::future result = process.async_wait(boost::asio::use_future); io_context.run(); From 6af0c396175f3ef3de66ba30c681ec901e195d8b Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 11:07:59 -0400 Subject: [PATCH 11/97] debugging CI --- .github/workflows/unit-tests.yaml | 2 +- taskfiles/checksum/tests.yaml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index a74b510..cce541c 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -39,4 +39,4 @@ jobs: run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test -v" + run: "task test" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 28a01be..c8ffae4 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -43,8 +43,10 @@ tasks: - |- if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." - exit 1 + else + echo "[debug] cmp failed successfully." fi + - "echo '[debug] rerun finished.'" checksum-test-skip: vars: From ea102c7577902fbc1db2a139c96ea428ef4a0eb9 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 11:14:11 -0400 Subject: [PATCH 12/97] Resolve more rabbit coments. --- exports/taskfiles/utils/boost.yaml | 7 ------- taskfiles/checksum/tests.yaml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 0569eec..283fbbb 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -168,10 +168,6 @@ tasks: BUILD_DIR: "{{.WORK_DIR}}/boost-build" INSTALL_PREFIX: "{{.WORK_DIR}}/boost-install" SOURCE_DIR: "{{.WORK_DIR}}/boost-src" - - # Checksum parameters - BUILD_AND_INSTALL_CHECKSUM_FILE: "{{.WORK_DIR}}/boost-build-install.md5" - SOURCE_CHECKSUM_FILE: "{{.SOURCE_DIR}}.md5" requires: vars: - "TAR_SHA256" @@ -186,7 +182,6 @@ tasks: cmds: - task: "generate" vars: - CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" SOURCE_DIR: "{{.SOURCE_DIR}}" TARGETS: @@ -195,10 +190,8 @@ tasks: ref: ".GENERATE_ARGS" - task: "build-and-install" vars: - BUILD_AND_INSTALL_CHECKSUM_FILE: "{{.BUILD_AND_INSTALL_CHECKSUM_FILE}}" BUILD_DIR: "{{.BUILD_DIR}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" - SOURCE_CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" SOURCE_DIR: "{{.SOURCE_DIR}}" EXTRA_ARGS: ref: ".BUILD_AND_INSTALL_ARGS" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index c8ffae4..dd033da 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -124,7 +124,7 @@ tasks: requires: vars: ["OUTPUT_DIR"] cmds: - - "rm -rf {{.OUTPUT_DIR}}*" + - "rm -rf '{{.OUTPUT_DIR}}'" - "mkdir -p '{{.OUTPUT_DIR}}'" create-dir-with-checksum: From 7c9701d568efc804dde33c6fe9b35ac4ecd36930 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 11:47:24 -0400 Subject: [PATCH 13/97] Switch to oneliner. --- taskfiles/checksum/tests.yaml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index dd033da..838e0f0 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -22,8 +22,6 @@ tasks: FILE_0: "{{.SRC_DIR}}/0.txt" FILE_1: "{{.SRC_DIR}}/1.txt" cmds: - - defer: |- - echo "[debug] rerun {{.EXIT_CODE}}" - task: "checksum-test-init" vars: OUTPUT_DIR: "{{.OUTPUT_DIR}}" @@ -40,13 +38,7 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." - else - echo "[debug] cmp failed successfully." - fi - - "echo '[debug] rerun finished.'" + - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" checksum-test-skip: vars: @@ -113,11 +105,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then - echo "'{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF0}}' should differ." - exit 1 - fi + - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From a6f792228bc4502e9ef0da69e8022710da68e27d Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 11:54:46 -0400 Subject: [PATCH 14/97] Make TARGETS required. --- exports/taskfiles/utils/boost.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 283fbbb..fc100cf 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -153,13 +153,13 @@ tasks: # file should be stored. # # Boost parameters + # @param {string[]} TARGETS Target libraries to build. # @param {string[]} [BUILD_AND_INSTALL_ARGS] Any additional arguments to pass to boost's build and # install command. # @param {string[]} [GENERATE_ARGS] Any additional arguments to pass to the generate command. # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - # @param {string[]} [TARGETS] Target libraries to build. download-and-install: internal: true label: "{{.TASK}}:{{.TAR_URL}}-{{.WORK_DIR}}" @@ -172,6 +172,7 @@ tasks: vars: - "TAR_SHA256" - "TAR_URL" + - "TARGETS" - "WORK_DIR" deps: - task: "remote:download-and-extract-tar" From 9e3b9816e134679fddf52dfc5aba5c3193eeec07 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 11:56:23 -0400 Subject: [PATCH 15/97] who knows --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index cce541c..aabe8fa 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -39,4 +39,4 @@ jobs: run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test" + run: "task test --concurrency 1 --verbose" From 67403973103a146415f9d0d4995b963d1d259855 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 12:09:45 -0400 Subject: [PATCH 16/97] shell shock --- taskfiles/checksum/tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 838e0f0..3dc3f41 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -105,7 +105,8 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - "! cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From b7849d94e00a0f397668a7cdb6e96dce7b8378eb Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 12:16:02 -0400 Subject: [PATCH 17/97] Verbose testing. --- taskfiles/checksum/tests.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 3dc3f41..ef6d850 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,8 +38,22 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" + + - defer: |- + echo "[debug] rerun {{.EXIT_CODE}}" + - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - |- + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." + exit 1 + else + echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' match." + fi + - "[debug] rerun finished." + - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + checksum-test-skip: vars: OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" @@ -105,8 +119,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" - - "! cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From 3d82d191817f1fe8fe1ab1e7ee62d9266b7b82cc Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 12:24:39 -0400 Subject: [PATCH 18/97] Fix logs. --- .github/workflows/unit-tests.yaml | 2 +- taskfiles/checksum/tests.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index aabe8fa..745a530 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -39,4 +39,4 @@ jobs: run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test --concurrency 1 --verbose" + run: "task test --verbose" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index ef6d850..5ae79b0 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,16 +40,16 @@ tasks: - "test -e '{{.FILE_1}}'" - defer: |- - echo "[debug] rerun {{.EXIT_CODE}}" + echo "[debug] rerun exit code: {{.EXIT_CODE}}" - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" - |- if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." exit 1 else - echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' match." + echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' differ!!" fi - - "[debug] rerun finished." + - "echo '[debug] rerun finished.'" - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" From 6930c6f8d33896ac58f5de134c108a80b2bf5292 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 12:54:50 -0400 Subject: [PATCH 19/97] npm maybe --- .github/workflows/unit-tests.yaml | 5 +++-- taskfiles/checksum/tests.yaml | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 745a530..ec80d3e 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -32,11 +32,12 @@ jobs: - name: "Install task" shell: "bash" - run: "npm install -g @go-task/cli" + # run: "npm install -g @go-task/cli" + run: "sh -c '$(curl --location https://taskfile.dev/install.sh)' -- -d" - name: "Install uv" shell: "bash" run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test --verbose" + run: "task test" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 5ae79b0..a87fd8b 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -53,7 +53,6 @@ tasks: - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" - checksum-test-skip: vars: OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" From a3fedaa84194ca1e56425ff85a920060bc5d905d Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 12:56:43 -0400 Subject: [PATCH 20/97] sigh task scripts --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index ec80d3e..0264318 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -33,7 +33,7 @@ jobs: - name: "Install task" shell: "bash" # run: "npm install -g @go-task/cli" - run: "sh -c '$(curl --location https://taskfile.dev/install.sh)' -- -d" + run: "curl --fail --location --silent --show-error https://taskfile.dev/install.sh | sh -- d" - name: "Install uv" shell: "bash" From 51c0ee8eb5def1b64bfdfdf9200672c9cb10b0ff Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 12:57:42 -0400 Subject: [PATCH 21/97] typo --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 0264318..f2252a4 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -33,7 +33,7 @@ jobs: - name: "Install task" shell: "bash" # run: "npm install -g @go-task/cli" - run: "curl --fail --location --silent --show-error https://taskfile.dev/install.sh | sh -- d" + run: "curl --fail --location --silent --show-error https://taskfile.dev/install.sh | sh -- -d" - name: "Install uv" shell: "bash" From 77d6fea41209bf1c1e25fd10eed6e58148fef567 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 13:14:29 -0400 Subject: [PATCH 22/97] syntax hard --- .github/workflows/unit-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index f2252a4..843b889 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -33,7 +33,8 @@ jobs: - name: "Install task" shell: "bash" # run: "npm install -g @go-task/cli" - run: "curl --fail --location --silent --show-error https://taskfile.dev/install.sh | sh -- -d" + run: >- + curl --fail --location --silent --show-error https://taskfile.dev/install.sh | sh -s -- -d - name: "Install uv" shell: "bash" From 955d6bdfbe8bb60023caee8e9ec91f795ce15ddc Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 13:16:45 -0400 Subject: [PATCH 23/97] not on path --- .github/workflows/unit-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 843b889..2dd8506 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -34,7 +34,8 @@ jobs: shell: "bash" # run: "npm install -g @go-task/cli" run: >- - curl --fail --location --silent --show-error https://taskfile.dev/install.sh | sh -s -- -d + curl --fail --location --silent --show-error https://taskfile.dev/install.sh + | sh -s -- -d -b /usr/local/bin - name: "Install uv" shell: "bash" From df4f9cb58f680d123d8cdac0541cb5480eb6f3f5 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 13:22:38 -0400 Subject: [PATCH 24/97] sigh --- .github/workflows/unit-tests.yaml | 5 +---- taskfiles/checksum/tests.yaml | 17 ++--------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 2dd8506..cce541c 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -32,10 +32,7 @@ jobs: - name: "Install task" shell: "bash" - # run: "npm install -g @go-task/cli" - run: >- - curl --fail --location --silent --show-error https://taskfile.dev/install.sh - | sh -s -- -d -b /usr/local/bin + run: "npm install -g @go-task/cli" - name: "Install uv" shell: "bash" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index a87fd8b..b64c517 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,20 +38,7 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - - defer: |- - echo "[debug] rerun exit code: {{.EXIT_CODE}}" - - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" - - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' should differ." - exit 1 - else - echo "[debug] '{{.CHECKSUM_FILE}}' and '{{.CHECKSUM_FILE_REF}}' differ!!" - fi - - "echo '[debug] rerun finished.'" - - - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" checksum-test-skip: vars: @@ -118,7 +105,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}' && true" checksum-test-init: internal: true From 319771db7d147162ec1c8f5249c6b86798ed07f9 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 13:30:03 -0400 Subject: [PATCH 25/97] what is the magic syntax --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index b64c517..4488b04 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,7 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" + - "(! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')" checksum-test-skip: vars: @@ -105,7 +105,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}' && true" + - "(! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}')" checksum-test-init: internal: true From c745ba80cf4ded2889c0ea8fb259bab91e5ad392 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 13:45:50 -0400 Subject: [PATCH 26/97] meh --- taskfiles/checksum/tests.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 4488b04..71f788e 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,9 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "(! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')" + - |- + cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" + test $? -eq 1 checksum-test-skip: vars: @@ -105,7 +107,9 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "(! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}')" + - |- + cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" + test $? -eq 1 checksum-test-init: internal: true From 8959121876e0b4b5dd7e44761770c3c81ae084d9 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 14:26:21 -0400 Subject: [PATCH 27/97] maybe --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 71f788e..c893c3d 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,7 +40,7 @@ tasks: - "test -e '{{.FILE_1}}'" - |- cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" - test $? -eq 1 + test $? -eq 1 && exit 0 || exit 1 checksum-test-skip: vars: @@ -109,7 +109,7 @@ tasks: - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" - test $? -eq 1 + test $? -eq 1 && exit 0 || exit 1 checksum-test-init: internal: true From 040b694345383ef273632e98bdfe437cc0d135c0 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 14:30:00 -0400 Subject: [PATCH 28/97] if else for macos --- taskfiles/checksum/tests.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index c893c3d..cc6109c 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -39,8 +39,11 @@ tasks: - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - |- - cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" - test $? -eq 1 && exit 0 || exit 1 + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + exit 1 + else + exit 0 + fi checksum-test-skip: vars: @@ -108,8 +111,11 @@ tasks: - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" - test $? -eq 1 && exit 0 || exit 1 + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then + exit 1 + else + exit 0 + fi checksum-test-init: internal: true From 2240fd4112d18642353c3d85e271aeb51149c1d5 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 14:38:13 -0400 Subject: [PATCH 29/97] just call bash idk --- taskfiles/checksum/tests.yaml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index cc6109c..1ceda1f 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,12 +38,8 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - exit 1 - else - exit 0 - fi + - >- + bash -c "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" checksum-test-skip: vars: @@ -110,12 +106,8 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}"; then - exit 1 - else - exit 0 - fi + - >- + bash -c "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From 4bc71648b3061f803e1565fd5303fff1e000dcc6 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 18:03:42 -0400 Subject: [PATCH 30/97] no silent?? --- taskfiles/checksum/tests.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 1ceda1f..54acbee 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,8 +38,9 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - >- - bash -c "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - |- + cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" + test $? -eq 1 checksum-test-skip: vars: @@ -106,8 +107,9 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - >- - bash -c "! cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - |- + cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" + test $? -eq 1 checksum-test-init: internal: true From 4fdc23e5cea6f6e715203e860575ed9e1caa2f6f Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 18:09:31 -0400 Subject: [PATCH 31/97] losing track --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 54acbee..39df192 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,7 +40,7 @@ tasks: - "test -e '{{.FILE_1}}'" - |- cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" - test $? -eq 1 + test $? -eq 1 && exit 0 || exit 1 checksum-test-skip: vars: @@ -109,7 +109,7 @@ tasks: - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" - test $? -eq 1 + test $? -eq 1 && exit 0 || exit 1 checksum-test-init: internal: true From 23dd1e9da3b222521c82aa8a50e7885d4a9faffd Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 22:01:01 -0400 Subject: [PATCH 32/97] help --- taskfiles/checksum/tests.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 39df192..95b6999 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,9 +38,16 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" + - defer: |- + echo "[debug] rerun {{.EXIT_CODE}}" - |- cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" - test $? -eq 1 && exit 0 || exit 1 + echo "sigh $?" + if cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + return 0 + else + return 1 + fi checksum-test-skip: vars: From 4997cf2bce3ed026040fe1cf2eec105e35279fab Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 22:10:19 -0400 Subject: [PATCH 33/97] full if statement --- taskfiles/checksum/tests.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 95b6999..6ad3ee1 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,12 +40,13 @@ tasks: - "test -e '{{.FILE_1}}'" - defer: |- echo "[debug] rerun {{.EXIT_CODE}}" + - "cmp --help" - |- - cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" - echo "sigh $?" if cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + echo "true $?" return 0 else + echo "false $?" return 1 fi From 05b2d684d2c0b9ec3f7636cae363797ef5674cea Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 22:21:28 -0400 Subject: [PATCH 34/97] dump shell options --- taskfiles/checksum/tests.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 6ad3ee1..6ceeb94 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -41,13 +41,14 @@ tasks: - defer: |- echo "[debug] rerun {{.EXIT_CODE}}" - "cmp --help" + - printf %s\\n "$-" - |- if cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then echo "true $?" - return 0 + exit 0 else echo "false $?" - return 1 + exit 1 fi checksum-test-skip: From 8d655c2db5e9727b390a5c4e16e446ae37d8dabc Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 22:31:35 -0400 Subject: [PATCH 35/97] hmm unbound --- taskfiles/checksum/tests.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 6ceeb94..89e8902 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -41,7 +41,10 @@ tasks: - defer: |- echo "[debug] rerun {{.EXIT_CODE}}" - "cmp --help" - - printf %s\\n "$-" + - "shopt -o" + - "shopt -po" + - "shopt -p" + - "set -o" - |- if cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then echo "true $?" From be5d2312a8806a3ca660363b71f6def2f5eb2d57 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 22:37:55 -0400 Subject: [PATCH 36/97] go panic --- taskfiles/checksum/tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 89e8902..a3f1083 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -43,7 +43,6 @@ tasks: - "cmp --help" - "shopt -o" - "shopt -po" - - "shopt -p" - "set -o" - |- if cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then From a6297c9849810836095afab06d50ed0efcfd235a Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 22:53:01 -0400 Subject: [PATCH 37/97] weird shell --- taskfiles/checksum/tests.yaml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index a3f1083..b5735cd 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -42,16 +42,12 @@ tasks: echo "[debug] rerun {{.EXIT_CODE}}" - "cmp --help" - "shopt -o" - - "shopt -po" - - "set -o" - |- - if cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - echo "true $?" - exit 0 - else - echo "false $?" + if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then + echo "checksums shouldn't match" exit 1 fi + echo $? checksum-test-skip: vars: @@ -118,9 +114,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - |- - cmp "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" - test $? -eq 1 && exit 0 || exit 1 + - "! cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From 0144e8488e8c18888ad7393e61a8cea4af7e5d61 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:06:04 -0400 Subject: [PATCH 38/97] error swallowing hmm --- taskfiles/checksum/tests.yaml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index b5735cd..9bb44b3 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,13 +38,9 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - defer: |- - echo "[debug] rerun {{.EXIT_CODE}}" - - "cmp --help" - "shopt -o" - |- - if cmp --silent "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - echo "checksums shouldn't match" + if cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then exit 1 fi echo $? @@ -75,7 +71,7 @@ tasks: # Test create-dir-with-checksum didn't run the second time. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "cmp --silent '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" + - "cmp -s '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" checksum-test-update: vars: @@ -112,9 +108,9 @@ tasks: # Test create-dir-with-checksum didn't run the second time. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "cmp --silent '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - - "cmp --silent '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From 361f89154b40ade4f8c340abe96cd52fa4324e06 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:16:15 -0400 Subject: [PATCH 39/97] free me --- taskfiles/checksum/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 9bb44b3..6c4486e 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,10 +40,12 @@ tasks: - "test -e '{{.FILE_1}}'" - "shopt -o" - |- + shopt -u errexit if cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then exit 1 fi echo $? + - "cmp -h" checksum-test-skip: vars: From da843e9a38f1894e3cb6a2ac9590563557b8f64f Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:23:02 -0400 Subject: [PATCH 40/97] forgive me --- taskfiles/checksum/tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 6c4486e..ed0215f 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,14 +38,14 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "shopt -o" - |- - shopt -u errexit + set -o + set +e + set -o if cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then exit 1 fi echo $? - - "cmp -h" checksum-test-skip: vars: From 129218493626b030e260f0aba6fb4aa5637647a4 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:33:19 -0400 Subject: [PATCH 41/97] maybe the end --- taskfiles/checksum/tests.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index ed0215f..8b3a731 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -39,13 +39,8 @@ tasks: - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - |- - set -o set +e - set -o - if cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}"; then - exit 1 - fi - echo $? + ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" checksum-test-skip: vars: @@ -112,7 +107,9 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - |- + set +e + ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" checksum-test-init: internal: true From cf02bb6072f9fc02c82322adb406cbc88c598bd9 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:37:51 -0400 Subject: [PATCH 42/97] maybe the end --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 8b3a731..c9a6925 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,7 +40,7 @@ tasks: - "test -e '{{.FILE_1}}'" - |- set +e - ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" + ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" && true checksum-test-skip: vars: @@ -109,7 +109,7 @@ tasks: - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- set +e - ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" + ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" && true checksum-test-init: internal: true From 8a72950521247bba67e767005e167c75f069ff27 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:44:08 -0400 Subject: [PATCH 43/97] clpain --- taskfiles/checksum/tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index c9a6925..cec5a42 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -40,7 +40,9 @@ tasks: - "test -e '{{.FILE_1}}'" - |- set +e - ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" && true + ! cmp -l "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" && true + - |- + ! cmp -l "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" && true checksum-test-skip: vars: From 2bb4119d1cce9138ad0f9209389e5ad18e66d8e3 Mon Sep 17 00:00:00 2001 From: davidlion Date: Sun, 24 Aug 2025 23:56:47 -0400 Subject: [PATCH 44/97] hardswap diff? --- taskfiles/checksum/tests.yaml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index cec5a42..b3b88a1 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,11 +38,8 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - |- - set +e - ! cmp -l "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" && true - - |- - ! cmp -l "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF}}" && true + # - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' > /dev/null" + - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" checksum-test-skip: vars: @@ -70,7 +67,7 @@ tasks: # Test create-dir-with-checksum didn't run the second time. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "cmp -s '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" + - "diff -q '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" checksum-test-update: vars: @@ -107,11 +104,9 @@ tasks: # Test create-dir-with-checksum didn't run the second time. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - |- - set +e - ! cmp -s "{{.CHECKSUM_FILE}}" "{{.CHECKSUM_FILE_REF0}}" && true + - "diff -q '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" + - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" checksum-test-init: internal: true From 96f7cfe75486f1def4ecaf9d8753e4f13d579f0b Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 00:03:54 -0400 Subject: [PATCH 45/97] cipain --- taskfiles/checksum/tests.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index b3b88a1..e07e6f3 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,8 +38,7 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - # - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' > /dev/null" - - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - "! (diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')" checksum-test-skip: vars: @@ -106,7 +105,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "diff -q '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" checksum-test-init: internal: true From 42f74957d8a326fa278ec3ec49a5d9ea94104657 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 00:14:53 -0400 Subject: [PATCH 46/97] same diff --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index e07e6f3..e4a5796 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,7 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "! (diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')" + - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" checksum-test-skip: vars: @@ -105,7 +105,7 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "diff -q '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}' && true" checksum-test-init: internal: true From 1a2c692227228903fdf2be6bc591f98624618e8b Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 00:47:31 -0400 Subject: [PATCH 47/97] not posix? --- taskfiles/checksum/tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index e4a5796..e8c3111 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,9 @@ tasks: # Test create-dir-with-checksum ran the second time. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" + - "echo $SHELL" + - "echo $(diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')" + - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; echo $?" checksum-test-skip: vars: From d86541d3f4ea871d3de8307f804380c4d98e2746 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 01:17:32 -0400 Subject: [PATCH 48/97] so lost --- taskfiles/checksum/tests.yaml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index e8c3111..5f62eb0 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -35,12 +35,12 @@ tasks: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" FILE_PATH: "{{.FILE_1}}" - # Test create-dir-with-checksum ran the second time. + # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "echo $SHELL" - - "echo $(diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')" - - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; echo $?" + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; echo $?" + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" checksum-test-skip: vars: @@ -65,10 +65,10 @@ tasks: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" FILE_PATH: "{{.FILE_1}}" - # Test create-dir-with-checksum didn't run the second time. + # Test create-dir-with-checksum didn't run the second time and the checksum is unmodified. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "diff -q '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" + - "cmp -s '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" checksum-test-update: vars: @@ -102,12 +102,13 @@ tasks: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" FILE_PATH: "{{.FILE_1}}" - # Test create-dir-with-checksum didn't run the second time. + # Test create-dir-with-checksum didn't run the second time and the updated checksum is + # different from the original. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "diff -q '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - - "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! diff '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}' && true" + - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - "set -o pipefail; ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}' && true" checksum-test-init: internal: true From b03226cdf4e45ad6f7bd3bcbaadb5f9e43a372d5 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 01:26:41 -0400 Subject: [PATCH 49/97] try without pipefail --- taskfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskfile.yaml b/taskfile.yaml index 4cf9fbf..64c7948 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -4,7 +4,7 @@ includes: lint: "./taskfiles/lint/main.yaml" tests: "./taskfiles/tests.yaml" -set: ["u", "pipefail"] +set: ["u"] shopt: ["globstar"] vars: From 058b86775182c8768b47ec0e05f1620f28aa1c76 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 01:31:38 -0400 Subject: [PATCH 50/97] try again --- taskfiles/checksum/tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 5f62eb0..caa6f42 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,9 +38,8 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; echo $?" - - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - "(! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}') && exit $?" checksum-test-skip: vars: @@ -108,7 +107,8 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "set -o pipefail; ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}' && true" + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; echo $?" + - "(! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}') && exit $?" checksum-test-init: internal: true From 74a07baad185a2f14eadda3fb01b4d5389d973b2 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:02:40 -0400 Subject: [PATCH 51/97] no ! --- taskfile.yaml | 2 +- taskfiles/checksum/tests.yaml | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/taskfile.yaml b/taskfile.yaml index 64c7948..4cf9fbf 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -4,7 +4,7 @@ includes: lint: "./taskfiles/lint/main.yaml" tests: "./taskfiles/tests.yaml" -set: ["u"] +set: ["u", "pipefail"] shopt: ["globstar"] vars: diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index caa6f42..39e4823 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -39,7 +39,12 @@ tasks: - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; echo $?" - - "(! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}') && exit $?" + - |- + if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then + exit 0 + else + exit 1 + fi checksum-test-skip: vars: @@ -107,8 +112,13 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; echo $?" - - "(! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}') && exit $?" + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; echo \"result: $?\"" + - |- + if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + exit 0 + else + exit 1 + fi checksum-test-init: internal: true From bb1688b6c99b79fd492710b9c6acd1cd4ab190b0 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:12:23 -0400 Subject: [PATCH 52/97] dumb person does dumb things --- taskfiles/checksum/tests.yaml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 39e4823..f5df450 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,11 +38,16 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; echo $?" - |- if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then + exit 1 + else + exit 0 + fi + - |- + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 0 - else + else exit 1 fi @@ -112,11 +117,16 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; echo \"result: $?\"" - |- - if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + exit 1 + else + exit 0 + fi + - |- + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then exit 0 - else + else exit 1 fi From 6ddec14329828df91d367f302fc614b3d1e0ce82 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:29:50 -0400 Subject: [PATCH 53/97] dumb person does more dumb stuff --- taskfiles/checksum/tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index f5df450..b943ba4 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,6 +38,7 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" + - "! false; echo \"sanity: $?\"" - |- if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 1 @@ -117,8 +118,9 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - "! false; echo \"sanity: $?\"" - |- - if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then exit 1 else exit 0 From 7d96c0a24d4a8062c317fd33548e917c990165b2 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:37:58 -0400 Subject: [PATCH 54/97] dumb person does even more dumb stuff --- taskfiles/checksum/tests.yaml | 8 ++++---- taskfiles/tests.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index b943ba4..c5fd2c7 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,15 +38,16 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "! false; echo \"sanity: $?\"" + - "cmp -h" + - "echo \"$(cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')\"" - |- - if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then + if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 1 else exit 0 fi - |- - if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then + if ! cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 0 else exit 1 @@ -118,7 +119,6 @@ tasks: - "test ! -e '{{.FILE_1}}'" - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - - "! false; echo \"sanity: $?\"" - |- if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then exit 1 diff --git a/taskfiles/tests.yaml b/taskfiles/tests.yaml index 84626f9..3d2efaf 100644 --- a/taskfiles/tests.yaml +++ b/taskfiles/tests.yaml @@ -10,7 +10,7 @@ tasks: all: internal: true cmds: - - task: "boost" + # - task: "boost" - task: "checksum" - task: "remote" - task: "ystdlib-py" From 5ef2d3191ff88dab39ca68630856ebfbba24a35b Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:41:10 -0400 Subject: [PATCH 55/97] one more --- taskfiles/checksum/tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index c5fd2c7..1207408 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,6 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "cmp -h" - "echo \"$(cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')\"" - |- if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then From dc829f2463dfcddfc6f6014b3d843480f55328a4 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:45:28 -0400 Subject: [PATCH 56/97] bed time --- .github/workflows/unit-tests.yaml | 2 +- taskfiles/checksum/tests.yaml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index cce541c..aabe8fa 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -39,4 +39,4 @@ jobs: run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test" + run: "task test --concurrency 1 --verbose" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 1207408..f89d7fc 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,8 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "echo \"$(cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')\"" + - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - "echo \"$(cmp -b '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')\"" - |- if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 1 From f1c73f230ebf54886d59f8e958d4c3cbd4438ac5 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:48:00 -0400 Subject: [PATCH 57/97] file dne? --- taskfiles/checksum/tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index f89d7fc..37bcbd1 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,7 +38,8 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "cat '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - "cat '{{.CHECKSUM_FILE}}'" + - "cat '{{.CHECKSUM_FILE_REF}}'" - "echo \"$(cmp -b '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')\"" - |- if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then From 853afcffe338ce7786de780c8425dfcfde114c28 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:51:24 -0400 Subject: [PATCH 58/97] bad mistakes --- taskfiles/checksum/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 37bcbd1..814109d 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -158,7 +158,7 @@ tasks: - |- rm -rf "{{.DIR}}" mkdir -p "{{.DIR}}" - touch "{{.FILE_PATH}}" + echo "{{.FILE_PATH}}" > "{{.FILE_PATH}}" - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" From a9cf0000de6418b2eb53746e19d9b8cbc4351b02 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:52:53 -0400 Subject: [PATCH 59/97] macos rm?? --- taskfiles/checksum/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 814109d..b667ffe 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -156,9 +156,9 @@ tasks: INCLUDE_PATTERNS: ["{{.DIR}}"] cmds: - |- - rm -rf "{{.DIR}}" + rm -rf "{{.DIR}}/" mkdir -p "{{.DIR}}" - echo "{{.FILE_PATH}}" > "{{.FILE_PATH}}" + touch "{{.FILE_PATH}}" - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" From 6a959ee8b5ecb91b2be2eb0155e045be48c3868a Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 02:54:30 -0400 Subject: [PATCH 60/97] need local macos runner --- exports/taskfiles/utils/checksum.yaml | 2 +- taskfiles/checksum/tests.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 0641087..84adfdf 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -44,7 +44,7 @@ tasks: 2> /dev/null | md5sum > {{.CHECKSUM_FILE}} # Ignore errors so that dependent tasks don't fail - ignore_error: true + # ignore_error: true # Validates the checksum of the given path include patterns matches the checksum in the given # file. If `FAIL` is set to "true" the task will fail, otherwise the checksum file is deleted. diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index b667ffe..37bcbd1 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -156,7 +156,7 @@ tasks: INCLUDE_PATTERNS: ["{{.DIR}}"] cmds: - |- - rm -rf "{{.DIR}}/" + rm -rf "{{.DIR}}" mkdir -p "{{.DIR}}" touch "{{.FILE_PATH}}" - task: "checksum:compute" From 78abea7b5f974bb7ca930fdaaa4590ec63fa8c75 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 09:14:01 -0400 Subject: [PATCH 61/97] macos same checksum? --- exports/taskfiles/utils/checksum.yaml | 2 +- taskfiles/checksum/tests.yaml | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 84adfdf..0641087 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -44,7 +44,7 @@ tasks: 2> /dev/null | md5sum > {{.CHECKSUM_FILE}} # Ignore errors so that dependent tasks don't fail - # ignore_error: true + ignore_error: true # Validates the checksum of the given path include patterns matches the checksum in the given # file. If `FAIL` is set to "true" the task will fail, otherwise the checksum file is deleted. diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 37bcbd1..a2d34c7 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -38,9 +38,14 @@ tasks: # Test create-dir-with-checksum ran the second time and created a different checksum. - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - - "cat '{{.CHECKSUM_FILE}}'" - - "cat '{{.CHECKSUM_FILE_REF}}'" - - "echo \"$(cmp -b '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}')\"" + - |- + echo "checksum_file" + date -r '{{.CHECKSUM_FILE}}' + cat '{{.CHECKSUM_FILE}}' + - |- + echo "checksum_file" + date -r '{{.CHECKSUM_FILE_REF}}' + cat '{{.CHECKSUM_FILE_REF}}' - |- if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 1 @@ -162,4 +167,4 @@ tasks: - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" - INCLUDE_PATTERNS: ["{{.DIR}}"] + INCLUDE_PATTERNS: ["{{.DIR}}/*"] From f09e08393e6368338174d9be682874f675af51d6 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 09:28:48 -0400 Subject: [PATCH 62/97] why tar mad --- taskfiles/checksum/tests.yaml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index a2d34c7..0b50f7a 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -39,13 +39,37 @@ tasks: - "test ! -e '{{.FILE_0}}'" - "test -e '{{.FILE_1}}'" - |- - echo "checksum_file" date -r '{{.CHECKSUM_FILE}}' cat '{{.CHECKSUM_FILE}}' - |- - echo "checksum_file" date -r '{{.CHECKSUM_FILE_REF}}' cat '{{.CHECKSUM_FILE_REF}}' + - >- + tar + --create + --file - + --group 0 + --mtime "UTC 1970-01-01" + --numeric-owner + --owner 0 + --sort name + --no-anchored + --wildcards + "{{.SRC_DIR}}" + - >- + tar + --create + --file - + --group 0 + --mtime "UTC 1970-01-01" + --numeric-owner + --owner 0 + --sort name + --no-anchored + --wildcards + "{{.SRC_DIR}}" + 2> /dev/null + | md5sum - |- if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 1 @@ -167,4 +191,4 @@ tasks: - task: "checksum:compute" vars: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" - INCLUDE_PATTERNS: ["{{.DIR}}/*"] + INCLUDE_PATTERNS: ["{{.DIR}}"] From 4743a674c5f081b4c91293a9715201ec679bc111 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 09:46:07 -0400 Subject: [PATCH 63/97] this shouldn't work --- .github/workflows/unit-tests.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index aabe8fa..08556c7 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -38,5 +38,9 @@ jobs: shell: "bash" run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" + - if: "'macos-15' == matrix.os" + run: |- + brew install coreutils + - name: "Run unit tests" run: "task test --concurrency 1 --verbose" From b6552d1e36906205a0101ef8d435bbfa3ee781f8 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 09:54:28 -0400 Subject: [PATCH 64/97] gtar auto installed? --- .github/workflows/unit-tests.yaml | 4 ---- exports/taskfiles/utils/checksum.yaml | 13 ++++++++----- taskfiles/checksum/tests.yaml | 7 +++++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 08556c7..aabe8fa 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -38,9 +38,5 @@ jobs: shell: "bash" run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - - if: "'macos-15' == matrix.os" - run: |- - brew install coreutils - - name: "Run unit tests" run: "task test --concurrency 1 --verbose" diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 0641087..358f621 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -12,7 +12,10 @@ tasks: desc: "Tries to compute a checksum for the given paths and output it to a file." internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" - silent: true + # silent: true + vars: + TAR: >- + {{if eq OS "darwin"}}gtar{{else}}tar{{end}} requires: vars: ["CHECKSUM_FILE", "INCLUDE_PATTERNS"] cmds: @@ -25,7 +28,7 @@ tasks: # passed to `tar` as arguments. If the input patterns are passed to `tar` with quotes, the # pattern won't be evaluated and will instead be treated literally. - >- - tar + {{.TAR}} --create --file - --group 0 @@ -44,7 +47,7 @@ tasks: 2> /dev/null | md5sum > {{.CHECKSUM_FILE}} # Ignore errors so that dependent tasks don't fail - ignore_error: true + # ignore_error: true # Validates the checksum of the given path include patterns matches the checksum in the given # file. If `FAIL` is set to "true" the task will fail, otherwise the checksum file is deleted. @@ -82,10 +85,10 @@ tasks: ( {{- range .INCLUDE_PATTERNS}} for path in {{.}}; do - test -e "$path" + test -e "$path" || exit 1 done {{- end}} - diff -q "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" 2> /dev/null + cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" ) \ {{- if eq "true" .FAIL}} || false diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 0b50f7a..6cb64e1 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -21,6 +21,9 @@ tasks: CHECKSUM_FILE_REF: "{{.CHECKSUM_FILE}}.ref" FILE_0: "{{.SRC_DIR}}/0.txt" FILE_1: "{{.SRC_DIR}}/1.txt" + + ARCHIVER: >- + {{if eq OS "darwin"}}gtar{{else}}tar{{end}} cmds: - task: "checksum-test-init" vars: @@ -45,7 +48,7 @@ tasks: date -r '{{.CHECKSUM_FILE_REF}}' cat '{{.CHECKSUM_FILE_REF}}' - >- - tar + {{.ARCHIVER}} --create --file - --group 0 @@ -57,7 +60,7 @@ tasks: --wildcards "{{.SRC_DIR}}" - >- - tar + {{.ARCHIVER}} --create --file - --group 0 From 2afbc02d1227b7e824a5bd2ff9b7e72646495d27 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 09:56:29 -0400 Subject: [PATCH 65/97] check ignore_errors later --- exports/taskfiles/utils/checksum.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 358f621..6e489b4 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -12,7 +12,7 @@ tasks: desc: "Tries to compute a checksum for the given paths and output it to a file." internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" - # silent: true + silent: true vars: TAR: >- {{if eq OS "darwin"}}gtar{{else}}tar{{end}} @@ -47,7 +47,7 @@ tasks: 2> /dev/null | md5sum > {{.CHECKSUM_FILE}} # Ignore errors so that dependent tasks don't fail - # ignore_error: true + ignore_error: true # Validates the checksum of the given path include patterns matches the checksum in the given # file. If `FAIL` is set to "true" the task will fail, otherwise the checksum file is deleted. From 4dd002b4832b9da99861b721c17a9e3f88155f6f Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 10:01:40 -0400 Subject: [PATCH 66/97] bam --- exports/taskfiles/utils/checksum.yaml | 17 +++++++++++++++ taskfiles/checksum/tests.yaml | 30 +-------------------------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 6e489b4..892de6b 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -27,6 +27,23 @@ tasks: # input patterns cannot be quoted since they're evaluated by the shell and the results are # passed to `tar` as arguments. If the input patterns are passed to `tar` with quotes, the # pattern won't be evaluated and will instead be treated literally. + - >- + {{.TAR}} + --create + --file - + --group 0 + --mtime "UTC 1970-01-01" + --numeric-owner + --owner 0 + --sort name + --no-anchored + --wildcards + {{- range .EXCLUDE_PATTERNS}} + --exclude="{{.}}" + {{- end}} + {{- range .INCLUDE_PATTERNS}} + {{.}} + {{- end}} - >- {{.TAR}} --create diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 6cb64e1..f78ae70 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -21,9 +21,6 @@ tasks: CHECKSUM_FILE_REF: "{{.CHECKSUM_FILE}}.ref" FILE_0: "{{.SRC_DIR}}/0.txt" FILE_1: "{{.SRC_DIR}}/1.txt" - - ARCHIVER: >- - {{if eq OS "darwin"}}gtar{{else}}tar{{end}} cmds: - task: "checksum-test-init" vars: @@ -47,32 +44,7 @@ tasks: - |- date -r '{{.CHECKSUM_FILE_REF}}' cat '{{.CHECKSUM_FILE_REF}}' - - >- - {{.ARCHIVER}} - --create - --file - - --group 0 - --mtime "UTC 1970-01-01" - --numeric-owner - --owner 0 - --sort name - --no-anchored - --wildcards - "{{.SRC_DIR}}" - - >- - {{.ARCHIVER}} - --create - --file - - --group 0 - --mtime "UTC 1970-01-01" - --numeric-owner - --owner 0 - --sort name - --no-anchored - --wildcards - "{{.SRC_DIR}}" - 2> /dev/null - | md5sum + - "! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}' && true" - |- if cmp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 1 From c72511e4c5ed72d9d31c21e054a6aaf002d71d4b Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 22:23:13 -0400 Subject: [PATCH 67/97] Improve checksum compute and validate error handling; add unit tests. --- exports/taskfiles/utils/checksum.yaml | 102 ++++++++++++------ taskfiles/checksum/tests.yaml | 150 ++++++++++++++++++++++++++ taskfiles/tests.yaml | 4 +- 3 files changed, 222 insertions(+), 34 deletions(-) create mode 100644 taskfiles/checksum/tests.yaml diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index e9b5ec7..bdbfa80 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -1,20 +1,27 @@ version: "3" -set: ["u", "pipefail"] -shopt: ["globstar"] - tasks: + # Compute the checksum of the given path include patterns saving the result to `CHECKSUM_FILE`. A + # calling task can set `FAIL` to false if they wish to continue after errors. + # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. + # @param {string} [FAIL="true"] If set to "false" the task will not fail. compute: - desc: "Tries to compute a checksum for the given paths and output it to a file." internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" silent: true + vars: + FAIL: "{{if eq \"false\" .FAIL}}false{{else}}true{{end}}" + TAR: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" + ERR_LOG: + sh: mktemp requires: - vars: ["CHECKSUM_FILE", "INCLUDE_PATTERNS"] + vars: + - "CHECKSUM_FILE" + - "INCLUDE_PATTERNS" cmds: # We explicitly set `--no-anchored` and `--wildcards` to make the inclusion behaviour match # the default exclusion behaviour. @@ -24,42 +31,60 @@ tasks: # input patterns cannot be quoted since they're evaluated by the shell and the results are # passed to `tar` as arguments. If the input patterns are passed to `tar` with quotes, the # pattern won't be evaluated and will instead be treated literally. - - >- - tar - --create - --file - - --group 0 - --mtime "UTC 1970-01-01" - --numeric-owner - --owner 0 - --sort name - --no-anchored - --wildcards - {{- range .EXCLUDE_PATTERNS}} - --exclude="{{.}}" - {{- end}} - {{- range .INCLUDE_PATTERNS}} - {{.}} - {{- end}} - 2> /dev/null - | md5sum > {{.CHECKSUM_FILE}} - # Ignore errors so that dependent tasks don't fail - ignore_error: true + - defer: "rm '{{.ERR_LOG}}'" + - |- + if ! \ + {{.TAR}} \ + --create \ + --file - \ + --group 0 \ + --mtime "UTC 1970-01-01" \ + --numeric-owner \ + --owner 0 \ + --sort name \ + --no-anchored \ + --wildcards \ + {{- range .EXCLUDE_PATTERNS}} + --exclude="{{.}}" \ + {{- end}} + {{- range .INCLUDE_PATTERNS}} + {{.}} \ + {{- end}} + 2> {{.ERR_LOG}} \ + | md5sum > {{.CHECKSUM_FILE}} \ + ; then + {{- if eq "true" .FAIL}} + echo "[{{.TASK}} error] tar failed with:\n$(cat {{.ERR_LOG}})" + exit 1 + {{- else}} + exit 0 + {{- end}} + fi + # Validates the checksum of the given path include patterns matches the checksum in the given + # file. If validation fails the checksum file is deleted so that a calling task with the checksum + # file in their `generates` field will be reran. A calling task can set `FAIL` to true if they + # wish to halt on failure. + # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to validate the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. + # @param {string} [FAIL="false"] If set to "true" the task fails. validate: - desc: "Validates the checksum of the given directory matches the checksum in the given file, or - deletes the checksum file otherwise." internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" silent: true vars: + FAIL: "{{if eq \"true\" .FAIL}}true{{else}}false{{end}}" TMP_CHECKSUM_FILE: "{{.CHECKSUM_FILE}}.tmp" + + ERR_LOG: + sh: mktemp requires: - vars: ["CHECKSUM_FILE", "INCLUDE_PATTERNS"] + vars: + - "CHECKSUM_FILE" + - "INCLUDE_PATTERNS" cmds: - task: "compute" vars: @@ -68,14 +93,25 @@ tasks: EXCLUDE_PATTERNS: ref: "default (list) .EXCLUDE_PATTERNS" CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" + FAIL: "false" - defer: "rm -f '{{.TMP_CHECKSUM_FILE}}'" - # Check that all paths exist and the checksum matches; otherwise delete the checksum file. - |- ( + {{- $err_log := .ERR_LOG}} {{- range .INCLUDE_PATTERNS}} for path in {{.}}; do - test -e "$path" + test -e "$path" || (echo "Include path does not exist: $path" > $err_log; exit 1) done {{- end}} - diff -q "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" 2> /dev/null - ) || rm -f "{{.CHECKSUM_FILE}}" + cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ + || ( + echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" > "{{.ERR_LOG}}" + exit 1 + ) + ) || \ + {{- if eq "true" .FAIL}} + echo "[{{.TASK}} error] failed with:\n$(cat {{.ERR_LOG}})" + exit 1 + {{- else}} + rm -f "{{.CHECKSUM_FILE}}" + {{- end}} diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml new file mode 100644 index 0000000..8242cd4 --- /dev/null +++ b/taskfiles/checksum/tests.yaml @@ -0,0 +1,150 @@ +version: "3" + +includes: + checksum: + internal: true + taskfile: "../../exports/taskfiles/utils/checksum.yaml" + +tasks: + default: + cmds: + - task: "checksum-test-rerun" + - task: "checksum-test-skip" + - task: "checksum-test-update" + + checksum-test-rerun: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + SRC_DIR: "{{.OUTPUT_DIR}}/src" + + CHECKSUM_FILE: "{{.SRC_DIR}}.md5" + CHECKSUM_FILE_REF: "{{.CHECKSUM_FILE}}.ref" + FILE_0: "{{.SRC_DIR}}/0.txt" + FILE_1: "{{.SRC_DIR}}/1.txt" + cmds: + - task: "checksum-test-init" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_0}}" + - "mv '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_1}}" + + # Test create-dir-with-checksum ran the second time and created a different checksum. + - "test ! -e '{{.FILE_0}}'" + - "test -e '{{.FILE_1}}'" + - |- + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then + exit 0 + else + exit 1 + fi + + checksum-test-skip: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + SRC_DIR: "{{.OUTPUT_DIR}}/src" + + CHECKSUM_FILE: "{{.SRC_DIR}}.md5" + CHECKSUM_MOD_TS: "{{.CHECKSUM_FILE}}-mod-ts.txt" + FILE_0: "{{.SRC_DIR}}/0.txt" + FILE_1: "{{.SRC_DIR}}/1.txt" + cmds: + - task: "checksum-test-init" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_0}}" + - "date -r '{{.CHECKSUM_FILE}}' > '{{.CHECKSUM_MOD_TS}}'" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_1}}" + + # Test create-dir-with-checksum didn't run the second time and the checksum is unmodified. + - "test -e '{{.FILE_0}}'" + - "test ! -e '{{.FILE_1}}'" + - "cmp -s '{{.CHECKSUM_MOD_TS}}' <(date -r '{{.CHECKSUM_FILE}}')" + + checksum-test-update: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + SRC_DIR: "{{.OUTPUT_DIR}}/src" + + CHECKSUM_FILE: "{{.SRC_DIR}}.md5" + CHECKSUM_FILE_REF0: "{{.CHECKSUM_FILE}}.ref0" + CHECKSUM_FILE_REF1: "{{.CHECKSUM_FILE}}.ref1" + FILE_0: "{{.SRC_DIR}}/0.txt" + FILE_1: "{{.SRC_DIR}}/1.txt" + cmds: + - task: "checksum-test-init" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_0}}" + - "cp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'" + + - "cat '{{.CHECKSUM_FILE}}' > '{{.FILE_0}}'" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + INCLUDE_PATTERNS: ["{{.SRC_DIR}}"] + - "cp '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + + - task: "create-dir-with-checksum" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + FILE_PATH: "{{.FILE_1}}" + + # Test create-dir-with-checksum didn't run the second time and the updated checksum is + # different from the original. + - "test -e '{{.FILE_0}}'" + - "test ! -e '{{.FILE_1}}'" + - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" + - |- + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + exit 0 + else + exit 1 + fi + + checksum-test-init: + internal: true + requires: + vars: ["OUTPUT_DIR"] + cmds: + - "rm -rf '{{.OUTPUT_DIR}}'" + - "mkdir -p '{{.OUTPUT_DIR}}'" + + create-dir-with-checksum: + internal: true + vars: + DIR: "{{dir .FILE_PATH}}" + requires: + vars: ["CHECKSUM_FILE", "FILE_PATH"] + sources: ["{{.TASKFILE}}"] + generates: ["{{.CHECKSUM_FILE}}"] + deps: + - task: "checksum:validate" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + INCLUDE_PATTERNS: ["{{.DIR}}"] + cmds: + - |- + rm -rf "{{.DIR}}" + mkdir -p "{{.DIR}}" + touch "{{.FILE_PATH}}" + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" + INCLUDE_PATTERNS: ["{{.DIR}}"] diff --git a/taskfiles/tests.yaml b/taskfiles/tests.yaml index 7c99a64..3d2efaf 100644 --- a/taskfiles/tests.yaml +++ b/taskfiles/tests.yaml @@ -2,6 +2,7 @@ version: "3" includes: boost: "boost/tests.yaml" + checksum: "checksum/tests.yaml" remote: "remote/tests.yaml" ystdlib-py: "ystdlib-py/tests.yaml" @@ -9,7 +10,8 @@ tasks: all: internal: true cmds: - - task: "boost" + # - task: "boost" + - task: "checksum" - task: "remote" - task: "ystdlib-py" From 394d45fba4dcc7666e51a2ad33e2dc6e0a576d8f Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 22:26:41 -0400 Subject: [PATCH 68/97] Fix yaml lint; sanity check --- exports/taskfiles/utils/checksum.yaml | 4 ++-- taskfiles/checksum/tests.yaml | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index bdbfa80..0d69ad9 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -17,7 +17,7 @@ tasks: FAIL: "{{if eq \"false\" .FAIL}}false{{else}}true{{end}}" TAR: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" ERR_LOG: - sh: mktemp + sh: "mktemp" requires: vars: - "CHECKSUM_FILE" @@ -80,7 +80,7 @@ tasks: TMP_CHECKSUM_FILE: "{{.CHECKSUM_FILE}}.tmp" ERR_LOG: - sh: mktemp + sh: "mktemp" requires: vars: - "CHECKSUM_FILE" diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 8242cd4..d5d90be 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -112,9 +112,7 @@ tasks: - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then - exit 0 - else + if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then exit 1 fi From 3b5a816b218e6cf685a7ede7f1996644097bb76c Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 22:29:53 -0400 Subject: [PATCH 69/97] one more sanity check --- taskfiles/checksum/tests.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index d5d90be..f35813f 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -112,9 +112,15 @@ tasks: - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - if cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + exit 0 + else exit 1 fi + - |- + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'; then + exit 1 + fi checksum-test-init: internal: true From 9c935f9b40f3af30543643ec6bdd3c210299cf19 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 22:34:29 -0400 Subject: [PATCH 70/97] one more --- taskfiles/checksum/tests.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index f35813f..d50fd8f 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -112,13 +112,11 @@ tasks: - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then - exit 0 - else + if (cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'); then exit 1 fi - |- - if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'; then + if (! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'); then exit 1 fi From 07b88fc11db41505821f5b7c3491ab96a774ef41 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 22:43:31 -0400 Subject: [PATCH 71/97] last one --- taskfiles/checksum/tests.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index d50fd8f..041fa69 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -41,9 +41,8 @@ tasks: - |- if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF}}'; then exit 0 - else - exit 1 fi + exit 1 checksum-test-skip: vars: @@ -112,13 +111,15 @@ tasks: - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- - if (cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'); then - exit 1 + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then + exit 0 fi + exit 1 + # test - |- - if (! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'); then - exit 1 - fi + if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'; then + exit 1 + fi checksum-test-init: internal: true From 20802e784739100bb0fcb449b765415ccc4369d9 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 22:46:05 -0400 Subject: [PATCH 72/97] remove test --- taskfiles/checksum/tests.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 041fa69..6986408 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -115,11 +115,6 @@ tasks: exit 0 fi exit 1 - # test - - |- - if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'; then - exit 1 - fi checksum-test-init: internal: true From a2ff6f40c41e3e61ebef5bfdb84fe874cc1d3772 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 25 Aug 2025 23:12:09 -0400 Subject: [PATCH 73/97] Fix err log. --- exports/taskfiles/utils/checksum.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 0d69ad9..61d9f38 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -94,13 +94,15 @@ tasks: ref: "default (list) .EXCLUDE_PATTERNS" CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" FAIL: "false" - - defer: "rm -f '{{.TMP_CHECKSUM_FILE}}'" + - defer: |- + rm -f "{{.TMP_CHECKSUM_FILE}}" + rm "{{.ERR_LOG}}" - |- ( {{- $err_log := .ERR_LOG}} {{- range .INCLUDE_PATTERNS}} for path in {{.}}; do - test -e "$path" || (echo "Include path does not exist: $path" > $err_log; exit 1) + test -e "$path" || (echo "Include path does not exist: $path" > "{{$err_log}}"; exit 1) done {{- end}} cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ From 194440e5e26ffb80067e27d47c5603eebe858d78 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 01:37:43 -0400 Subject: [PATCH 74/97] Drop mktemp due to task bug. --- exports/taskfiles/utils/checksum.yaml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 61d9f38..795aca6 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -16,8 +16,7 @@ tasks: vars: FAIL: "{{if eq \"false\" .FAIL}}false{{else}}true{{end}}" TAR: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" - ERR_LOG: - sh: "mktemp" + TMP_ERR_LOG: "{{.CHECKSUM_FILE}}.log.tmp" requires: vars: - "CHECKSUM_FILE" @@ -31,7 +30,7 @@ tasks: # input patterns cannot be quoted since they're evaluated by the shell and the results are # passed to `tar` as arguments. If the input patterns are passed to `tar` with quotes, the # pattern won't be evaluated and will instead be treated literally. - - defer: "rm '{{.ERR_LOG}}'" + - defer: "rm '{{.TMP_ERR_LOG}}'" - |- if ! \ {{.TAR}} \ @@ -50,11 +49,11 @@ tasks: {{- range .INCLUDE_PATTERNS}} {{.}} \ {{- end}} - 2> {{.ERR_LOG}} \ + 2> {{.TMP_ERR_LOG}} \ | md5sum > {{.CHECKSUM_FILE}} \ ; then {{- if eq "true" .FAIL}} - echo "[{{.TASK}} error] tar failed with:\n$(cat {{.ERR_LOG}})" + echo "[{{.TASK}} error] tar failed with:\n$(cat {{.TMP_ERR_LOG}})" exit 1 {{- else}} exit 0 @@ -78,9 +77,7 @@ tasks: vars: FAIL: "{{if eq \"true\" .FAIL}}true{{else}}false{{end}}" TMP_CHECKSUM_FILE: "{{.CHECKSUM_FILE}}.tmp" - - ERR_LOG: - sh: "mktemp" + TMP_ERR_LOG: "{{.CHECKSUM_FILE}}.log.tmp" requires: vars: - "CHECKSUM_FILE" @@ -95,24 +92,25 @@ tasks: CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" FAIL: "false" - defer: |- - rm -f "{{.TMP_CHECKSUM_FILE}}" - rm "{{.ERR_LOG}}" + rm "{{.TMP_CHECKSUM_FILE}}" + rm "{{.TMP_ERR_LOG}}" - |- ( - {{- $err_log := .ERR_LOG}} {{- range .INCLUDE_PATTERNS}} for path in {{.}}; do - test -e "$path" || (echo "Include path does not exist: $path" > "{{$err_log}}"; exit 1) + test -e "$path" \ + || (echo "Include path does not exist: $path" > "{{$.TMP_ERR_LOG}}"; exit 1) done {{- end}} cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ || ( - echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" > "{{.ERR_LOG}}" + echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ + > "{{.TMP_ERR_LOG}}" exit 1 ) ) || \ {{- if eq "true" .FAIL}} - echo "[{{.TASK}} error] failed with:\n$(cat {{.ERR_LOG}})" + echo "[{{.TASK}} error] failed with:\n$(cat {{.TMP_ERR_LOG}})" exit 1 {{- else}} rm -f "{{.CHECKSUM_FILE}}" From 3a92d534e8a032a7d6967fb8688c481869971da0 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 01:41:25 -0400 Subject: [PATCH 75/97] Add force to rm tmp files. --- exports/taskfiles/utils/checksum.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 795aca6..4b12abd 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -30,7 +30,7 @@ tasks: # input patterns cannot be quoted since they're evaluated by the shell and the results are # passed to `tar` as arguments. If the input patterns are passed to `tar` with quotes, the # pattern won't be evaluated and will instead be treated literally. - - defer: "rm '{{.TMP_ERR_LOG}}'" + - defer: "rm -f '{{.TMP_ERR_LOG}}'" - |- if ! \ {{.TAR}} \ @@ -92,8 +92,8 @@ tasks: CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" FAIL: "false" - defer: |- - rm "{{.TMP_CHECKSUM_FILE}}" - rm "{{.TMP_ERR_LOG}}" + rm -f "{{.TMP_CHECKSUM_FILE}}" + rm -f "{{.TMP_ERR_LOG}}" - |- ( {{- range .INCLUDE_PATTERNS}} From c31ef2428792ef959e61c0b35bacc8d752a58071 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 02:15:23 -0400 Subject: [PATCH 76/97] sub shells --- exports/taskfiles/utils/checksum.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 4b12abd..74de95c 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -108,10 +108,11 @@ tasks: > "{{.TMP_ERR_LOG}}" exit 1 ) - ) || \ + ) || ( \ {{- if eq "true" .FAIL}} echo "[{{.TASK}} error] failed with:\n$(cat {{.TMP_ERR_LOG}})" exit 1 {{- else}} rm -f "{{.CHECKSUM_FILE}}" {{- end}} + ) From 07fd3e4cbc7759424cff8421061caa1eb4142f81 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 02:25:29 -0400 Subject: [PATCH 77/97] Update readme with macos requirements. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index a49d797..09613a3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,14 @@ Before you submit a pull request, ensure you follow the testing and linting inst * [Task] 3.40 or higher * [uv] 0.7.10 or higher +### MacOS + +The exported tasks use GNU utilities that are not always pre-installed on MacOS. You may need to +install the following brew packages: + +* [coreutils] +* [gnu-tar] + ## Testing To run all tests: @@ -42,5 +50,7 @@ To clean up any generated files: task clean ``` +[coreutils]: https://formulae.brew.sh/formula/coreutils +[gnu-tar]: https://formulae.brew.sh/formula/gnu-tar [Task]: https://taskfile.dev/ [uv]: https://docs.astral.sh/uv From 4ec658897d6dfffa7924c13d62c063ab8289171d Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 12:49:38 -0400 Subject: [PATCH 78/97] Tweak default list handling. --- exports/taskfiles/utils/checksum.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 74de95c..ef1376f 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -14,7 +14,10 @@ tasks: label: "{{.TASK}}-{{.CHECKSUM_FILE}}" silent: true vars: + EXCLUDE_PATTERNS: + ref: "default (list) .EXCLUDE_PATTERNS" FAIL: "{{if eq \"false\" .FAIL}}false{{else}}true{{end}}" + TAR: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" TMP_ERR_LOG: "{{.CHECKSUM_FILE}}.log.tmp" requires: @@ -85,11 +88,11 @@ tasks: cmds: - task: "compute" vars: + CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" INCLUDE_PATTERNS: ref: ".INCLUDE_PATTERNS" EXCLUDE_PATTERNS: - ref: "default (list) .EXCLUDE_PATTERNS" - CHECKSUM_FILE: "{{.TMP_CHECKSUM_FILE}}" + ref: ".EXCLUDE_PATTERNS" FAIL: "false" - defer: |- rm -f "{{.TMP_CHECKSUM_FILE}}" From 93a6296679b12e4b169a2fb9308e87e611680db8 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 12:52:44 -0400 Subject: [PATCH 79/97] readme tweak --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 09613a3..2d39429 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ Before you submit a pull request, ensure you follow the testing and linting inst * [Task] 3.40 or higher * [uv] 0.7.10 or higher -### MacOS +### macOS -The exported tasks use GNU utilities that are not always pre-installed on MacOS. You may need to -install the following brew packages: +The exported tasks use GNU utilities that are not always pre-installed on macOS. You may need to +install the following brew packages and add their executables to your PATH: -* [coreutils] -* [gnu-tar] +* [coreutils]\: `md5sum` +* [gnu-tar]\: `gtar` ## Testing From 5a230b96fdf040364b96a748892e7ec8bca34067 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 13:01:29 -0400 Subject: [PATCH 80/97] doc string tweaks --- exports/taskfiles/utils/checksum.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index ef1376f..86199ee 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -1,8 +1,10 @@ version: "3" tasks: - # Compute the checksum of the given path include patterns saving the result to `CHECKSUM_FILE`. A - # calling task can set `FAIL` to false if they wish to continue after errors. + + # Compute the checksum of the given path include/exclude patterns, saving the result to + # `CHECKSUM_FILE`. The calling task can set `FAIL` to "false" if they wish to continue if checksum + # computation fails. # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. @@ -63,10 +65,10 @@ tasks: {{- end}} fi - # Validates the checksum of the given path include patterns matches the checksum in the given - # file. If validation fails the checksum file is deleted so that a calling task with the checksum - # file in their `generates` field will be reran. A calling task can set `FAIL` to true if they - # wish to halt on failure. + # Validates the checksum of the given path include/exclude patterns matches the checksum in the + # given file. If validation fails the checksum file is deleted, but the task succeeds so that the + # calling task will be reran (by using the checksum file in their `generates` field). The calling + # task can set `FAIL` to "true" if they wish for this task to fail if validation fails. # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to validate the checksum for. From 01280e1f8436855bf2222866b5cb49fb80c5349d Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 15:44:59 -0400 Subject: [PATCH 81/97] fix sub shell and indentation. --- exports/taskfiles/utils/checksum.yaml | 77 +++++++++++++++------------ 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 86199ee..d649696 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -38,27 +38,28 @@ tasks: - defer: "rm -f '{{.TMP_ERR_LOG}}'" - |- if ! \ - {{.TAR}} \ - --create \ - --file - \ - --group 0 \ - --mtime "UTC 1970-01-01" \ - --numeric-owner \ - --owner 0 \ - --sort name \ - --no-anchored \ - --wildcards \ - {{- range .EXCLUDE_PATTERNS}} - --exclude="{{.}}" \ - {{- end}} - {{- range .INCLUDE_PATTERNS}} - {{.}} \ - {{- end}} - 2> {{.TMP_ERR_LOG}} \ - | md5sum > {{.CHECKSUM_FILE}} \ + {{.TAR}} \ + --create \ + --file - \ + --group 0 \ + --mtime "UTC 1970-01-01" \ + --numeric-owner \ + --owner 0 \ + --sort name \ + --no-anchored \ + --wildcards \ + {{- range .EXCLUDE_PATTERNS}} + --exclude="{{.}}" \ + {{- end}} + {{- range .INCLUDE_PATTERNS}} + {{.}} \ + {{- end}} + 2> "{{.TMP_ERR_LOG}}" \ + | md5sum > "{{.CHECKSUM_FILE}}" \ ; then + rm "{{.CHECKSUM_FILE}}" {{- if eq "true" .FAIL}} - echo "[{{.TASK}} error] tar failed with:\n$(cat {{.TMP_ERR_LOG}})" + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" exit 1 {{- else}} exit 0 @@ -102,22 +103,28 @@ tasks: - |- ( {{- range .INCLUDE_PATTERNS}} - for path in {{.}}; do - test -e "$path" \ - || (echo "Include path does not exist: $path" > "{{$.TMP_ERR_LOG}}"; exit 1) - done + for path in {{.}}; do + test -e "${path}" \ + || ( + echo "Include path does not exist: ${path}" > "{{$.TMP_ERR_LOG}}" + exit 1 + ) + done && \ {{- end}} - cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ + ( + cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ + || ( + echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ + > "{{.TMP_ERR_LOG}}" + exit 1 + ) + ) + ) \ || ( - echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ - > "{{.TMP_ERR_LOG}}" - exit 1 + {{- if eq "true" .FAIL}} + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" + exit 1 + {{- else}} + rm -f "{{.CHECKSUM_FILE}}" + {{- end}} ) - ) || ( \ - {{- if eq "true" .FAIL}} - echo "[{{.TASK}} error] failed with:\n$(cat {{.TMP_ERR_LOG}})" - exit 1 - {{- else}} - rm -f "{{.CHECKSUM_FILE}}" - {{- end}} - ) From b6df4171338b3a9a11ccf12d7632e54535fe4254 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 26 Aug 2025 15:57:54 -0400 Subject: [PATCH 82/97] Add -f when removing checksum on failed compute. --- exports/taskfiles/utils/checksum.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index d649696..950f600 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -57,7 +57,7 @@ tasks: 2> "{{.TMP_ERR_LOG}}" \ | md5sum > "{{.CHECKSUM_FILE}}" \ ; then - rm "{{.CHECKSUM_FILE}}" + rm -f "{{.CHECKSUM_FILE}}" {{- if eq "true" .FAIL}} printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" exit 1 From fbe8a72c8e523180dc818c6fc145c5ffd2036438 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 22 Sep 2025 09:57:35 -0400 Subject: [PATCH 83/97] Undo testing comment. --- taskfiles/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskfiles/tests.yaml b/taskfiles/tests.yaml index 3d2efaf..84626f9 100644 --- a/taskfiles/tests.yaml +++ b/taskfiles/tests.yaml @@ -10,7 +10,7 @@ tasks: all: internal: true cmds: - # - task: "boost" + - task: "boost" - task: "checksum" - task: "remote" - task: "ystdlib-py" From 8534c248e86584733e770ff1e4e231aae4884386 Mon Sep 17 00:00:00 2001 From: davidlion Date: Wed, 15 Oct 2025 10:05:54 -0400 Subject: [PATCH 84/97] Apply suggestions from code review. Co-authored-by: Bingran Hu --- exports/taskfiles/utils/checksum.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 950f600..ebcb571 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -20,7 +20,7 @@ tasks: ref: "default (list) .EXCLUDE_PATTERNS" FAIL: "{{if eq \"false\" .FAIL}}false{{else}}true{{end}}" - TAR: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" + ARCHIVER: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" TMP_ERR_LOG: "{{.CHECKSUM_FILE}}.log.tmp" requires: vars: @@ -38,7 +38,7 @@ tasks: - defer: "rm -f '{{.TMP_ERR_LOG}}'" - |- if ! \ - {{.TAR}} \ + {{.ARCHIVER}} \ --create \ --file - \ --group 0 \ @@ -66,16 +66,17 @@ tasks: {{- end}} fi - # Validates the checksum of the given path include/exclude patterns matches the checksum in the - # given file. If validation fails the checksum file is deleted, but the task succeeds so that the - # calling task will be reran (by using the checksum file in their `generates` field). The calling - # task can set `FAIL` to "true" if they wish for this task to fail if validation fails. + # Validates that the checksum computed from the given include/exclude path patterns matches the + # reference checksum stored in the given file. If validation fails, the checksum file is deleted, + # but the task succeeds so dependent tasks that list the checksum file under `generates` will + # rerun automatically. The calling task can set `FAIL` to "true" to make this task fail when the + # validation is expected to succeed. # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to validate the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. - # @param {string} [FAIL="false"] If set to "true" the task fails. + # @param {string} [FAIL="false"] If set to "true", the task fails when checksums mismatch. validate: internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" From bbb32bc21b900bff45e5fbb755f9e53401ed9052 Mon Sep 17 00:00:00 2001 From: davidlion Date: Tue, 28 Oct 2025 01:00:08 -0400 Subject: [PATCH 85/97] Add individual checksum task to tests. --- taskfiles/tests.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/taskfiles/tests.yaml b/taskfiles/tests.yaml index 84626f9..a303a09 100644 --- a/taskfiles/tests.yaml +++ b/taskfiles/tests.yaml @@ -19,6 +19,10 @@ tasks: cmds: - task: "boost:test" + checksum: + cmds: + - task: "checksum:default" + remote: cmds: - task: "remote:default" From 3871d7d91e7c4356d81052b178e013e01f6f036e Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 14 Nov 2025 09:01:29 -0500 Subject: [PATCH 86/97] Apply suggestions from code review. Co-authored-by: Bingran Hu Co-authored-by: Junhao Liao --- exports/taskfiles/utils/checksum.yaml | 78 +++++++++++++-------------- taskfiles/checksum/tests.yaml | 2 +- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index b2e4a4f..c53f3c7 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -10,7 +10,7 @@ tasks: # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. - # @param {string} [FAIL="true"] If set to "false" the task will not fail. + # @param {string} [FAIL="true"] If set to "false", the task will not fail. compute: internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" @@ -39,28 +39,28 @@ tasks: - defer: "rm -f '{{.TMP_ERR_LOG}}'" - |- if ! \ - {{.ARCHIVER}} \ - --create \ - --file - \ - --group 0 \ - --mtime "UTC 1970-01-01" \ - --numeric-owner \ - --owner 0 \ - --sort name \ - --no-anchored \ - --wildcards \ - {{- range .EXCLUDE_PATTERNS}} - --exclude="{{.}}" \ - {{- end}} - {{- range .INCLUDE_PATTERNS}} - {{.}} \ - {{- end}} - 2> "{{.TMP_ERR_LOG}}" \ - | md5sum > "{{.CHECKSUM_FILE}}" \ + {{.ARCHIVER}} \ + --create \ + --file - \ + --group 0 \ + --mtime "UTC 1970-01-01" \ + --numeric-owner \ + --owner 0 \ + --sort name \ + --no-anchored \ + --wildcards \ + {{- range .EXCLUDE_PATTERNS}} + --exclude="{{.}}" \ + {{- end}} + {{- range .INCLUDE_PATTERNS}} + {{.}} \ + {{- end}} + 2> "{{.TMP_ERR_LOG}}" \ + | md5sum > "{{.CHECKSUM_FILE}}" \ ; then rm -f "{{.CHECKSUM_FILE}}" {{- if eq "true" .FAIL}} - printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat '{{.TMP_ERR_LOG}}')" exit 1 {{- else}} exit 0 @@ -107,26 +107,26 @@ tasks: {{- range .INCLUDE_PATTERNS}} for path in {{.}}; do test -e "${path}" \ - || ( - echo "Include path does not exist: ${path}" > "{{$.TMP_ERR_LOG}}" - exit 1 - ) - done && \ - {{- end}} - ( - cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ || ( - echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ - > "{{.TMP_ERR_LOG}}" + echo "Include path does not exist: ${path}" > "{{$.TMP_ERR_LOG}}" exit 1 - ) - ) - ) \ - || ( - {{- if eq "true" .FAIL}} - printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" + ) + done && \ + {{- end}} + ( + cmp -s "{{.TMP_CHECKSUM_FILE}}" "{{.CHECKSUM_FILE}}" \ + || ( + echo "cmp failed for '{{.TMP_CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}'" \ + > "{{.TMP_ERR_LOG}}" exit 1 - {{- else}} - rm -f "{{.CHECKSUM_FILE}}" - {{- end}} + ) ) + ) \ + || ( + {{- if eq "true" .FAIL}} + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" + exit 1 + {{- else}} + rm -f "{{.CHECKSUM_FILE}}" + {{- end}} + ) diff --git a/taskfiles/checksum/tests.yaml b/taskfiles/checksum/tests.yaml index 6986408..a3795c0 100644 --- a/taskfiles/checksum/tests.yaml +++ b/taskfiles/checksum/tests.yaml @@ -108,7 +108,7 @@ tasks: # different from the original. - "test -e '{{.FILE_0}}'" - "test ! -e '{{.FILE_1}}'" - - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" + - "cmp -s '{{.FILE_0}}' '{{.CHECKSUM_FILE_REF0}}'" - "cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF1}}'" - |- if ! cmp -s '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE_REF0}}'; then From d07138ebfc4c0b7e59745c2b1210a31ec65d925d Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 14 Nov 2025 09:18:35 -0500 Subject: [PATCH 87/97] Address review comments and tweak if statements. --- exports/taskfiles/utils/checksum.yaml | 29 ++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index c53f3c7..d0a9d95 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -1,16 +1,15 @@ version: "3" tasks: - # Compute the checksum of the given path include/exclude patterns, saving the result to - # `CHECKSUM_FILE`. The calling task can set `FAIL` to "false" if they wish to continue if checksum - # computation fails. + # `CHECKSUM_FILE`. The calling task can set `IGNORE_ERROR` to "false" if they wish to continue if + # checksum computation fails. # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. - # @param {string} [FAIL="true"] If set to "false", the task will not fail. + # @param {string} [IGNORE_ERROR="false"] If set to "true", the task will not fail on error. compute: internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" @@ -18,7 +17,7 @@ tasks: vars: EXCLUDE_PATTERNS: ref: "default (list) .EXCLUDE_PATTERNS" - FAIL: "{{if eq \"false\" .FAIL}}false{{else}}true{{end}}" + IGNORE_ERROR: "{{if eq \"true\" .IGNORE_ERROR}}true{{else}}false{{end}}" ARCHIVER: "{{if eq OS \"darwin\"}}gtar{{else}}tar{{end}}" TMP_ERR_LOG: "{{.CHECKSUM_FILE}}.log.tmp" @@ -59,31 +58,30 @@ tasks: | md5sum > "{{.CHECKSUM_FILE}}" \ ; then rm -f "{{.CHECKSUM_FILE}}" - {{- if eq "true" .FAIL}} + {{- if eq "false" .IGNORE_ERROR}} printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat '{{.TMP_ERR_LOG}}')" exit 1 - {{- else}} - exit 0 {{- end}} fi # Validates that the checksum computed from the given include/exclude path patterns matches the # reference checksum stored in the given file. If validation fails, the checksum file is deleted, # but the task succeeds so dependent tasks that list the checksum file under `generates` will - # rerun automatically. The calling task can set `FAIL` to "true" to make this task fail when the - # validation is expected to succeed. + # rerun automatically. The calling task can set `FAIL_ON_ERROR` to "true" to make this task fail + # when the validation is expected to succeed. # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to validate the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, # to exclude from the checksum. - # @param {string} [FAIL="false"] If set to "true", the task fails when checksums mismatch. + # @param {string} [FAIL_ON_ERROR="false"] If set to "true", the task fails when checksums + # mismatch. validate: internal: true label: "{{.TASK}}-{{.CHECKSUM_FILE}}" silent: true vars: - FAIL: "{{if eq \"true\" .FAIL}}true{{else}}false{{end}}" + FAIL_ON_ERROR: "{{if eq \"true\" .FAIL_ON_ERROR}}true{{else}}false{{end}}" TMP_CHECKSUM_FILE: "{{.CHECKSUM_FILE}}.tmp" TMP_ERR_LOG: "{{.CHECKSUM_FILE}}.log.tmp" requires: @@ -98,7 +96,7 @@ tasks: ref: ".INCLUDE_PATTERNS" EXCLUDE_PATTERNS: ref: ".EXCLUDE_PATTERNS" - FAIL: "false" + IGNORE_ERROR: "true" - defer: |- rm -f "{{.TMP_CHECKSUM_FILE}}" rm -f "{{.TMP_ERR_LOG}}" @@ -123,10 +121,9 @@ tasks: ) ) \ || ( - {{- if eq "true" .FAIL}} + {{- if eq "true" .FAIL_ON_ERROR}} printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" exit 1 - {{- else}} - rm -f "{{.CHECKSUM_FILE}}" {{- end}} + rm -f "{{.CHECKSUM_FILE}}" ) From 95f680a60fd74129c7fcbd4422600a8d51c469ad Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 14 Nov 2025 09:37:14 -0500 Subject: [PATCH 88/97] Revert workflow concurrency test. --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index aabe8fa..cce541c 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -39,4 +39,4 @@ jobs: run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh" - name: "Run unit tests" - run: "task test --concurrency 1 --verbose" + run: "task test" From 8363fc4f828a0a3558962fde7d6c15aabb71aa7c Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 14 Nov 2025 09:45:07 -0500 Subject: [PATCH 89/97] Add pipefail note to compute. --- exports/taskfiles/utils/checksum.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index d0a9d95..0d5827b 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -5,6 +5,9 @@ tasks: # `CHECKSUM_FILE`. The calling task can set `IGNORE_ERROR` to "false" if they wish to continue if # checksum computation fails. # + # Note that using this task without setting `pipefail` in the root taskfile will cause `tar` + # failures to be ignored. + # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. # @param {string[]} [EXCLUDE_PATTERNS] Path wildcard patterns, relative to any `INCLUDE_PATTERNS`, From 3bd67a05d257263b69af92f83b415bd10ad4d76f Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 14 Nov 2025 10:10:59 -0500 Subject: [PATCH 90/97] Fix coderabbit nits. --- exports/taskfiles/utils/checksum.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 0d5827b..487710d 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -2,7 +2,7 @@ version: "3" tasks: # Compute the checksum of the given path include/exclude patterns, saving the result to - # `CHECKSUM_FILE`. The calling task can set `IGNORE_ERROR` to "false" if they wish to continue if + # `CHECKSUM_FILE`. The calling task can set `IGNORE_ERROR` to "true" if they wish to continue if # checksum computation fails. # # Note that using this task without setting `pipefail` in the root taskfile will cause `tar` @@ -125,7 +125,7 @@ tasks: ) \ || ( {{- if eq "true" .FAIL_ON_ERROR}} - printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat {{.TMP_ERR_LOG}})" + printf "[{{.TASK}} error] failed with:\n%s\n" "$(cat '{{.TMP_ERR_LOG}}')" exit 1 {{- end}} rm -f "{{.CHECKSUM_FILE}}" From 51a1547a2fd08588c9d74f844e4a98f0d2fb9923 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 17 Nov 2025 10:14:41 -0500 Subject: [PATCH 91/97] Update doc strings with latest and greatest ideas. --- exports/taskfiles/utils/boost.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index fc100cf..4a29614 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -14,7 +14,7 @@ tasks: # @param {string} SOURCE_DIR Project source directory. # @param {string[]} TARGETS Target libraries to build. # @param {string} [CHECKSUM_FILE={{.SOURCE_DIR}}.md5] Checksum file path for `SOURCE_DIR`. - # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the generate command. + # @param {string[]} [EXTRA_ARGS=[]] Any additional arguments to pass to the generate command. generate: internal: true label: "{{.TASK}}:{{.SOURCE_DIR}}" @@ -70,10 +70,10 @@ tasks: # @param {string} [SOURCE_CHECKSUM_FILE={{.SOURCE_DIR}}.md5] Checksum file path for `SOURCE_DIR`. # # Build command parameters - # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If - # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the + # @param {int} [JOBS=0] The maximum number of concurrent processes to use when building. If 0, the + # b2 flag is ommitted and the default is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command. + # @param {string[]} [EXTRA_ARGS=[]] Any additional arguments to pass to the build command. build-and-install: internal: true label: "{{.TASK}}:{{.BUILD_DIR}}-{{.INSTALL_PREFIX}}" @@ -149,16 +149,16 @@ tasks: # @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against. # @param {string} TAR_URL URL of the tar file to download. # @param {string} WORK_DIR Directory in which to store the source, build, and install directories. - # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings + # @param {string} [CMAKE_SETTINGS_DIR=""] If set, the directory where the project's CMake settings # file should be stored. # # Boost parameters # @param {string[]} TARGETS Target libraries to build. - # @param {string[]} [BUILD_AND_INSTALL_ARGS] Any additional arguments to pass to boost's build and - # install command. - # @param {string[]} [GENERATE_ARGS] Any additional arguments to pass to the generate command. - # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If - # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the + # @param {string[]} [BUILD_AND_INSTALL_ARGS=[]] Any additional arguments to pass to boost's build + # and install command. + # @param {string[]} [GENERATE_ARGS=[]] Any additional arguments to pass to the generate command. + # @param {int} [JOBS=0] The maximum number of concurrent processes to use when building. If 0, the + # b2 flag is ommitted and the default is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. download-and-install: internal: true From d9efd119a91162407db26b5646d2e23b4491f50f Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 17 Nov 2025 10:24:20 -0500 Subject: [PATCH 92/97] Change SOURCE_DIR to EXTRACTION to be consistent. --- exports/taskfiles/utils/boost.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 4a29614..3e6dea9 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -166,8 +166,8 @@ tasks: vars: # Directory parameters BUILD_DIR: "{{.WORK_DIR}}/boost-build" + EXTRACTION_DIR: "{{.WORK_DIR}}/boost-extracted" INSTALL_PREFIX: "{{.WORK_DIR}}/boost-install" - SOURCE_DIR: "{{.WORK_DIR}}/boost-src" requires: vars: - "TAR_SHA256" @@ -178,13 +178,13 @@ tasks: - task: "remote:download-and-extract-tar" vars: FILE_SHA256: "{{.TAR_SHA256}}" - OUTPUT_DIR: "{{.SOURCE_DIR}}" + OUTPUT_DIR: "{{.EXTRACTION_DIR}}" URL: "{{.TAR_URL}}" cmds: - task: "generate" vars: INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" - SOURCE_DIR: "{{.SOURCE_DIR}}" + SOURCE_DIR: "{{.EXTRACTION_DIR}}" TARGETS: ref: ".TARGETS" EXTRA_ARGS: @@ -193,7 +193,7 @@ tasks: vars: BUILD_DIR: "{{.BUILD_DIR}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" - SOURCE_DIR: "{{.SOURCE_DIR}}" + SOURCE_DIR: "{{.EXTRACTION_DIR}}" EXTRA_ARGS: ref: ".BUILD_AND_INSTALL_ARGS" JOBS: "{{.JOBS}}" From 40cf0b3ac6512d8eac233b84b5f5c73827f91e72 Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 17 Nov 2025 11:35:22 -0500 Subject: [PATCH 93/97] Fix boost args by removing quotes and spaces. --- exports/taskfiles/utils/boost.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 3e6dea9..5d4c58f 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -121,10 +121,10 @@ tasks: install --build-dir="{{.BUILD_DIR}}" {{- range .EXTRA_ARGS}} - "{{.}}" + {{.}} {{- end}} {{- if .JOBS}} - "-j{{.JOBS}}" + -j{{.JOBS}} {{- end}}; popd; - "touch '{{.SOURCE_SENTINEL_FILE}}'" From f425cc6c3b564d83da956b735adf169960423c2b Mon Sep 17 00:00:00 2001 From: davidlion Date: Mon, 17 Nov 2025 12:31:19 -0500 Subject: [PATCH 94/97] Reorganize doc strings a bit. --- exports/taskfiles/utils/boost.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 5d4c58f..166850f 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -70,10 +70,10 @@ tasks: # @param {string} [SOURCE_CHECKSUM_FILE={{.SOURCE_DIR}}.md5] Checksum file path for `SOURCE_DIR`. # # Build command parameters + # @param {string[]} [EXTRA_ARGS=[]] Any additional arguments to pass to the build command. # @param {int} [JOBS=0] The maximum number of concurrent processes to use when building. If 0, the # b2 flag is ommitted and the default is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - # @param {string[]} [EXTRA_ARGS=[]] Any additional arguments to pass to the build command. build-and-install: internal: true label: "{{.TASK}}:{{.BUILD_DIR}}-{{.INSTALL_PREFIX}}" @@ -145,17 +145,17 @@ tasks: # If `CMAKE_SETTINGS_DIR` is set, a settings file will be created in that directory, containing a # `Boost_ROOT` CMake variable that points to `INSTALL_PREFIX`. # - # General parameters + # Required parameters # @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against. # @param {string} TAR_URL URL of the tar file to download. + # @param {string[]} TARGETS Target libraries to build. # @param {string} WORK_DIR Directory in which to store the source, build, and install directories. - # @param {string} [CMAKE_SETTINGS_DIR=""] If set, the directory where the project's CMake settings - # file should be stored. # # Boost parameters - # @param {string[]} TARGETS Target libraries to build. # @param {string[]} [BUILD_AND_INSTALL_ARGS=[]] Any additional arguments to pass to boost's build # and install command. + # @param {string} [CMAKE_SETTINGS_DIR=""] If set, the directory where the project's CMake settings + # file should be stored. # @param {string[]} [GENERATE_ARGS=[]] Any additional arguments to pass to the generate command. # @param {int} [JOBS=0] The maximum number of concurrent processes to use when building. If 0, the # b2 flag is ommitted and the default is used. Before 1.76.0, the number was 1. Since 1.76.0, the From 509bc3c4d61ed9ccb965f8ac56d36a0fbe81e876 Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 21 Nov 2025 21:03:19 -0500 Subject: [PATCH 95/97] Touch ups. --- exports/taskfiles/utils/boost.yaml | 23 ++++++++++------------- taskfiles/boost/tests.yaml | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 166850f..13a62d6 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -8,7 +8,9 @@ set: ["u", "pipefail"] shopt: ["globstar"] tasks: - # Runs the Boost generate (bootstrap) step. + # Runs Boost's generate (bootstrap) step. + # A sentinel file is written to `SOURCE_DIR` and added to `generates` to explicitly track whether + # this task updated `SOURCE_DIR`. # # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. # @param {string} SOURCE_DIR Project source directory. @@ -21,14 +23,12 @@ tasks: vars: CHECKSUM_FILE: >- {{default (printf "%s.md5" .SOURCE_DIR) .CHECKSUM_FILE}} - EXTRA_ARGS: - ref: "default (list) .EXTRA_ARGS" SOURCE_SENTINEL_FILE: "{{.SOURCE_DIR}}/{{.TASK}}.sentinel" requires: vars: - "INSTALL_PREFIX" - - "TARGETS" - "SOURCE_DIR" + - "TARGETS" sources: ["{{.TASKFILE}}"] generates: - "{{.CHECKSUM_FILE}}" @@ -46,7 +46,7 @@ tasks: --exec-prefix="{{.INSTALL_PREFIX}}" --with-libraries={{(join "," .TARGETS)}} {{- range .EXTRA_ARGS}} - "{{.}}" + {{.}} {{- end}}; popd - "touch '{{.SOURCE_SENTINEL_FILE}}'" @@ -55,8 +55,10 @@ tasks: CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] - # Runs Boost's b2 build and install step. + # Runs Boost's combined b2 build and install step. # Fails if the caller has not successfully called `generate` on `SOURCE_DIR`. + # A sentinel file is written to `SOURCE_DIR` and added to `generates` to explicitly track whether + # this task updated `SOURCE_DIR`. # # Required parameters # @param {string} BUILD_DIR Directory in which to build boost. @@ -69,7 +71,7 @@ tasks: # `INSTALL_PREFIX` # @param {string} [SOURCE_CHECKSUM_FILE={{.SOURCE_DIR}}.md5] Checksum file path for `SOURCE_DIR`. # - # Build command parameters + # b2 parameters # @param {string[]} [EXTRA_ARGS=[]] Any additional arguments to pass to the build command. # @param {int} [JOBS=0] The maximum number of concurrent processes to use when building. If 0, the # b2 flag is ommitted and the default is used. Before 1.76.0, the number was 1. Since 1.76.0, the @@ -78,16 +80,12 @@ tasks: internal: true label: "{{.TASK}}:{{.BUILD_DIR}}-{{.INSTALL_PREFIX}}" vars: - # Checksum files BUILD_CHECKSUM_FILE: >- {{default (printf "%s.md5" .BUILD_DIR) .BUILD_CHECKSUM_FILE}} INSTALL_CHECKSUM_FILE: >- {{default (printf "%s.md5" .INSTALL_PREFIX) .INSTALL_CHECKSUM_FILE}} SOURCE_CHECKSUM_FILE: >- {{default (printf "%s.md5" .SOURCE_DIR) .SOURCE_CHECKSUM_FILE}} - - EXTRA_ARGS: - ref: "default (list) .EXTRA_ARGS" SOURCE_SENTINEL_FILE: "{{.SOURCE_DIR}}/{{.TASK}}.sentinel" requires: vars: @@ -143,7 +141,7 @@ tasks: # Downloads Boost from `TAR_URL` and then generates, builds, and installs Boost inside `WORK_DIR`. # If `CMAKE_SETTINGS_DIR` is set, a settings file will be created in that directory, containing a - # `Boost_ROOT` CMake variable that points to `INSTALL_PREFIX`. + # `Boost_ROOT` CMake variable that points to the installation. # # Required parameters # @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against. @@ -164,7 +162,6 @@ tasks: internal: true label: "{{.TASK}}:{{.TAR_URL}}-{{.WORK_DIR}}" vars: - # Directory parameters BUILD_DIR: "{{.WORK_DIR}}/boost-build" EXTRACTION_DIR: "{{.WORK_DIR}}/boost-extracted" INSTALL_PREFIX: "{{.WORK_DIR}}/boost-install" diff --git a/taskfiles/boost/tests.yaml b/taskfiles/boost/tests.yaml index 85570c1..167e55a 100644 --- a/taskfiles/boost/tests.yaml +++ b/taskfiles/boost/tests.yaml @@ -47,7 +47,6 @@ tasks: cmds: - task: "utils:boost:download-and-install" vars: - WORK_DIR: "{{.G_BOOST_DEPS_DIR}}/boost" TAR_SHA256: "aa25e7b9c227c21abb8a681efd4fe6e54823815ffc12394c9339de998eb503fb" TAR_URL: "https://github.com/boostorg/boost/releases/download/boost-1.89.0/\ boost-1.89.0-b2-nodocs.tar.gz" @@ -60,6 +59,7 @@ tasks: - "program_options" - "regex" - "url" + WORK_DIR: "{{.G_BOOST_DEPS_DIR}}/boost" run-boost-test: internal: true From 6773dcc42a6ace7725b6155c60a20ee76c476f3c Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 21 Nov 2025 22:07:21 -0500 Subject: [PATCH 96/97] FAIL -> FAIL_ON_ERROR --- exports/taskfiles/utils/boost.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 13a62d6..669cca2 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -111,7 +111,7 @@ tasks: vars: CHECKSUM_FILE: "{{.SOURCE_CHECKSUM_FILE}}" INCLUDE_PATTERNS: ["{{.SOURCE_DIR}}"] - FAIL: "true" + FAIL_ON_ERROR: "true" cmds: - >- pushd "{{.SOURCE_DIR}}"; From 310401e61acfc4063d8b9969fc7607f366ef7b39 Mon Sep 17 00:00:00 2001 From: davidlion Date: Fri, 21 Nov 2025 22:07:49 -0500 Subject: [PATCH 97/97] Add checksum docs and re-add set/shopt. --- exports/taskfiles/utils/checksum.yaml | 38 ++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/exports/taskfiles/utils/checksum.yaml b/exports/taskfiles/utils/checksum.yaml index 8896296..ac60efa 100644 --- a/exports/taskfiles/utils/checksum.yaml +++ b/exports/taskfiles/utils/checksum.yaml @@ -1,13 +1,45 @@ version: "3" +set: ["u", "pipefail"] +shopt: ["globstar"] + +# The checksum tasks are a robust way for a task to decided whether or not it should run. +# +# For many tasks it is not feasible to list out all files in `sources` and `generates`. These tasks +# provide a way to `compute` a checksum for the contents of directories/files and `validate` whether +# the contents still match the checksum in later runs. +# +# When creating a checksum a task should: +# +# a. Call the `compute` task at the end to create the checksum file. +# b. Call `validate` in `deps` to verify the checksum file matches the current contents. +# - `validate` will delete the checksum file if there is no match. +# c. Add the checksum file to `generates`. This ensures the task runs if: +# - The task has not run before. +# - `validate` deleted the checksum file as the contents did not match. +# +# When multiple tasks mutate the same contents, each task updates the checksum file and also tracks +# whether it has run or not by creating a sentinel file. +# +# a. Before calling `compute`, create a sentinel file with a name unique to the task. +# b. Add the sentinel file to `generates`. This ensures the task runs if: +# - The checksum file exists and matches the contents, but this task has not been run. +# +# Additional guidelines: +# +# - When creating a directory that will be included in a checksum, always delete any existing +# contents first. +# - This ensures that if the contents diverge from the checksum file, the task is re-run with no +# stale data. +# - If task, A, implicitly depends on task, B, but A does not call `B` in `deps`, it is possible +# for a user to run A without having run B. A can ensure it fails gracefully by calling `validate` +# on B's checksum with `FAIL_ON_ERROR: "true"`. + tasks: # Compute the checksum of the given path include/exclude patterns, saving the result to # `CHECKSUM_FILE`. The calling task can set `IGNORE_ERROR` to "true" if they wish to continue if # checksum computation fails. # - # Note that using this task without setting `pipefail` in the root taskfile will cause `tar` - # failures to be ignored. - # # @param {string} CHECKSUM_FILE # @param {string[]} INCLUDE_PATTERNS Path wildcard patterns to compute the checksum for. # @param {string[]} [EXCLUDE_PATTERNS=[]] Path wildcard patterns, relative to any