spandx 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e01f7023f4a164fb867c7d457769d1c9dd2eb2b480cee88c5d4d682c2d6dc4e
4
- data.tar.gz: f202f85c254d11041b79e1305d12641eb66ea66cec9afea25a38e9724a5636d6
3
+ metadata.gz: ee3b447710888b33bf24ecf467ce1bf41e3cf6f2c91d2c3c381f256d0fa1ea6f
4
+ data.tar.gz: cd802eabfd2f0e383ae198217992ce465c28ac7d53587264ca1a2f4746e9e9ce
5
5
  SHA512:
6
- metadata.gz: 926df592dfc76466a7e26bcdfd9fc581957b2c748c9272e30a22180a61f4d6498ebb14e04e8acbbccc813f4aae929ecb8ba82ee54064d642990e5874b05bb0b1
7
- data.tar.gz: 5dede807761bf9d4fa91f6a0ea9df1bec9531d0a397fedea5c687b7c12860216e41df47c09fc7e94c8951e7dc0f88c99fc74395913002890b199409b700830f0
6
+ metadata.gz: ed0fec87962da7ad1576131d6a463324deeaa9ea2b9a6b289dc9c639d1eb9dda98e2bd7aa02df2f9d40526fc4793cedafe3311c9c5fb6c6aedba5594b68fcc1f
7
+ data.tar.gz: f6bdc294db3b95093c8e3872bb5113879c0a12f9d45ec718557281ff9397f925d0b0a443ba41fad0c5a48e86c77babf95b855b7315d795ec8e869bf8c1dbd6c4
@@ -1,4 +1,4 @@
1
- Version 0.14.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.14.0...HEAD
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spandx
4
- VERSION = '0.14.0'
4
+ VERSION = '0.15.0'
5
5
  end
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.14.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-15 00:00:00.000000000 Z
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