Skip to content

Commit 1f540ad

Browse files
author
Dmitry Pogrebnoy
committed
RUBY-32905 Handle stable releases with negative patch number correctly
There was an assumption that patch level can be negative only for rc/preview ruby versions. But that is not generally true. It doesn't work with ruby 3.4.0 which is stable and has patch version -1. For such case it breaks mechanism of guessing right dir with core sources. Instead of looking for negative patch version in core sources generation process, we need to check ruby version for `-rc`/`-preview` suffix. If ruby version doesn't have such prefix we need to add patch version (even negative) to the name of the dir with core sources for this version. In that way mechanism of guessing dirs works fine.
1 parent b334730 commit 1f540ad

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Rakefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def get_dest_dir(ruby_dir, version, tempdir)
2323
puts "extracted patchlevel '#{patchlevel}'"
2424
end
2525
if patchlevel
26-
dest_dir = dest_dir + "-p" + patchlevel unless patchlevel == '-1'
26+
if !version.include?('-rc') && !version.include?("-preview")
27+
dest_dir = dest_dir + "-p" + patchlevel
28+
end
2729
else
2830
warn "Unable to extract patchlevel from verion.h assuming there is no patchlevel please use a $PATCHLEVEL to specify one"
2931
end

lib/debase/ruby_core_source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def self.deduce_packaged_source_dir(ruby_dir)
6868
end
6969

7070
def self.ruby_source_dir_version(dir)
71-
match = /ruby-([0-9\.]+)-((p|rc|preview)[0-9]+)\z/.match(dir)
71+
match = /ruby-([0-9\.]+)-((p|rc|preview)-?[0-9]+)\z/.match(dir)
7272
Gem::Version.new("#{match[1]}.#{match[2]}")
7373
end
7474

0 commit comments

Comments
 (0)