dependabot-maven 0.366.0 → 0.367.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a7da0e149bfaee27abf22f550f90f0f2499e796f8173f31f4fd4adf1d025f90
|
|
4
|
+
data.tar.gz: c0e87200d777568c721fc9f16b71139d306a0b14ba8a15c38b624b0543e652d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05f254468eba0d9c844f6c0fc8e42cadb57d435b503f56fbecd5d00ba907ebd470482fb71fd3fd72577c095f5a04ef709dc8a806b757d3ef46e96c21cf011454
|
|
7
|
+
data.tar.gz: 02f364887e18275ecb521f5acbd06714698f58265402021a7b5fcc8850ae3030a7effc2782beddd5483692e1c0ec8535c4df3e1e0bea4994e9ea58950fe1ff18
|
|
@@ -92,7 +92,7 @@ module Dependabot
|
|
|
92
92
|
{ url: central_repo_url, id: "central" }
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
sig { params(entry: Nokogiri::XML::
|
|
95
|
+
sig { params(entry: Nokogiri::XML::Node).returns(T::Hash[Symbol, T.nilable(String)]) }
|
|
96
96
|
def serialize_mvn_repo(entry)
|
|
97
97
|
{
|
|
98
98
|
url: entry.at_css("url").content.strip,
|
|
@@ -130,22 +130,100 @@ module Dependabot
|
|
|
130
130
|
.returns(T::Array[T::Hash[Symbol, T.untyped]])
|
|
131
131
|
end
|
|
132
132
|
def gather_repository_urls(pom:, exclude_inherited: false)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
133
|
+
repos = repositories_from_pom(pom)
|
|
134
|
+
return repos if exclude_inherited
|
|
135
|
+
|
|
136
|
+
parent = parent_with_repositories(pom, repos)
|
|
137
|
+
return repos unless parent
|
|
138
|
+
|
|
139
|
+
repos + gather_repository_urls(pom: parent)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
sig do
|
|
143
|
+
params(
|
|
144
|
+
pom: Dependabot::DependencyFile
|
|
145
|
+
).returns(
|
|
146
|
+
T::Array[T::Hash[Symbol, T.untyped]]
|
|
147
|
+
)
|
|
148
|
+
end
|
|
149
|
+
def repositories_from_pom(pom)
|
|
150
|
+
doc = Nokogiri::XML(pom.content)
|
|
151
|
+
doc.remove_namespaces!
|
|
152
|
+
|
|
153
|
+
repository_nodes(doc)
|
|
154
|
+
.filter_map { |node| build_repo_entry(node, pom) }
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
sig do
|
|
158
|
+
params(
|
|
159
|
+
node: Nokogiri::XML::Node,
|
|
160
|
+
pom: Dependabot::DependencyFile
|
|
161
|
+
).returns(T.nilable(T::Hash[Symbol, T.untyped]))
|
|
162
|
+
end
|
|
163
|
+
def build_repo_entry(node, pom)
|
|
164
|
+
url = node.at_css("url")&.text&.strip.to_s
|
|
165
|
+
return if url.empty?
|
|
166
|
+
|
|
167
|
+
entry = serialize_mvn_repo(node)
|
|
168
|
+
|
|
169
|
+
return if property_blocked?(entry)
|
|
170
|
+
return unless http_url?(entry)
|
|
171
|
+
|
|
172
|
+
serialize_urls(entry, pom)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
sig { params(entry: T::Hash[Symbol, T.nilable(String)]).returns(T::Boolean) }
|
|
176
|
+
def property_blocked?(entry)
|
|
177
|
+
contains_property?(T.must(entry.fetch(:url))) && !evaluate_properties?
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
sig { params(entry: T::Hash[Symbol, T.untyped]).returns(T::Boolean) }
|
|
181
|
+
def http_url?(entry)
|
|
182
|
+
entry.fetch(:url)&.start_with?("http")
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
sig do
|
|
186
|
+
params(
|
|
187
|
+
pom: Dependabot::DependencyFile,
|
|
188
|
+
repos: T::Array[T::Hash[Symbol, T.untyped]]
|
|
189
|
+
).returns(T.nilable(Dependabot::DependencyFile))
|
|
190
|
+
end
|
|
191
|
+
def parent_with_repositories(pom, repos)
|
|
192
|
+
urls = repos.map { |r| r[:url] }
|
|
193
|
+
parent_pom(pom, urls)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Returns the repository XML nodes that should be considered when resolving artifacts.
|
|
197
|
+
#
|
|
198
|
+
# Selection rules:
|
|
199
|
+
# - Always includes repositories declared at the project level.
|
|
200
|
+
# - Repositories declared inside <profiles> are included only activated explicitly
|
|
201
|
+
#
|
|
202
|
+
# @example With active profile
|
|
203
|
+
# <profile>
|
|
204
|
+
# <activation><activeByDefault>true</activeByDefault></activation>
|
|
205
|
+
# <repositories>...</repositories>
|
|
206
|
+
# </profile>
|
|
207
|
+
#
|
|
208
|
+
sig { params(doc: Nokogiri::XML::Document).returns(T::Array[Nokogiri::XML::Node]) }
|
|
209
|
+
def repository_nodes(doc)
|
|
210
|
+
doc.css(REPOSITORY_SELECTOR).select do |repo_node|
|
|
211
|
+
profile = repo_node.ancestors("profile").first
|
|
212
|
+
|
|
213
|
+
# Not in a profile => always include
|
|
214
|
+
next true unless profile
|
|
215
|
+
|
|
216
|
+
# In a profile => only include when activeByDefault=true
|
|
217
|
+
active_by_default_profile?(profile)
|
|
146
218
|
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
sig { params(profile: Nokogiri::XML::Element).returns(T::Boolean) }
|
|
222
|
+
def active_by_default_profile?(profile)
|
|
223
|
+
node = profile.at_xpath("./activation/activeByDefault")
|
|
224
|
+
return false unless node
|
|
147
225
|
|
|
148
|
-
|
|
226
|
+
node.text.strip.casecmp?("true")
|
|
149
227
|
end
|
|
150
228
|
|
|
151
229
|
sig { returns(T::Boolean) }
|
|
@@ -15,11 +15,11 @@ module Dependabot
|
|
|
15
15
|
# Regex to match common Maven release qualifiers that indicate stable releases.
|
|
16
16
|
# See https://github.com/apache/maven/blob/848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java#L315-L320
|
|
17
17
|
MAVEN_RELEASE_QUALIFIERS = /
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
^(?:.+[-._])?(
|
|
19
|
+
RELEASE|# Official release
|
|
20
|
+
FINAL| # Final build
|
|
21
|
+
GA # General Availability
|
|
22
|
+
)\d*$
|
|
23
23
|
/ix
|
|
24
24
|
|
|
25
25
|
# Common Maven pre-release qualifiers.
|
|
@@ -27,7 +27,8 @@ module Dependabot
|
|
|
27
27
|
# Examples: 1.0.0-RC1, 2.0.0-ALPHA2, 3.1.0-BETA, 4.0.0-DEV5, etc.
|
|
28
28
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html#version-identifier
|
|
29
29
|
MAVEN_PRE_RELEASE_QUALIFIERS = /
|
|
30
|
-
|
|
30
|
+
# Must be at start OR preceded by a delimiter
|
|
31
|
+
(?: \A | [-._])(
|
|
31
32
|
# --- Qualifiers that usually REQUIRE a number ---
|
|
32
33
|
# Examples: "RC1", "BETA2", "M3", "ALPHA-1", "EAP.2"
|
|
33
34
|
# The number differentiates multiple pre-releases; a version like "1.0.0-RC"
|
|
@@ -44,39 +45,180 @@ module Dependabot
|
|
|
44
45
|
|
|
45
46
|
MAVEN_SNAPSHOT_QUALIFIER = /-SNAPSHOT$/i
|
|
46
47
|
|
|
48
|
+
# Minimum and maximum lengths for Git SHAs
|
|
49
|
+
MIN_GIT_SHA_LENGTH = 7
|
|
50
|
+
MAX_GIT_SHA_LENGTH = 40
|
|
51
|
+
|
|
52
|
+
# Regex for a valid Git SHA
|
|
53
|
+
# - Only hexadecimal characters (0-9, a-f)
|
|
54
|
+
# - Case-insensitive
|
|
55
|
+
# - At least one letter a-f to avoid purely numeric strings
|
|
56
|
+
GIT_COMMIT = T.let(
|
|
57
|
+
/\A(?=[0-9a-f]{#{MIN_GIT_SHA_LENGTH},#{MAX_GIT_SHA_LENGTH}}\z)(?=.*[a-f])/i,
|
|
58
|
+
Regexp
|
|
59
|
+
)
|
|
60
|
+
|
|
47
61
|
sig { params(comparison_version: Dependabot::Version).returns(T::Boolean) }
|
|
48
62
|
def matches_dependency_version_type?(comparison_version)
|
|
49
63
|
return true unless dependency.version
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
current = dependency.version
|
|
66
|
+
candidate = comparison_version.to_s
|
|
53
67
|
|
|
54
|
-
|
|
55
|
-
candidate_is_pre_release = candidate_version_string.match?(MAVEN_PRE_RELEASE_QUALIFIERS)
|
|
68
|
+
return true if pre_release_compatible?(current, candidate)
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
# When this happens, the suffix does not need to match exactly
|
|
59
|
-
# This allows transitions between 1.0.0-RC1 and 1.0.0-CR2, for example
|
|
60
|
-
return true if current_is_pre_release && candidate_is_pre_release
|
|
70
|
+
return true if upgrade_to_stable?(current, candidate)
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# This can help move from pre-release to the stable version that supersedes it,
|
|
65
|
-
# but this should not happen vice versa as a stable release should not be downgraded to a pre-release
|
|
66
|
-
return true if (current_is_pre_release || current_is_snapshot) && !candidate_is_pre_release
|
|
72
|
+
suffix_compatible?(current, candidate)
|
|
73
|
+
end
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
# Determines whether two versions have compatible suffixes.
|
|
78
|
+
#
|
|
79
|
+
# Suffix compatibility is evaluated based on the type of suffix present:
|
|
80
|
+
#
|
|
81
|
+
# - Java runtime suffixes (JRE/JDK): Must have matching major versions and
|
|
82
|
+
# compatible runtime types (JRE can upgrade to JDK, but not vice versa)
|
|
83
|
+
#
|
|
84
|
+
# - Git commit SHAs: When any of the versions contain Git SHAs, they are considered irrelevant
|
|
85
|
+
# for compatibility purposes,
|
|
86
|
+
# as SHAs indicate specific build states rather than compatibility constraints.
|
|
87
|
+
#
|
|
88
|
+
# - Other suffixes: Must match exactly (e.g., platform identifiers, build tags)
|
|
89
|
+
#
|
|
90
|
+
# - No suffix: Both versions must have no suffix
|
|
91
|
+
#
|
|
92
|
+
# @example Java runtime compatibility
|
|
93
|
+
# suffix_compatible?("1.0.0.jre8", "1.0.0.jre8") # => true (same JRE version)
|
|
94
|
+
# suffix_compatible?("1.0.0.jre8", "1.0.0.jdk8") # => true (JRE → JDK upgrade)
|
|
95
|
+
# suffix_compatible?("1.0.0.jdk8", "1.0.0.jre8") # => false (JDK → JRE downgrade)
|
|
96
|
+
# suffix_compatible?("1.0.0.jre8", "1.0.0.jre11") # => false (version mismatch)
|
|
97
|
+
#
|
|
98
|
+
# @example Git SHA compatibility
|
|
99
|
+
# suffix_compatible?("1.0-a1b2c3d", "1.0-e5f6789") # => true (both have SHAs)
|
|
100
|
+
# suffix_compatible?("1.0-a1b2c3d", "1.0.0") # => true ( considered irrelevant for compatibility)
|
|
101
|
+
#
|
|
102
|
+
# @example Exact suffix matching
|
|
103
|
+
# suffix_compatible?("1.0.0-linux", "1.0.0-linux") # => true (exact match)
|
|
104
|
+
# suffix_compatible?("1.0.0-linux", "1.0.0-win") # => false (different platform)
|
|
105
|
+
# suffix_compatible?("1.0.0", "1.0.0") # => true (both have no suffix)
|
|
106
|
+
# suffix_compatible?("1.0.0", "1.0.0-beta") # => false (suffix mismatch)
|
|
107
|
+
sig { params(current: T.nilable(String), candidate: String).returns(T::Boolean) }
|
|
108
|
+
def suffix_compatible?(current, candidate)
|
|
109
|
+
current_suffix = extract_version_suffix(current)
|
|
110
|
+
candidate_suffix = extract_version_suffix(candidate)
|
|
70
111
|
|
|
71
112
|
if jre_or_jdk?(current_suffix) && jre_or_jdk?(candidate_suffix)
|
|
72
113
|
return compatible_java_runtime?(T.must(current_suffix), T.must(candidate_suffix))
|
|
73
114
|
end
|
|
74
115
|
|
|
116
|
+
return true if contains_git_sha?(current_suffix) || contains_git_sha?(candidate_suffix)
|
|
117
|
+
|
|
75
118
|
# If both versions share the exact suffix or no suffix, they are compatible
|
|
76
119
|
current_suffix == candidate_suffix
|
|
77
120
|
end
|
|
78
121
|
|
|
79
|
-
|
|
122
|
+
# Determines whether a given string is a valid Git commit SHA.
|
|
123
|
+
#
|
|
124
|
+
# Accepts both short SHAs (7-40 characters) and full SHAs (40 characters).
|
|
125
|
+
# Handles versions with a leading 'v' prefix (e.g., "v018aa6b0d3").
|
|
126
|
+
#
|
|
127
|
+
# @example Valid Git SHAs
|
|
128
|
+
# git_sha?("a1b2c3d") # => true (7-char short SHA)
|
|
129
|
+
# git_sha?("a1b2c3d4e5f6") # => true (12-char SHA)
|
|
130
|
+
# git_sha?("a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4") # => true (40-char full SHA)
|
|
131
|
+
# git_sha?("v018aa6b0d3") # => true (with 'v' prefix)
|
|
132
|
+
#
|
|
133
|
+
# @example Invalid inputs
|
|
134
|
+
# git_sha?("1.2.3") # => false (version number)
|
|
135
|
+
# git_sha?("abc") # => false (too short, < 7 chars)
|
|
136
|
+
# git_sha?("ghijklm") # => false (invalid hex characters)
|
|
137
|
+
# git_sha?(nil) # => false (nil input)
|
|
138
|
+
sig { params(version: T.nilable(String)).returns(T::Boolean) }
|
|
139
|
+
def git_sha?(version)
|
|
140
|
+
return false unless version
|
|
141
|
+
|
|
142
|
+
normalized = version.start_with?("v") ? version[1..-1] : version
|
|
143
|
+
!!T.must(normalized).match?(GIT_COMMIT)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Determines whether a version string contains a Git commit SHA.
|
|
147
|
+
#
|
|
148
|
+
# This method checks if any part of a version string (when split by common
|
|
149
|
+
# delimiters like '-', '.', or '_') is a valid Git SHA. It also handles
|
|
150
|
+
# cases where delimiters within the SHA itself have been replaced with
|
|
151
|
+
# underscores or other characters.
|
|
152
|
+
|
|
153
|
+
# @example Standard delimiter-separated SHAs
|
|
154
|
+
# contains_git_sha?("1.0.0-a1b2c3d") # => true (SHA after hyphen)
|
|
155
|
+
# contains_git_sha?("2.3.4.a1b2c3d4e5") # => true (SHA after dot)
|
|
156
|
+
# contains_git_sha?("v1.2_a1b2c3d") # => true (SHA after underscore)
|
|
157
|
+
#
|
|
158
|
+
# @example Embedded SHAs with modified delimiters
|
|
159
|
+
# contains_git_sha?("va_b_018a_a_6b_0d3") # => true (SHA with underscores replacing chars)
|
|
160
|
+
# contains_git_sha?("1.0.a.1.b.2.c.3.d") # => true (SHA scattered across segments)
|
|
161
|
+
#
|
|
162
|
+
# @example Non-SHA versions
|
|
163
|
+
# contains_git_sha?("1.2.3") # => false (regular version)
|
|
164
|
+
# contains_git_sha?("abc") # => false (too short)
|
|
165
|
+
# contains_git_sha?(nil) # => false (nil input)
|
|
166
|
+
sig { params(version: T.nilable(String)).returns(T::Boolean) }
|
|
167
|
+
def contains_git_sha?(version)
|
|
168
|
+
return false unless version
|
|
169
|
+
|
|
170
|
+
# Check if any delimiter-separated part is a SHA
|
|
171
|
+
version.split(/[-._]/).any? { |part| git_sha?(part) } ||
|
|
172
|
+
# Check if removing delimiters reveals a SHA (e.g., "va_b_018a_a_6b_0d3")
|
|
173
|
+
git_sha?(version.gsub(/[-._]/, ""))
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Determines whether two versions are compatible based on pre-release status.
|
|
177
|
+
#
|
|
178
|
+
# Two versions are considered compatible if both are pre-release versions.
|
|
179
|
+
# This allows upgrades between different pre-release qualifiers of the same
|
|
180
|
+
# base version (e.g., RC1 → CR2, ALPHA → BETA)
|
|
181
|
+
#
|
|
182
|
+
# @example Compatible pre-release transitions
|
|
183
|
+
# pre_release_compatible?("1.0.0-RC1", "1.0.0-RC2") # => true (same qualifier)
|
|
184
|
+
# pre_release_compatible?("1.0.0-RC1", "1.0.0-CR2") # => true (different qualifier, same stage)
|
|
185
|
+
# pre_release_compatible?("2.0.0-ALPHA", "2.0.0-BETA") # => true (progression)
|
|
186
|
+
# pre_release_compatible?("1.5-M1", "1.5-MILESTONE2") # => true (equivalent qualifiers)
|
|
187
|
+
sig { params(current: T.nilable(String), candidate: String).returns(T::Boolean) }
|
|
188
|
+
def pre_release_compatible?(current, candidate)
|
|
189
|
+
pre_release?(current) && pre_release?(candidate)
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
sig { params(version: T.nilable(String)).returns(T::Boolean) }
|
|
193
|
+
def pre_release?(version)
|
|
194
|
+
version&.match?(MAVEN_PRE_RELEASE_QUALIFIERS) || false
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
sig { params(version: T.nilable(String)).returns(T::Boolean) }
|
|
198
|
+
def snapshot?(version)
|
|
199
|
+
version&.match?(MAVEN_SNAPSHOT_QUALIFIER) || false
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# This method allows upgrades from unstable versions (pre-releases or snapshots)
|
|
203
|
+
# to stable releases, which is a common and expected upgrade path.
|
|
204
|
+
# However, it prevents downgrades from stable releases back to pre-releases,
|
|
205
|
+
# as this would violate semantic versioning expectations.
|
|
206
|
+
#
|
|
207
|
+
# @example Valid upgrades to stable
|
|
208
|
+
# upgrade_to_stable?("1.0.0-RC1", "1.0.0") # => true (pre-release → stable)
|
|
209
|
+
# upgrade_to_stable?("2.0.0-SNAPSHOT", "2.0.0") # => true (snapshot → stable)
|
|
210
|
+
# upgrade_to_stable?("1.5-BETA", "1.5") # => true (beta → stable)
|
|
211
|
+
# upgrade_to_stable?("3.0.0-ALPHA2", "3.0.0-FINAL") # => true (pre-release → release qualifier)
|
|
212
|
+
#
|
|
213
|
+
# @example Invalid transitions (returns false)
|
|
214
|
+
# upgrade_to_stable?("1.0.0", "1.0.1-RC1") # => false (stable → pre-release not allowed)
|
|
215
|
+
# upgrade_to_stable?("2.0.0", "2.1.0") # => false (stable → stable, use other logic)
|
|
216
|
+
# upgrade_to_stable?("1.0.0-RC1", "1.0.0-BETA") # => false (pre-release → pre-release)
|
|
217
|
+
# upgrade_to_stable?(nil, "1.0.0") # => false (no current version)
|
|
218
|
+
sig { params(current: T.nilable(String), candidate: String).returns(T::Boolean) }
|
|
219
|
+
def upgrade_to_stable?(current, candidate)
|
|
220
|
+
(pre_release?(current) || snapshot?(current)) && !pre_release?(candidate)
|
|
221
|
+
end
|
|
80
222
|
|
|
81
223
|
# Determines whether two Java runtime suffixes are compatible.
|
|
82
224
|
#
|
|
@@ -151,44 +293,68 @@ module Dependabot
|
|
|
151
293
|
# Extracts the qualifier/suffix from a Maven version string.
|
|
152
294
|
#
|
|
153
295
|
# Maven versions consist of numeric parts and optional string qualifiers.
|
|
154
|
-
# This method identifies the suffix by
|
|
155
|
-
#
|
|
296
|
+
# This method identifies the suffix by splitting on '.' and delegating
|
|
297
|
+
# each non-numeric segment to extract_suffix_from_part.
|
|
298
|
+
#
|
|
299
|
+
# @example
|
|
300
|
+
# extract_version_suffix("1.0.0.jre8") # => "jre8"
|
|
301
|
+
# extract_version_suffix("1.0.0-linux") # => "_linux"
|
|
302
|
+
# extract_version_suffix("1.0.0-RELEASE") # => nil (stable release qualifier)
|
|
303
|
+
# extract_version_suffix("1.0.0") # => nil (no suffix)
|
|
156
304
|
sig { params(version_string: T.nilable(String)).returns(T.nilable(String)) }
|
|
157
305
|
def extract_version_suffix(version_string)
|
|
158
306
|
return nil unless version_string
|
|
159
|
-
|
|
160
|
-
# Exclude common Maven release qualifiers that indicate stable releases
|
|
161
307
|
return nil if version_string.match?(MAVEN_RELEASE_QUALIFIERS)
|
|
162
308
|
|
|
163
309
|
version_string.split(".").each do |part|
|
|
164
|
-
# Skip fully numeric segments
|
|
165
310
|
next if part.match?(/\A\d+\z/)
|
|
166
311
|
|
|
167
|
-
|
|
168
|
-
suffix
|
|
169
|
-
# Normalize delimiters to ensure consistent comparison
|
|
170
|
-
# e.g., "beta-1" and "beta_1" are treated the same
|
|
171
|
-
suffix = suffix.tr("-", "_")
|
|
172
|
-
|
|
173
|
-
# Special case for JDK/JRE suffixes
|
|
174
|
-
# e.g., "13.2.1.jre8" or "13.2.1-jdk8"
|
|
175
|
-
# In Java, these suffixes often indicate compatibility with specific Java runtimes
|
|
176
|
-
# and are meaningful in version comparisons as we should not mix versions built for different runtimes.
|
|
177
|
-
# For example, "1.0.0.jdk8" should not be considered the same as "1.0.0.jdk11"
|
|
178
|
-
# because they target different Java versions.
|
|
179
|
-
return suffix if jre_or_jdk?(suffix)
|
|
180
|
-
|
|
181
|
-
# Ignore purely numeric suffixes (e.g., "-1", "_2")
|
|
182
|
-
# e.g., "1.0.0-1" or "1.0.0_2" are not considered to have a meaningful suffix
|
|
183
|
-
return nil if suffix.match?(/^_?\d+$/)
|
|
184
|
-
|
|
185
|
-
# Must contain a hyphen to be considered a valid suffix
|
|
186
|
-
return suffix if suffix.include?("-") || suffix.include?("_")
|
|
312
|
+
suffix = extract_suffix_from_part(part)
|
|
313
|
+
return suffix unless suffix.nil?
|
|
187
314
|
end
|
|
188
315
|
|
|
189
316
|
nil
|
|
190
317
|
end
|
|
191
318
|
|
|
319
|
+
# Extracts a meaningful suffix from a single dot-separated version segment.
|
|
320
|
+
#
|
|
321
|
+
# Strips any leading digits, normalizes '-' to '_', then classifies the
|
|
322
|
+
# remainder according to the following rules:
|
|
323
|
+
#
|
|
324
|
+
# - JRE/JDK suffixes are returned as-is for runtime compatibility checks.
|
|
325
|
+
# - Purely numeric suffixes (e.g., "-1", "_2") are ignored and return nil.
|
|
326
|
+
# - Suffixes containing delimiters or matching a Git SHA are returned as-is.
|
|
327
|
+
# - Any other non-empty string is returned as a catch-all to prevent two
|
|
328
|
+
# distinct suffixes from both collapsing to nil and appearing compatible.
|
|
329
|
+
# - Empty strings return nil (no meaningful suffix present).
|
|
330
|
+
#
|
|
331
|
+
# @example
|
|
332
|
+
# extract_suffix_from_part("13jre8") # => "jre8"
|
|
333
|
+
# extract_suffix_from_part("0_linux") # => "_linux"
|
|
334
|
+
# extract_suffix_from_part("0_1") # => nil (purely numeric)
|
|
335
|
+
# extract_suffix_from_part("0abc123") # => "abc123"
|
|
336
|
+
# extract_suffix_from_part("123") # => nil (skipped by caller)
|
|
337
|
+
sig { params(part: String).returns(T.nilable(String)) }
|
|
338
|
+
def extract_suffix_from_part(part)
|
|
339
|
+
suffix = part.sub(/\A\d+/, "").tr("-", "_")
|
|
340
|
+
|
|
341
|
+
# Special case for JDK/JRE suffixes
|
|
342
|
+
# e.g., "13.2.1.jre8" or "13.2.1-jdk8"
|
|
343
|
+
# In Java, these suffixes often indicate compatibility with specific Java runtimes
|
|
344
|
+
# and are meaningful in version comparisons as we should not mix versions built for different runtimes.
|
|
345
|
+
# For example, "1.0.0.jdk8" should not be considered the same as "1.0.0.jdk11"
|
|
346
|
+
# because they target different Java versions.
|
|
347
|
+
return suffix if jre_or_jdk?(suffix)
|
|
348
|
+
|
|
349
|
+
# Ignore purely numeric suffixes (e.g., "-1", "_2")
|
|
350
|
+
# e.g., "1.0.0-1" or "1.0.0_2" are not considered to have a meaningful suffix
|
|
351
|
+
return nil if suffix.match?(/^_?\d+$/)
|
|
352
|
+
|
|
353
|
+
return suffix if suffix.include?("-") || suffix.include?("_") || git_sha?(suffix)
|
|
354
|
+
|
|
355
|
+
suffix.empty? ? nil : suffix
|
|
356
|
+
end
|
|
357
|
+
|
|
192
358
|
sig { override.returns(T.nilable(Dependabot::Package::PackageDetails)) }
|
|
193
359
|
def package_details
|
|
194
360
|
raise NotImplementedError, "Subclasses must implement `package_details`"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-maven
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.367.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.367.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.367.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rexml
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -286,7 +286,7 @@ licenses:
|
|
|
286
286
|
- MIT
|
|
287
287
|
metadata:
|
|
288
288
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
289
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
289
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.367.0
|
|
290
290
|
rdoc_options: []
|
|
291
291
|
require_paths:
|
|
292
292
|
- lib
|