jw-pkg/make/run-success.mk
Jan Lindemann 2fcda74277
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m27s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m43s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m0s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m16s
CI / Packaging test (push) Successful in 0s
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 <jan@janware.com>
2026-09-16 18:16:17 +02:00

15 lines
413 B
Makefile

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)