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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -1
  3. data/README.md +57 -1
  4. data/lib/bibliothecary/dependency.rb +6 -1
  5. data/lib/bibliothecary/parsers/alpm.rb +89 -0
  6. data/lib/bibliothecary/parsers/apk.rb +91 -0
  7. data/lib/bibliothecary/parsers/bazel.rb +65 -0
  8. data/lib/bibliothecary/parsers/bentoml.rb +1 -1
  9. data/lib/bibliothecary/parsers/bower.rb +1 -0
  10. data/lib/bibliothecary/parsers/cargo.rb +3 -1
  11. data/lib/bibliothecary/parsers/clojars.rb +1 -0
  12. data/lib/bibliothecary/parsers/cocoapods.rb +29 -1
  13. data/lib/bibliothecary/parsers/cog.rb +1 -1
  14. data/lib/bibliothecary/parsers/conda.rb +2 -0
  15. data/lib/bibliothecary/parsers/deb.rb +132 -0
  16. data/lib/bibliothecary/parsers/deno.rb +15 -1
  17. data/lib/bibliothecary/parsers/dub.rb +2 -0
  18. data/lib/bibliothecary/parsers/dvc.rb +1 -1
  19. data/lib/bibliothecary/parsers/go.rb +4 -2
  20. data/lib/bibliothecary/parsers/hackage.rb +4 -3
  21. data/lib/bibliothecary/parsers/haxelib.rb +1 -0
  22. data/lib/bibliothecary/parsers/hex.rb +22 -7
  23. data/lib/bibliothecary/parsers/luarocks.rb +1 -0
  24. data/lib/bibliothecary/parsers/meteor.rb +1 -0
  25. data/lib/bibliothecary/parsers/mlflow.rb +1 -1
  26. data/lib/bibliothecary/parsers/nimble.rb +1 -0
  27. data/lib/bibliothecary/parsers/npm.rb +81 -12
  28. data/lib/bibliothecary/parsers/ollama.rb +1 -1
  29. data/lib/bibliothecary/parsers/packagist.rb +28 -31
  30. data/lib/bibliothecary/parsers/pypi.rb +16 -2
  31. data/lib/bibliothecary/parsers/rpm.rb +80 -0
  32. data/lib/bibliothecary/parsers/rubygems.rb +34 -4
  33. data/lib/bibliothecary/version.rb +1 -1
  34. 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bibliothecary
4
- VERSION = "15.2.0"
4
+ VERSION = "15.4.0"
5
5
  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.2.0
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