From 26bd4144f74131a55256cc6073d0c36e1e662736 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 2 Jun 2024 13:42:34 +0900 Subject: [PATCH] Add `nightly` recipe Installs the last revision in the previous `RUBY_RELEASE_DATE`. --- common.mk | 16 ++++++++++++++++ template/Makefile.in | 4 ++++ win32/Makefile.sub | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/common.mk b/common.mk index 42c9c65803..516481739e 100644 --- a/common.mk +++ b/common.mk @@ -1887,6 +1887,22 @@ ChangeLog: -e 'VCS.detect(ARGV[0]).export_changelog(path: ARGV[1])' \ "$(srcdir)" $@ +# CAUTION: If using GNU make 3 which does not support `.WAIT`, this +# recipe with multiple jobs makes build and `git reset` run +# simultaneously, and will cause inconsistent results. Run with `-j1` +# or update GNU make. +nightly: yesterday $(DOT_WAIT) install + $(NULLCMD) + +# Rewind to the last commit "yesterday". "Yesterday" means here the +# period where `RUBY_RELEASE_DATE` is the day before the date to be +# generated now. In short, the yesterday in JST-9 time zone. +yesterday: rewindable + +rewindable: + $(GIT) -C $(srcdir) status --porcelain + $(GIT) -C $(srcdir) diff --quiet + HELP_EXTRA_TASKS = "" help: PHONY diff --git a/template/Makefile.in b/template/Makefile.in index 22148e7fea..033ac56cb3 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -687,3 +687,7 @@ yes-test-syntax-suggest: $(PREPARE_SYNTAX_SUGGEST) $(RSPECOPTS) spec/syntax_suggest/$(SYNTAX_SUGGEST_SPECS) $(ACTIONS_ENDGROUP) no-test-syntax-suggest: + +yesterday: + $(GIT) -C $(srcdir) reset --hard \ + `$(GIT) -C $(srcdir) log -1 --before=00:00+0900 --format=%H` diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 61cca10857..b125bf5555 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -1438,3 +1438,8 @@ rubyspec-capiext: $(RUBYSPEC_CAPIEXT_EXTS) !endif exts: rubyspec-capiext + +yesterday: + for /f "usebackq" %H in \ + (`$(GIT) -C $(srcdir) log -1 "--before=00:00+0900" "--format=%H"`) do \ + $(GIT) -C $(srcdir) reset --hard %%H