dependabot-nix 0.404.0 → 0.405.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 +4 -4
- data/lib/dependabot/nix/file_parser.rb +63 -7
- data/lib/dependabot/nix/update_checker.rb +4 -12
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a01529827335c7ac07c65d30be8e6b334639d04c5419201b3ac92b85a3726fd
|
|
4
|
+
data.tar.gz: 02c13752482edded7c122e52bc1b9cfa6b6d6de09c8622d53d407bd797c49ffd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e14ee3ab21c7f25185c22e9d0342f78c793e086766243f66aed59d446365116af962a4e64900bc685ac7f94d863fa481da1b3a029258ad72bb9d91008b48c833
|
|
7
|
+
data.tar.gz: bd2c236a6526cf4ddc7c16b838982297272ca2de86d0983a2656ad96d6560394e1a5351723d562b4780c4aa50b668c1db48ffcabdfc2f9cd2716878f3f5f0564
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require "uri"
|
|
4
5
|
require "sorbet-runtime"
|
|
5
6
|
|
|
6
7
|
require "dependabot/dependency"
|
|
@@ -21,6 +22,10 @@ module Dependabot
|
|
|
21
22
|
|
|
22
23
|
SUPPORTED_LOCK_VERSION = 7
|
|
23
24
|
|
|
25
|
+
# Where the registry resolves an indirect channel input to: a NixOS release tarball.
|
|
26
|
+
RELEASE_TARBALL_HOSTS = %w(releases.nixos.org channels.nixos.org).freeze
|
|
27
|
+
RELEASE_TARBALL_PATH = %r{/nixexprs\.tar\.(?<extension>xz|gz|bz2|zst)\z}
|
|
28
|
+
|
|
24
29
|
DEFAULT_HOSTS = T.let(
|
|
25
30
|
{
|
|
26
31
|
"github" => "github.com",
|
|
@@ -83,7 +88,7 @@ module Dependabot
|
|
|
83
88
|
return unless rev
|
|
84
89
|
|
|
85
90
|
if source_type == "tarball"
|
|
86
|
-
build_tarball_dependency(input_name, original, rev)
|
|
91
|
+
build_tarball_dependency(input_name, locked, original, rev)
|
|
87
92
|
else
|
|
88
93
|
build_git_dependency(input_name, locked, original, rev)
|
|
89
94
|
end
|
|
@@ -121,19 +126,19 @@ module Dependabot
|
|
|
121
126
|
!original.fetch("rev", nil).nil?
|
|
122
127
|
end
|
|
123
128
|
|
|
124
|
-
# Channel tarballs track a channel
|
|
125
|
-
#
|
|
129
|
+
# Channel tarballs track a channel (e.g. nixos-26.05) rather than a git ref. Non-channel
|
|
130
|
+
# tarballs aren't updatable, so they're skipped.
|
|
126
131
|
sig do
|
|
127
132
|
params(
|
|
128
133
|
input_name: String,
|
|
134
|
+
locked: T::Hash[String, T.untyped],
|
|
129
135
|
original: T::Hash[String, T.untyped],
|
|
130
136
|
rev: String
|
|
131
137
|
).returns(T.nilable(Dependabot::Dependency))
|
|
132
138
|
end
|
|
133
|
-
def build_tarball_dependency(input_name, original, rev)
|
|
134
|
-
url =
|
|
135
|
-
|
|
136
|
-
return unless channel
|
|
139
|
+
def build_tarball_dependency(input_name, locked, original, rev)
|
|
140
|
+
url, channel = channel_tarball_source(locked, original)
|
|
141
|
+
return unless url && channel
|
|
137
142
|
|
|
138
143
|
Dependency.new(
|
|
139
144
|
name: input_name,
|
|
@@ -148,6 +153,57 @@ module Dependabot
|
|
|
148
153
|
)
|
|
149
154
|
end
|
|
150
155
|
|
|
156
|
+
# The URL and channel of a tarball input, or nil when it isn't a NixOS channel.
|
|
157
|
+
sig do
|
|
158
|
+
params(
|
|
159
|
+
locked: T::Hash[String, T.untyped],
|
|
160
|
+
original: T::Hash[String, T.untyped]
|
|
161
|
+
).returns(T.nilable([String, String]))
|
|
162
|
+
end
|
|
163
|
+
def channel_tarball_source(locked, original)
|
|
164
|
+
return indirect_channel_source(locked, original) if original["type"] == "indirect"
|
|
165
|
+
|
|
166
|
+
url = original.fetch("url", nil)
|
|
167
|
+
channel = Channel.channel_name_from_url(url)
|
|
168
|
+
[url, channel] if url && channel
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# An indirect input such as `nixpkgs/nixos-unstable` has no URL in the lock: `original` keeps the registry id
|
|
172
|
+
# and ref, and `locked` is the release tarball the registry resolved it to. The channel is the ref, so it is only
|
|
173
|
+
# trusted when the lock really is a NixOS release tarball. The channel's canonical URL stands in for the URL the
|
|
174
|
+
# flake doesn't have, with the locked tarball's suffix kept.
|
|
175
|
+
sig do
|
|
176
|
+
params(
|
|
177
|
+
locked: T::Hash[String, T.untyped],
|
|
178
|
+
original: T::Hash[String, T.untyped]
|
|
179
|
+
).returns(T.nilable([String, String]))
|
|
180
|
+
end
|
|
181
|
+
def indirect_channel_source(locked, original)
|
|
182
|
+
ref = original.fetch("ref", nil)
|
|
183
|
+
return unless ref.is_a?(String)
|
|
184
|
+
|
|
185
|
+
extension = release_tarball_extension(locked.fetch("url", nil))
|
|
186
|
+
return unless extension
|
|
187
|
+
|
|
188
|
+
# Round-tripping through the channel URL rejects refs that aren't channel names, such as pull/1489/head.
|
|
189
|
+
url = Channel.url_for(ref, extension: extension)
|
|
190
|
+
channel = Channel.channel_name_from_url(url)
|
|
191
|
+
[url, channel] if channel
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# The compression suffix of a NixOS release tarball URL, or nil for any other URL.
|
|
195
|
+
sig { params(url: T.untyped).returns(T.nilable(String)) }
|
|
196
|
+
def release_tarball_extension(url)
|
|
197
|
+
return unless url.is_a?(String)
|
|
198
|
+
|
|
199
|
+
uri = URI.parse(url)
|
|
200
|
+
return unless RELEASE_TARBALL_HOSTS.include?(uri.host)
|
|
201
|
+
|
|
202
|
+
RELEASE_TARBALL_PATH.match(uri.path.to_s)&.[](:extension)
|
|
203
|
+
rescue URI::InvalidURIError
|
|
204
|
+
nil
|
|
205
|
+
end
|
|
206
|
+
|
|
151
207
|
sig { params(locked: T::Hash[String, T.untyped]).returns(T.nilable(String)) }
|
|
152
208
|
def build_url(locked)
|
|
153
209
|
case locked["type"]
|
|
@@ -162,7 +162,7 @@ module Dependabot
|
|
|
162
162
|
req.merge(
|
|
163
163
|
source: source_with_values(
|
|
164
164
|
req,
|
|
165
|
-
"ref" =>
|
|
165
|
+
"ref" => new_tag.tag,
|
|
166
166
|
"branch" => nil
|
|
167
167
|
)
|
|
168
168
|
)
|
|
@@ -172,25 +172,17 @@ module Dependabot
|
|
|
172
172
|
|
|
173
173
|
sig { returns(T.nilable(String)) }
|
|
174
174
|
def fetch_latest_version_for_tag
|
|
175
|
-
|
|
176
|
-
tag && tag_commit_sha(tag)
|
|
175
|
+
latest_version_tag&.commit_sha
|
|
177
176
|
end
|
|
178
177
|
|
|
179
|
-
sig { returns(T.nilable(
|
|
178
|
+
sig { returns(T.nilable(Dependabot::GitTagDetails)) }
|
|
180
179
|
def latest_version_tag
|
|
181
180
|
@latest_version_tag ||= T.let(
|
|
182
181
|
git_commit_checker.local_tag_for_latest_version(update_cooldown),
|
|
183
|
-
T.nilable(
|
|
182
|
+
T.nilable(Dependabot::GitTagDetails)
|
|
184
183
|
)
|
|
185
184
|
end
|
|
186
185
|
|
|
187
|
-
sig { params(tag: T::Hash[Symbol, Object]).returns(T.nilable(String)) }
|
|
188
|
-
def tag_commit_sha(tag)
|
|
189
|
-
return tag.commit_sha if tag.is_a?(Dependabot::GitTagDetails)
|
|
190
|
-
|
|
191
|
-
T.cast(tag[:commit_sha], T.nilable(String))
|
|
192
|
-
end
|
|
193
|
-
|
|
194
186
|
# --- Versioned branch support ---
|
|
195
187
|
|
|
196
188
|
sig { returns(T::Array[Dependabot::DependencyRequirement]) }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-nix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.405.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.405.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.405.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: debug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -265,7 +265,7 @@ licenses:
|
|
|
265
265
|
- MIT
|
|
266
266
|
metadata:
|
|
267
267
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
268
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
268
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.405.0
|
|
269
269
|
rdoc_options: []
|
|
270
270
|
require_paths:
|
|
271
271
|
- lib
|