ecosystems-bibliothecary 15.2.0 → 15.4.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/CHANGELOG.md +18 -1
- data/README.md +57 -1
- data/lib/bibliothecary/dependency.rb +6 -1
- data/lib/bibliothecary/parsers/alpm.rb +89 -0
- data/lib/bibliothecary/parsers/apk.rb +91 -0
- data/lib/bibliothecary/parsers/bazel.rb +65 -0
- data/lib/bibliothecary/parsers/bentoml.rb +1 -1
- data/lib/bibliothecary/parsers/bower.rb +1 -0
- data/lib/bibliothecary/parsers/cargo.rb +3 -1
- data/lib/bibliothecary/parsers/clojars.rb +1 -0
- data/lib/bibliothecary/parsers/cocoapods.rb +29 -1
- data/lib/bibliothecary/parsers/cog.rb +1 -1
- data/lib/bibliothecary/parsers/conda.rb +2 -0
- data/lib/bibliothecary/parsers/deb.rb +132 -0
- data/lib/bibliothecary/parsers/deno.rb +15 -1
- data/lib/bibliothecary/parsers/dub.rb +2 -0
- data/lib/bibliothecary/parsers/dvc.rb +1 -1
- data/lib/bibliothecary/parsers/go.rb +4 -2
- data/lib/bibliothecary/parsers/hackage.rb +4 -3
- data/lib/bibliothecary/parsers/haxelib.rb +1 -0
- data/lib/bibliothecary/parsers/hex.rb +22 -7
- data/lib/bibliothecary/parsers/luarocks.rb +1 -0
- data/lib/bibliothecary/parsers/meteor.rb +1 -0
- data/lib/bibliothecary/parsers/mlflow.rb +1 -1
- data/lib/bibliothecary/parsers/nimble.rb +1 -0
- data/lib/bibliothecary/parsers/npm.rb +81 -12
- data/lib/bibliothecary/parsers/ollama.rb +1 -1
- data/lib/bibliothecary/parsers/packagist.rb +28 -31
- data/lib/bibliothecary/parsers/pypi.rb +16 -2
- data/lib/bibliothecary/parsers/rpm.rb +80 -0
- data/lib/bibliothecary/parsers/rubygems.rb +34 -4
- data/lib/bibliothecary/version.rb +1 -1
- metadata +6 -1
|
@@ -10,6 +10,8 @@ module Bibliothecary
|
|
|
10
10
|
NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?'
|
|
11
11
|
NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/
|
|
12
12
|
BUNDLED_WITH = /BUNDLED WITH/
|
|
13
|
+
CHECKSUMS_START = /^CHECKSUMS$/
|
|
14
|
+
CHECKSUM_LINE = /^ (.+) \(([^)]+)\) sha256=([a-f0-9]+)$/
|
|
13
15
|
|
|
14
16
|
# Gemfile patterns
|
|
15
17
|
GEM_REGEXP = /^\s*gem\s+['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"])?/
|
|
@@ -47,6 +49,7 @@ module Bibliothecary
|
|
|
47
49
|
def self.parse_gemfile_lock(file_contents, options: {})
|
|
48
50
|
source = options.fetch(:filename, nil)
|
|
49
51
|
dependencies = []
|
|
52
|
+
checksums = parse_checksums(file_contents)
|
|
50
53
|
|
|
51
54
|
file_contents.each_line do |line|
|
|
52
55
|
line = line.chomp.gsub(/\r$/, "")
|
|
@@ -60,17 +63,43 @@ module Bibliothecary
|
|
|
60
63
|
name: name,
|
|
61
64
|
requirement: version,
|
|
62
65
|
type: "runtime",
|
|
63
|
-
source: source
|
|
66
|
+
source: source,
|
|
67
|
+
integrity: checksums["#{name}-#{version}"]
|
|
64
68
|
)
|
|
65
69
|
end
|
|
66
70
|
|
|
67
|
-
if (bundler_dep = parse_bundler(file_contents, source))
|
|
71
|
+
if (bundler_dep = parse_bundler(file_contents, source, checksums))
|
|
68
72
|
dependencies << bundler_dep
|
|
69
73
|
end
|
|
70
74
|
|
|
71
75
|
ParserResult.new(dependencies: dependencies)
|
|
72
76
|
end
|
|
73
77
|
|
|
78
|
+
def self.parse_checksums(file_contents)
|
|
79
|
+
checksums = {}
|
|
80
|
+
in_checksums = false
|
|
81
|
+
|
|
82
|
+
file_contents.each_line do |line|
|
|
83
|
+
line = line.chomp
|
|
84
|
+
if line.match?(CHECKSUMS_START)
|
|
85
|
+
in_checksums = true
|
|
86
|
+
next
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
next unless in_checksums
|
|
90
|
+
|
|
91
|
+
# End of CHECKSUMS section (blank line or new section)
|
|
92
|
+
break if line.empty? || line.match?(/^[A-Z]/)
|
|
93
|
+
|
|
94
|
+
if (match = line.match(CHECKSUM_LINE))
|
|
95
|
+
name, version, sha256 = match.captures
|
|
96
|
+
checksums["#{name}-#{version}"] = "sha256=#{sha256}"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
checksums
|
|
101
|
+
end
|
|
102
|
+
|
|
74
103
|
def self.parse_gemfile(file_contents, options: {})
|
|
75
104
|
source = options.fetch(:filename, nil)
|
|
76
105
|
deps = []
|
|
@@ -151,7 +180,7 @@ module Bibliothecary
|
|
|
151
180
|
end
|
|
152
181
|
end
|
|
153
182
|
|
|
154
|
-
def self.parse_bundler(file_contents, source = nil)
|
|
183
|
+
def self.parse_bundler(file_contents, source = nil, checksums = {})
|
|
155
184
|
bundled_with_index = file_contents.lines(chomp: true).find_index { |line| line.match(BUNDLED_WITH) }
|
|
156
185
|
return nil unless bundled_with_index
|
|
157
186
|
|
|
@@ -163,7 +192,8 @@ module Bibliothecary
|
|
|
163
192
|
requirement: version,
|
|
164
193
|
type: "runtime",
|
|
165
194
|
source: source,
|
|
166
|
-
platform: platform_name
|
|
195
|
+
platform: platform_name,
|
|
196
|
+
integrity: checksums["bundler-#{version}"]
|
|
167
197
|
)
|
|
168
198
|
end
|
|
169
199
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ecosystems-bibliothecary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 15.
|
|
4
|
+
version: 15.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Nesbitt
|
|
@@ -117,6 +117,9 @@ files:
|
|
|
117
117
|
- lib/bibliothecary/file_info.rb
|
|
118
118
|
- lib/bibliothecary/parser_result.rb
|
|
119
119
|
- lib/bibliothecary/parsers/actions.rb
|
|
120
|
+
- lib/bibliothecary/parsers/alpm.rb
|
|
121
|
+
- lib/bibliothecary/parsers/apk.rb
|
|
122
|
+
- lib/bibliothecary/parsers/bazel.rb
|
|
120
123
|
- lib/bibliothecary/parsers/bentoml.rb
|
|
121
124
|
- lib/bibliothecary/parsers/bower.rb
|
|
122
125
|
- lib/bibliothecary/parsers/cargo.rb
|
|
@@ -128,6 +131,7 @@ files:
|
|
|
128
131
|
- lib/bibliothecary/parsers/conda.rb
|
|
129
132
|
- lib/bibliothecary/parsers/cpan.rb
|
|
130
133
|
- lib/bibliothecary/parsers/cran.rb
|
|
134
|
+
- lib/bibliothecary/parsers/deb.rb
|
|
131
135
|
- lib/bibliothecary/parsers/deno.rb
|
|
132
136
|
- lib/bibliothecary/parsers/docker.rb
|
|
133
137
|
- lib/bibliothecary/parsers/dub.rb
|
|
@@ -151,6 +155,7 @@ files:
|
|
|
151
155
|
- lib/bibliothecary/parsers/packagist.rb
|
|
152
156
|
- lib/bibliothecary/parsers/pub.rb
|
|
153
157
|
- lib/bibliothecary/parsers/pypi.rb
|
|
158
|
+
- lib/bibliothecary/parsers/rpm.rb
|
|
154
159
|
- lib/bibliothecary/parsers/rubygems.rb
|
|
155
160
|
- lib/bibliothecary/parsers/shard.rb
|
|
156
161
|
- lib/bibliothecary/parsers/swift_pm.rb
|