From 2fcda74277f9833863884efadbcf2d86276a8dad Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 16 Sep 2026 16:17:04 +0200 Subject: [PATCH] run-success.mk: Record last successful run Add a run-success.mk which provides a $(RUN_SUCCESS_CREATE_MARKER) variable, and include it from run.mk and py-run.mk. If it's not overridden, it logs the current commit to a marker file if the run succeeds. The marker file is ignored from Git and cleaned in the context of the distclean target. The machinery can be customized by variables: RUN_SUCCESS_MARKER is the name of the marker file RUN_SUCCESS_RECORD_CMD is the generator for its content For example, putting this into local.mk or jw-pkg/make/local.mk will record the hashes of every repository in the entire workspace: define RUN_SUCCESS_RECORD_CMD make git-log-1 make git-log-tree-1 endef Signed-off-by: Jan Lindemann --- .gitignore | 8 +++----- conf/templates/gitignore | 1 + make/py-run.mk | 2 ++ make/run-success.mk | 15 +++++++++++++++ make/run.mk | 3 +++ 5 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 make/run-success.mk diff --git a/.gitignore b/.gitignore index bb98da71..2f6f064a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ *tmp* *~ .cache-project.mk -.cache-projects.mk .exrc .feedfs_history .gdb_history @@ -38,20 +37,19 @@ bin/*.tcl conftest.py core dist +last-successful-run.txt ld-*.conf local.conf local.mk -local.mk local.yaml make/*.pc -make/ssh-wrapper.sh mkspec.sh pr-descr*.txt pre-local.mk pyproject.toml pyrightconfig.json test-out.txt -test/integration/jw-pkg/projects/cache/test-pyproject.toml -test/integration/jw-pkg/projects/cache/test-pyrightconfig.json !*.jw-tmpl !*.tmpl +.cache-projects.mk +make/ssh-wrapper.sh diff --git a/conf/templates/gitignore b/conf/templates/gitignore index a64843f4..003b5541 100644 --- a/conf/templates/gitignore +++ b/conf/templates/gitignore @@ -38,6 +38,7 @@ bin/*.tcl conftest.py core dist +last-successful-run.txt ld-*.conf local.conf local.mk diff --git a/make/py-run.mk b/make/py-run.mk index c2c8f80f..629f88b1 100644 --- a/make/py-run.mk +++ b/make/py-run.mk @@ -1,6 +1,7 @@ include $(JWBDIR)/make/defs.mk include $(JWBDIR)/make/py-defs.mk include $(JWBDIR)/make/test-guard.mk +include $(JWBDIR)/make/run-success.mk EXE ?= $(firstword $(wildcard main.py runme.py test.py *.py)) EXE_ARGS ?= @@ -14,6 +15,7 @@ test: all testability run: $(PYTHON_RUNNER) $(EXE) $(EXE_ARGS) + $(RUN_SUCCESS_CREATE_MARKER) run.sh: echo -e "#!/bin/bash\n\nexport PYTHONPATH=$(PYTHONPATH)\nset -x\nexec $(PYTHON) $(EXE)" '"$$@"' > $@.tmp diff --git a/make/run-success.mk b/make/run-success.mk new file mode 100644 index 00000000..ae4927ba --- /dev/null +++ b/make/run-success.mk @@ -0,0 +1,15 @@ +ifndef RUN_SUCCESS_RECORD_CMD + RUN_SUCCESS_RECORD_CMD := git log --oneline -1 +endif + +ifndef RUN_SUCCESS_MARKER + RUN_SUCCESS_MARKER := last-successful-run.txt +endif + +RUN_SUCCESS_CREATE_MARKER = $(RUN_SUCCESS_RECORD_CMD) > $(RUN_SUCCESS_MARKER).tmp && \ + mv $(RUN_SUCCESS_MARKER).tmp $(RUN_SUCCESS_MARKER) +all: + +distclean: distclean.run-success +distclean.run-success: + rm -f $(RUN_SUCCESS_MARKER) diff --git a/make/run.mk b/make/run.mk index 95fd8b91..ac106315 100644 --- a/make/run.mk +++ b/make/run.mk @@ -5,6 +5,7 @@ include $(JWBDIR)/make/defs.mk include $(JWBDIR)/make/defs-cpp.mk +include $(JWBDIR)/make/run-success.mk DIR_BASENAME = $(notdir $(CWD)) @@ -76,6 +77,7 @@ run test: run-deps @echo "wine $(EXE_CMD)" @echo -e "set PATH=%PATH;$(DLL_PATH)\n" \ "$(EXE_CMD)" | wine cmd + $(RUN_SUCCESS_CREATE_MARKER) start: run-deps @echo "wine $(EXE_CMD)" @@ -85,6 +87,7 @@ start: run-deps else run test: run-deps $(EXE_CMD) + $(RUN_SUCCESS_CREATE_MARKER) start: run-deps $(EXE_CMD) &