spandx 0.14.0 → 0.15.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 +7 -2
- data/lib/spandx/os/parsers/dpkg.rb +69 -0
- data/lib/spandx/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3b447710888b33bf24ecf467ce1bf41e3cf6f2c91d2c3c381f256d0fa1ea6f
|
4
|
+
data.tar.gz: cd802eabfd2f0e383ae198217992ce465c28ac7d53587264ca1a2f4746e9e9ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed0fec87962da7ad1576131d6a463324deeaa9ea2b9a6b289dc9c639d1eb9dda98e2bd7aa02df2f9d40526fc4793cedafe3311c9c5fb6c6aedba5594b68fcc1f
|
7
|
+
data.tar.gz: f6bdc294db3b95093c8e3872bb5113879c0a12f9d45ec718557281ff9397f925d0b0a443ba41fad0c5a48e86c77babf95b855b7315d795ec8e869bf8c1dbd6c4
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Version 0.
|
1
|
+
Version 0.15.0
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
|
10
10
|
## [Unreleased]
|
11
11
|
|
12
|
+
## [0.15.0] - 2020-11-18
|
13
|
+
### Added
|
14
|
+
- Parse `/var/lib/dpkg/status` file.
|
15
|
+
|
12
16
|
## [0.14.0] - 2020-11-14
|
13
17
|
### Added
|
14
18
|
- Parse `/lib/apk/db/installed` file.
|
@@ -203,7 +207,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
203
207
|
### Added
|
204
208
|
- Provide ruby API to the latest SPDX catalogue.
|
205
209
|
|
206
|
-
[Unreleased]: https://github.com/spandx/spandx/compare/v0.
|
210
|
+
[Unreleased]: https://github.com/spandx/spandx/compare/v0.15.0...HEAD
|
211
|
+
[0.15.0]: https://github.com/spandx/spandx/compare/v0.14.0...v0.15.0
|
207
212
|
[0.14.0]: https://github.com/spandx/spandx/compare/v0.13.5...v0.14.0
|
208
213
|
[0.13.5]: https://github.com/spandx/spandx/compare/v0.13.4...v0.13.5
|
209
214
|
[0.13.4]: https://github.com/spandx/spandx/compare/v0.13.3...v0.13.4
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spandx
|
4
|
+
module Os
|
5
|
+
module Parsers
|
6
|
+
class Dpkg < ::Spandx::Core::Parser
|
7
|
+
class LineReader
|
8
|
+
attr_reader :io
|
9
|
+
|
10
|
+
def initialize(io)
|
11
|
+
@io = io
|
12
|
+
end
|
13
|
+
|
14
|
+
def each
|
15
|
+
yield read_package(io, Hash.new(''), nil) until io.eof?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def read_package(io, package, prev_key)
|
21
|
+
return package if io.eof?
|
22
|
+
|
23
|
+
line = io.readline.chomp
|
24
|
+
return package if line.empty?
|
25
|
+
|
26
|
+
key, value = split(line, prev_key)
|
27
|
+
package[key] += value
|
28
|
+
read_package(io, package, key)
|
29
|
+
end
|
30
|
+
|
31
|
+
def split(line, prev_key)
|
32
|
+
if prev_key && line.start_with?(' ')
|
33
|
+
[prev_key, line]
|
34
|
+
else
|
35
|
+
key, *rest = line.split(':')
|
36
|
+
value = rest&.join(':')&.strip
|
37
|
+
[key, value]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def match?(path)
|
43
|
+
path.basename.fnmatch?('status')
|
44
|
+
end
|
45
|
+
|
46
|
+
def parse(lockfile)
|
47
|
+
[].tap do |items|
|
48
|
+
lockfile.open(mode: 'r') do |io|
|
49
|
+
LineReader.new(io).each do |data|
|
50
|
+
items.push(map_from(data, lockfile.to_s))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def map_from(data, path)
|
59
|
+
::Spandx::Core::Dependency.new(
|
60
|
+
path: path,
|
61
|
+
name: data['Package'],
|
62
|
+
version: data['Version'],
|
63
|
+
meta: data
|
64
|
+
)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/spandx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spandx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Can Eldem
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-11-
|
12
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -405,6 +405,7 @@ files:
|
|
405
405
|
- lib/spandx/js/yarn_lock.rb
|
406
406
|
- lib/spandx/js/yarn_pkg.rb
|
407
407
|
- lib/spandx/os/parsers/apk.rb
|
408
|
+
- lib/spandx/os/parsers/dpkg.rb
|
408
409
|
- lib/spandx/php/packagist_gateway.rb
|
409
410
|
- lib/spandx/php/parsers/composer.rb
|
410
411
|
- lib/spandx/python/index.rb
|