diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2025-12-11 16:42:23 -0800 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-12-11 16:45:04 -0800 |
| commit | 06a6ad44f6faf35542e0bd1e15658340d449c2cf (patch) | |
| tree | b22ce0318b16940c050b44fbbd6ddec19f8ddb2b /tool | |
| parent | 6601640c68b02f0bf1ad58d9122e76c84b735f91 (diff) | |
make-snapshot: Remove an unnecessary variable
This is a refactoring change, which should have no impact on behaviors.
Now, if patchlevel is true, tag is empty. So `if patchlevel` always does
nothing. Given that prerelease is false and tag is not nil, removing
`if patchlevel` should have no impact.
Diffstat (limited to 'tool')
| -rwxr-xr-x | tool/make-snapshot | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/tool/make-snapshot b/tool/make-snapshot index 0a03fb2a22..041b1a0f2a 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -253,7 +253,6 @@ end def package(vcs, rev, destdir, tmp = nil) pwd = Dir.pwd - patchlevel = false prerelease = false if rev and revision = rev[/@(\h+)\z/, 1] rev = $` @@ -275,7 +274,6 @@ def package(vcs, rev, destdir, tmp = nil) tag = "#{$4}#{$5}" url = vcs.tag("v#{$1}_#{$2}_#{$3}_#{$4}#{$5}") when /\A(\d+)\.(\d+)\.(\d+)\z/ - patchlevel = true tag = "" url = vcs.tag("v#{$1}_#{$2}_#{$3}") when /\A(\d+)\.(\d+)\z/ @@ -351,13 +349,7 @@ def package(vcs, rev, destdir, tmp = nil) [api_major_version, api_minor_version, version_teeny].join('.') end version or return - if patchlevel - unless tag.empty? - versionhdr ||= File.read("#{v}/version.h") - patchlevel = versionhdr[/^\#define\s+RUBY_PATCHLEVEL\s+(\d+)/, 1] - tag = (patchlevel ? "p#{patchlevel}" : vcs.revision_name(revision)) - end - elsif prerelease + if prerelease versionhdr ||= File.read("#{v}/version.h") versionhdr.sub!(/^\#\s*define\s+RUBY_PATCHLEVEL_STR\s+"\K.+?(?=")/, tag) or raise "no match of RUBY_PATCHLEVEL_STR to replace" File.write("#{v}/version.h", versionhdr) |
