Skip to content

Commit 5ce27be

Browse files
committed
Flush NEWS.md only when NEW is not given
Split flushing NEWS and bumping up versions
1 parent bca8fce commit 5ce27be

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

defs/gmake.mk

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -538,34 +538,53 @@ spec/%/ spec/%_spec.rb: programs exts PHONY
538538
ruby.pc: $(filter-out ruby.pc,$(ruby_pc))
539539

540540
matz: up
541-
$(eval OLD := $(MAJOR).$(MINOR).0)
541+
542+
matz: OLD := $(MAJOR).$(MINOR).0
542543
ifdef NEW
543-
$(eval MAJOR := $(word 1,$(subst ., ,$(NEW))))
544-
$(eval MINOR := $(word 2,$(subst ., ,$(NEW))))
544+
matz: MAJOR := $(word 1,$(subst ., ,$(NEW)))
545+
matz: MINOR := $(word 2,$(subst ., ,$(NEW)))
546+
matz: .WAIT bump_news
545547
else
546-
$(eval MINOR := $(shell expr $(MINOR) + 1))
548+
matz: MINOR := $(shell expr $(MINOR) + 1)
549+
matz: .WAIT reset_news
547550
endif
548-
$(eval override NEW := $(MAJOR).$(MINOR).0)
549-
$(eval message := Development of $(NEW) started.)
550-
$(eval files := include/ruby/version.h include/ruby/internal/abi.h)
551+
552+
matz: .WAIT bump_headers
553+
matz: override NEW := $(MAJOR).$(MINOR).0
554+
matz: files := include/ruby/version.h include/ruby/internal/abi.h
555+
matz: message := Development of $(NEW) started.
556+
557+
flush_news:
551558
$(GIT_IN_SRC) mv -f NEWS.md doc/NEWS/NEWS-$(OLD).md
552559
$(GIT_IN_SRC) commit -m "[DOC] Flush NEWS.md"
560+
561+
.PHONY: flush_news reset_news bump_news bump_headers
562+
563+
bump_headers:
553564
sed -i~ \
554565
-e "s/^\(#define RUBY_API_VERSION_MAJOR\) .*/\1 $(MAJOR)/" \
555566
-e "s/^\(#define RUBY_API_VERSION_MINOR\) .*/\1 $(MINOR)/" \
556567
-e "s/^\(#define RUBY_ABI_VERSION\) .*/\1 0/" \
557568
$(files:%=$(srcdir)/%)
558-
$(GIT_IN_SRC) add $(files)
569+
570+
reset_news: flush_news
559571
$(BASERUBY) -C $(srcdir) -p -00 \
560-
-e 'BEGIN {old, new = ARGV.shift(2); STDOUT.reopen("NEWS.md")}' \
572+
-e 'BEGIN {old, new = ARGV.shift(2); STDOUT.reopen(ARGV.shift)}' \
561573
-e 'case $$.' \
562574
-e 'when 1; $$_.sub!(/Ruby \K[0-9.]+/, new)' \
563575
-e 'when 2; $$_.sub!(/\*\*\K[0-9.]+(?=\*\*)/, old)' \
564576
-e 'end' \
565577
-e 'next if /^[\[ *]/ =~ $$_' \
566578
-e '$$_.sub!(/\n{2,}\z/, "\n\n")' \
567-
$(OLD) $(NEW) doc/NEWS/NEWS-$(OLD).md
568-
$(GIT_IN_SRC) add NEWS.md
579+
$(OLD) $(NEW) NEWS.md doc/NEWS/NEWS-$(OLD).md
580+
581+
bump_news:
582+
$(BASERUBY) -C $(srcdir) -p -i \
583+
-e 'BEGIN {new = ARGV.shift; print gets("").sub(/Ruby \K[0-9.]+/, new)}' \
584+
$(NEW) NEWS.md
585+
586+
matz:
587+
$(GIT_IN_SRC) add NEWS.md $(files)
569588
$(GIT_IN_SRC) commit -m "$(message)"
570589

571590
tags:

0 commit comments

Comments
 (0)