package-report 0.0.1
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 +7 -0
- data/.gitignore +24 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +101 -0
- data/Guardfile +23 -0
- data/LICENSE.txt +22 -0
- data/Procfile +0 -0
- data/README.md +11 -0
- data/Rakefile +1 -0
- data/bin/package-report +13 -0
- data/lib/package-report.rb +3 -0
- data/lib/package_report/package.rb +67 -0
- data/lib/package_report/reporter.rb +98 -0
- data/lib/package_report/version.rb +4 -0
- data/lib/templates/report.html.erb +63 -0
- data/package-report.gemspec +29 -0
- data/spec/lib/package_spec.rb +90 -0
- data/spec/lib/reporter_spec.rb +35 -0
- data/spec/spec_helper.rb +2 -0
- metadata +178 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 2bf19fd8bda6fb114b662bdca42271fa6a43f111
|
|
4
|
+
data.tar.gz: f01c09c8c712f15cafc8b0c9ce0eaf8c45de3ff0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 043284025cfb18d276837b9e11d85ccbd663cf30b779bfec71c1a56122c4b29c53e572598d759ba03e95c656ade49bea8168e02088cc1a854a2b3436f7fda286
|
|
7
|
+
data.tar.gz: 1a7f0d6e22c8cd51e61af38952286ee2516303606709610664e7dd62377494b3a3114670d459a25a60249288778cd5cc0d6d7223b74904b8f50e10877cc07bd4
|
data/.gitignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
|
23
|
+
|
|
24
|
+
tmp/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
package-report (0.0.1)
|
|
5
|
+
fog (= 1.21.0)
|
|
6
|
+
unf (= 0.1.3)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activesupport (3.2.15)
|
|
12
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
13
|
+
multi_json (~> 1.0)
|
|
14
|
+
builder (3.2.2)
|
|
15
|
+
celluloid (0.15.2)
|
|
16
|
+
timers (~> 1.1.0)
|
|
17
|
+
celluloid-io (0.15.0)
|
|
18
|
+
celluloid (>= 0.15.0)
|
|
19
|
+
nio4r (>= 0.5.0)
|
|
20
|
+
coderay (1.1.0)
|
|
21
|
+
diff-lcs (1.2.5)
|
|
22
|
+
excon (0.32.1)
|
|
23
|
+
ffi (1.9.3)
|
|
24
|
+
fog (1.21.0)
|
|
25
|
+
fog-brightbox
|
|
26
|
+
fog-core (~> 1.21, >= 1.21.1)
|
|
27
|
+
fog-json
|
|
28
|
+
nokogiri (~> 1.5, >= 1.5.11)
|
|
29
|
+
fog-brightbox (0.0.1)
|
|
30
|
+
fog-core
|
|
31
|
+
fog-json
|
|
32
|
+
fog-core (1.21.1)
|
|
33
|
+
builder
|
|
34
|
+
excon (~> 0.32)
|
|
35
|
+
formatador (~> 0.2.0)
|
|
36
|
+
mime-types
|
|
37
|
+
net-scp (~> 1.1)
|
|
38
|
+
net-ssh (>= 2.1.3)
|
|
39
|
+
fog-json (1.0.0)
|
|
40
|
+
multi_json (~> 1.0)
|
|
41
|
+
formatador (0.2.4)
|
|
42
|
+
guard (2.6.0)
|
|
43
|
+
formatador (>= 0.2.4)
|
|
44
|
+
listen (~> 2.7)
|
|
45
|
+
lumberjack (~> 1.0)
|
|
46
|
+
pry (>= 0.9.12)
|
|
47
|
+
thor (>= 0.18.1)
|
|
48
|
+
guard-rspec (4.2.8)
|
|
49
|
+
guard (~> 2.1)
|
|
50
|
+
rspec (>= 2.14, < 4.0)
|
|
51
|
+
i18n (0.6.9)
|
|
52
|
+
listen (2.7.1)
|
|
53
|
+
celluloid (>= 0.15.2)
|
|
54
|
+
celluloid-io (>= 0.15.0)
|
|
55
|
+
rb-fsevent (>= 0.9.3)
|
|
56
|
+
rb-inotify (>= 0.9)
|
|
57
|
+
lumberjack (1.0.5)
|
|
58
|
+
method_source (0.8.2)
|
|
59
|
+
mime-types (2.2)
|
|
60
|
+
mini_portile (0.5.3)
|
|
61
|
+
multi_json (1.9.2)
|
|
62
|
+
net-scp (1.1.2)
|
|
63
|
+
net-ssh (>= 2.6.5)
|
|
64
|
+
net-ssh (2.8.0)
|
|
65
|
+
nio4r (1.0.0)
|
|
66
|
+
nokogiri (1.6.1)
|
|
67
|
+
mini_portile (~> 0.5.0)
|
|
68
|
+
pry (0.9.12.6)
|
|
69
|
+
coderay (~> 1.0)
|
|
70
|
+
method_source (~> 0.8)
|
|
71
|
+
slop (~> 3.4)
|
|
72
|
+
rake (10.2.2)
|
|
73
|
+
rb-fsevent (0.9.4)
|
|
74
|
+
rb-inotify (0.9.3)
|
|
75
|
+
ffi (>= 0.5.0)
|
|
76
|
+
rspec (2.14.1)
|
|
77
|
+
rspec-core (~> 2.14.0)
|
|
78
|
+
rspec-expectations (~> 2.14.0)
|
|
79
|
+
rspec-mocks (~> 2.14.0)
|
|
80
|
+
rspec-core (2.14.8)
|
|
81
|
+
rspec-expectations (2.14.5)
|
|
82
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
83
|
+
rspec-mocks (2.14.6)
|
|
84
|
+
slop (3.5.0)
|
|
85
|
+
thor (0.19.1)
|
|
86
|
+
timers (1.1.0)
|
|
87
|
+
unf (0.1.3)
|
|
88
|
+
unf_ext
|
|
89
|
+
unf_ext (0.0.6)
|
|
90
|
+
|
|
91
|
+
PLATFORMS
|
|
92
|
+
ruby
|
|
93
|
+
|
|
94
|
+
DEPENDENCIES
|
|
95
|
+
activesupport (= 3.2.15)
|
|
96
|
+
bundler (~> 1.6)
|
|
97
|
+
guard (= 2.6.0)
|
|
98
|
+
guard-rspec (= 4.2.8)
|
|
99
|
+
package-report!
|
|
100
|
+
rake
|
|
101
|
+
rspec (= 2.14.1)
|
data/Guardfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
guard :rspec do
|
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
|
8
|
+
|
|
9
|
+
# Rails example
|
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
|
16
|
+
|
|
17
|
+
# Capybara features specs
|
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
|
19
|
+
|
|
20
|
+
# Turnip features and steps
|
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
|
23
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Brian Racer
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Procfile
ADDED
|
File without changes
|
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/package-report
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module PackageReport
|
|
2
|
+
class Package
|
|
3
|
+
attr_accessor :name, :current_version, :latest_version, :changelog
|
|
4
|
+
|
|
5
|
+
def initialize(package_name = nil, current_version = nil, latest_version = nil)
|
|
6
|
+
@name = package_name
|
|
7
|
+
@current_version = current_version
|
|
8
|
+
@latest_version = latest_version
|
|
9
|
+
|
|
10
|
+
# get installed version
|
|
11
|
+
# get latest version
|
|
12
|
+
# get changelog
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.from_apt_line(line)
|
|
16
|
+
parts = line.split
|
|
17
|
+
name = parts[1]
|
|
18
|
+
current_version = parts[2].gsub(/\[|\]/, "")
|
|
19
|
+
latest_version = parts[3].gsub(/\(/, "")
|
|
20
|
+
|
|
21
|
+
self.new name, current_version, latest_version
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def fetch_version!
|
|
25
|
+
@current_version = raw_installed_version.split[1]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def newer_changes
|
|
29
|
+
found = false
|
|
30
|
+
newer = []
|
|
31
|
+
|
|
32
|
+
changelog_parts.each do |part|
|
|
33
|
+
if part.match(@current_version)
|
|
34
|
+
found = true
|
|
35
|
+
end
|
|
36
|
+
next if found
|
|
37
|
+
|
|
38
|
+
newer << part
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
newer.delete_at(0)
|
|
42
|
+
newer
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def changelog_parts
|
|
46
|
+
parts = []
|
|
47
|
+
raw_changelog.each_line do |line|
|
|
48
|
+
if line =~ /^\S/
|
|
49
|
+
parts << line
|
|
50
|
+
else
|
|
51
|
+
parts.last << line
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
parts
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def raw_installed_version
|
|
60
|
+
`\dpkg -s #{@name} | \grep '^Version'`
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def raw_changelog
|
|
64
|
+
`aptitude changelog #{@name}`
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
require "erb"
|
|
2
|
+
require "fog"
|
|
3
|
+
|
|
4
|
+
module PackageReport
|
|
5
|
+
class Reporter
|
|
6
|
+
def run!
|
|
7
|
+
packages_info = {}
|
|
8
|
+
|
|
9
|
+
package_upgrades_available.sort_by { |pkg| pkg.name }.each do |pkg|
|
|
10
|
+
packages_info[pkg.name] = {
|
|
11
|
+
current_version: pkg.current_version,
|
|
12
|
+
latest_version: pkg.latest_version,
|
|
13
|
+
changelog: pkg.newer_changes
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
json = packages_info.to_json
|
|
18
|
+
|
|
19
|
+
connection = Fog::Storage.new({
|
|
20
|
+
:provider => "AWS",
|
|
21
|
+
:aws_access_key_id => ENV["AWS_ACCESS_KEY_ID"],
|
|
22
|
+
:aws_secret_access_key => ENV["AWS_SECRET_ACCESS_KEY"],
|
|
23
|
+
:path_style => true
|
|
24
|
+
})
|
|
25
|
+
#connection = Fog::Storage.new({
|
|
26
|
+
#provider: "Local",
|
|
27
|
+
#local_root: "/vagrant/fog",
|
|
28
|
+
#endpoint: "http://example.com"
|
|
29
|
+
#})
|
|
30
|
+
|
|
31
|
+
dir = connection.directories.create({
|
|
32
|
+
key: ENV["AWS_S3_BUCKET"]
|
|
33
|
+
})
|
|
34
|
+
dir.files.create(
|
|
35
|
+
key: Time.now.strftime("%Y-%m-%d") + "/" + `hostname`.strip + ".json",
|
|
36
|
+
body: json
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def build_website!
|
|
41
|
+
# connect to s3
|
|
42
|
+
# each json file
|
|
43
|
+
# render template or something
|
|
44
|
+
#connection = Fog::Storage.new({
|
|
45
|
+
#provider: "Local",
|
|
46
|
+
#local_root: "/vagrant/fog",
|
|
47
|
+
#endpoint: "http://example.com"
|
|
48
|
+
#})
|
|
49
|
+
connection = Fog::Storage.new({
|
|
50
|
+
:provider => "AWS",
|
|
51
|
+
:aws_access_key_id => ENV["AWS_ACCESS_KEY_ID"],
|
|
52
|
+
:aws_secret_access_key => ENV["AWS_SECRET_ACCESS_KEY"],
|
|
53
|
+
:path_style => true
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
#p connection.directories
|
|
57
|
+
dir = connection.directories.get(ENV["AWS_S3_BUCKET"])
|
|
58
|
+
#/#{Time.now.strftime("%Y-%m-%d")}")
|
|
59
|
+
#pp bucket
|
|
60
|
+
#p dir.files
|
|
61
|
+
#exit
|
|
62
|
+
|
|
63
|
+
instances = {}
|
|
64
|
+
dir.files.each do |file|
|
|
65
|
+
next unless file.key =~ /#{Time.now.strftime("%Y-%m-%d")}/
|
|
66
|
+
next unless file.key =~ /json$/
|
|
67
|
+
instances[file.key] = JSON.parse file.body
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
template_path = File.expand_path("../../templates/report.html.erb", __FILE__)
|
|
71
|
+
template_string = File.read(template_path)
|
|
72
|
+
html = ERB.new(template_string).result(binding)
|
|
73
|
+
|
|
74
|
+
dir.files.create(
|
|
75
|
+
key: "#{Time.now.strftime("%Y-%m-%d")}/index.html",
|
|
76
|
+
body: html,
|
|
77
|
+
public: true
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def package_upgrades_available
|
|
82
|
+
packages = []
|
|
83
|
+
|
|
84
|
+
raw_apt_upgrade_text.split("\n").each do |line|
|
|
85
|
+
# skip lines that don't contain a package name
|
|
86
|
+
if line =~ /^Inst/
|
|
87
|
+
packages << Package.from_apt_line(line)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
packages
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def raw_apt_upgrade_text
|
|
95
|
+
`apt-get --just-print upgrade`
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>Instance Packages Report</title>
|
|
6
|
+
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono|Ubuntu:400,700' rel='stylesheet' type='text/css'>
|
|
7
|
+
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">
|
|
8
|
+
<style type="text/css">
|
|
9
|
+
body {
|
|
10
|
+
font-family: 'Ubuntu', sans-serif;
|
|
11
|
+
}
|
|
12
|
+
h2 {
|
|
13
|
+
margin-bottom: 5px;
|
|
14
|
+
border-bottom: 5px solid #f8f8f8;
|
|
15
|
+
}
|
|
16
|
+
pre {
|
|
17
|
+
font-family: 'Ubuntu Mono', ;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
strong.underline {
|
|
21
|
+
display: block;
|
|
22
|
+
border-bottom: 1px solid #ccc;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.changelog-expand {
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
.urgency-low {
|
|
29
|
+
}
|
|
30
|
+
.urgency-medium {
|
|
31
|
+
color: #e8ca71;
|
|
32
|
+
}
|
|
33
|
+
.urgency-high, .urgency-emergency, .urgency-critical {
|
|
34
|
+
color: #c63617;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
<% instances.each do |instance_id, packages| %>
|
|
40
|
+
<h2><%= instance_id.sub(".json", "") %></h2>
|
|
41
|
+
<% packages.each do |pkg_name, pkg_info| %>
|
|
42
|
+
<div>
|
|
43
|
+
<strong class="underline">
|
|
44
|
+
<% unless pkg_info["changelog"].empty? %>
|
|
45
|
+
<i class="fa fa-plus-circle changelog-expand urgency-<%= pkg_info["changelog"].join.match(/urgency=(\w+)/)[1] %>"></i>
|
|
46
|
+
<% end %>
|
|
47
|
+
<%= pkg_name %>
|
|
48
|
+
</strong>
|
|
49
|
+
<pre style="display: none;"><%= pkg_info["changelog"].join.gsub("\n", "<br>") %></pre>
|
|
50
|
+
</div>
|
|
51
|
+
<% end %>
|
|
52
|
+
<% end %>
|
|
53
|
+
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
|
54
|
+
<script>
|
|
55
|
+
$(function() {
|
|
56
|
+
$(".changelog-expand").click(function(e) {
|
|
57
|
+
var self = $(this);
|
|
58
|
+
self.parent().parent().find("pre").toggle();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'package_report/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "package-report"
|
|
8
|
+
spec.version = PackageReport::VERSION
|
|
9
|
+
spec.authors = ["Brian Racer"]
|
|
10
|
+
spec.email = ["bracer@gmail.com"]
|
|
11
|
+
spec.summary = %q{Analyze package upgrade options on debian based systems.}
|
|
12
|
+
spec.homepage = "https://github.com/anveo/package-report"
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
spec.require_paths = ["lib"]
|
|
19
|
+
|
|
20
|
+
spec.add_runtime_dependency "fog", ["= 1.21.0"]
|
|
21
|
+
spec.add_runtime_dependency "unf", ["= 0.1.3"]
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
|
24
|
+
spec.add_development_dependency "rake"
|
|
25
|
+
spec.add_development_dependency "activesupport", "3.2.15"
|
|
26
|
+
spec.add_development_dependency "guard", "2.6.0"
|
|
27
|
+
spec.add_development_dependency "guard-rspec", "4.2.8"
|
|
28
|
+
spec.add_development_dependency "rspec", "2.14.1"
|
|
29
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "Package" do
|
|
4
|
+
let(:package) { PackageReport::Package.new }
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
package.stub(:raw_installed_version).and_return("Version: 1.8.3p1-1ubuntu3.3")
|
|
8
|
+
package.stub(:raw_changelog).and_return(<<-EOS.strip_heredoc
|
|
9
|
+
sudo (1.8.3p1-1ubuntu3.6) precise-security; urgency=medium
|
|
10
|
+
|
|
11
|
+
* SECURITY UPDATE: security policy bypass when env_reset is disabled
|
|
12
|
+
- debian/patches/CVE-2014-0106.patch: fix logic inversion in
|
|
13
|
+
plugins/sudoers/env.c.
|
|
14
|
+
- CVE-2014-0106
|
|
15
|
+
* debian/sudo.sudo.init, debian/sudo-ldap.sudo.init: Set timestamps to
|
|
16
|
+
epoch in init scripts so they are properly invalidated. (LP: #1223297)
|
|
17
|
+
|
|
18
|
+
-- Marc Deslauriers <marc.deslauriers@ubuntu.com> Tue, 11 Mar 2014 07:56:53 -0400
|
|
19
|
+
|
|
20
|
+
sudo (1.8.3p1-1ubuntu3.4) precise-security; urgency=low
|
|
21
|
+
|
|
22
|
+
* SECURITY UPDATE: authentication bypass via clock set to epoch
|
|
23
|
+
- debian/patches/CVE-2013-1775.patch: ignore time stamp file if it is
|
|
24
|
+
set to epoch in plugins/sudoers/check.c.
|
|
25
|
+
- CVE-2013-1775
|
|
26
|
+
|
|
27
|
+
-- Marc Deslauriers <marc.deslauriers@ubuntu.com> Wed, 27 Feb 2013 13:34:15 -0500
|
|
28
|
+
|
|
29
|
+
sudo (1.8.3p1-1ubuntu3.3) precise-proposed; urgency=low
|
|
30
|
+
|
|
31
|
+
* debian/patches/pam_env_merge.patch: Merge the PAM environment into the
|
|
32
|
+
user environment (LP: #982684)
|
|
33
|
+
* debian/sudo.pam: Use pam_env to read /etc/environment and
|
|
34
|
+
/etc/default/locale environment files. Reading ~/.pam_environment is not
|
|
35
|
+
permitted due to security reasons.
|
|
36
|
+
|
|
37
|
+
-- Tyler Hicks <tyhicks@canonical.com> Mon, 21 May 2012 00:48:10 -0500
|
|
38
|
+
|
|
39
|
+
sudo (1.8.3p1-1ubuntu3.2) precise-security; urgency=low
|
|
40
|
+
|
|
41
|
+
* SECURITY UPDATE: Properly handle multiple netmasks in sudoers Host and
|
|
42
|
+
Host_List values
|
|
43
|
+
- debian/patches/CVE-2012-2337.patch: Don't perform IPv6 checks on IPv4
|
|
44
|
+
addresses. Based on upstream patch.
|
|
45
|
+
- CVE-2012-2337
|
|
46
|
+
|
|
47
|
+
-- Tyler Hicks <tyhicks@canonical.com> Tue, 15 May 2012 23:28:04 -0500
|
|
48
|
+
|
|
49
|
+
sudo (1.8.3p1-1ubuntu3.1) precise-proposed; urgency=low
|
|
50
|
+
|
|
51
|
+
* Fix Abort in some PAM modules when timestamp is valid. (LP: #927828)
|
|
52
|
+
|
|
53
|
+
-- TJ (Ubuntu Contributions) <ubuntu@tjworld.net> Mon, 30 Apr 2012 18:05:21 +0100
|
|
54
|
+
EOS
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe "#new" do
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe "#from_apt_line" do
|
|
62
|
+
it "extracts package information" do
|
|
63
|
+
package = PackageReport::Package.from_apt_line("Inst libudev0 [175-0ubuntu9.4] (175-0ubuntu9.5 Ubuntu:12.04/precise-updates [amd64])")
|
|
64
|
+
expect(package.name).to eq("libudev0")
|
|
65
|
+
expect(package.current_version).to eq("175-0ubuntu9.4")
|
|
66
|
+
expect(package.latest_version).to eq("175-0ubuntu9.5")
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe ".changelog_parts" do
|
|
71
|
+
it "parses the correct amount of changes" do
|
|
72
|
+
expect(package.changelog_parts.count).to be(5)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe ".fetch_version!" do
|
|
77
|
+
it "parses the correct version" do
|
|
78
|
+
package.current_version = nil
|
|
79
|
+
package.fetch_version!
|
|
80
|
+
expect(package.current_version).to eq("1.8.3p1-1ubuntu3.3")
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe ".newer_changes" do
|
|
85
|
+
it "only returns parts of the changelog that contain newer versions" do
|
|
86
|
+
package.current_version = "1.8.3p1-1ubuntu3.3"
|
|
87
|
+
expect(package.newer_changes.count).to be(2)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "Reporter" do
|
|
4
|
+
let(:reporter) { PackageReport::Reporter.new }
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
reporter.stub(:raw_apt_upgrade_text).and_return(<<-EOS.strip_heredoc
|
|
8
|
+
NOTE: This is only a simulation!
|
|
9
|
+
apt-get needs root privileges for real execution.
|
|
10
|
+
Keep also in mind that locking is deactivated,
|
|
11
|
+
so don't depend on the relevance to the real current situation!
|
|
12
|
+
Reading package lists... Done
|
|
13
|
+
Building dependency tree
|
|
14
|
+
Reading state information... Done
|
|
15
|
+
The following packages will be upgraded:
|
|
16
|
+
cloud-init grub-legacy-ec2 libudev0 udev
|
|
17
|
+
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
|
|
18
|
+
Inst libudev0 [175-0ubuntu9.4] (175-0ubuntu9.5 Ubuntu:12.04/precise-updates [amd64])
|
|
19
|
+
Inst udev [175-0ubuntu9.4] (175-0ubuntu9.5 Ubuntu:12.04/precise-updates [amd64])
|
|
20
|
+
Inst cloud-init [0.6.3-0ubuntu1.11] (0.6.3-0ubuntu1.12 Ubuntu:12.04/precise-updates [all])
|
|
21
|
+
Inst grub-legacy-ec2 [0.6.3-0ubuntu1.11] (0.6.3-0ubuntu1.12 Ubuntu:12.04/precise-updates [all])
|
|
22
|
+
Conf libudev0 (175-0ubuntu9.5 Ubuntu:12.04/precise-updates [amd64])
|
|
23
|
+
Conf udev (175-0ubuntu9.5 Ubuntu:12.04/precise-updates [amd64])
|
|
24
|
+
Conf cloud-init (0.6.3-0ubuntu1.12 Ubuntu:12.04/precise-updates [all])
|
|
25
|
+
Conf grub-legacy-ec2 (0.6.3-0ubuntu1.12 Ubuntu:12.04/precise-updates [all])
|
|
26
|
+
EOS
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe ".package_upgrades_available" do
|
|
31
|
+
it "extracts package information" do
|
|
32
|
+
expect(reporter.package_upgrades_available.map(&:name)).to include("libudev0")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: package-report
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Brian Racer
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: fog
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 1.21.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 1.21.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: unf
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.1.3
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.1.3
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.6'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.6'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: activesupport
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - '='
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 3.2.15
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - '='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 3.2.15
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: guard
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - '='
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 2.6.0
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - '='
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 2.6.0
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: guard-rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - '='
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 4.2.8
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - '='
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 4.2.8
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - '='
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 2.14.1
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - '='
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 2.14.1
|
|
125
|
+
description:
|
|
126
|
+
email:
|
|
127
|
+
- bracer@gmail.com
|
|
128
|
+
executables:
|
|
129
|
+
- package-report
|
|
130
|
+
extensions: []
|
|
131
|
+
extra_rdoc_files: []
|
|
132
|
+
files:
|
|
133
|
+
- ".gitignore"
|
|
134
|
+
- Gemfile
|
|
135
|
+
- Gemfile.lock
|
|
136
|
+
- Guardfile
|
|
137
|
+
- LICENSE.txt
|
|
138
|
+
- Procfile
|
|
139
|
+
- README.md
|
|
140
|
+
- Rakefile
|
|
141
|
+
- bin/package-report
|
|
142
|
+
- lib/package-report.rb
|
|
143
|
+
- lib/package_report/package.rb
|
|
144
|
+
- lib/package_report/reporter.rb
|
|
145
|
+
- lib/package_report/version.rb
|
|
146
|
+
- lib/templates/report.html.erb
|
|
147
|
+
- package-report.gemspec
|
|
148
|
+
- spec/lib/package_spec.rb
|
|
149
|
+
- spec/lib/reporter_spec.rb
|
|
150
|
+
- spec/spec_helper.rb
|
|
151
|
+
homepage: https://github.com/anveo/package-report
|
|
152
|
+
licenses:
|
|
153
|
+
- MIT
|
|
154
|
+
metadata: {}
|
|
155
|
+
post_install_message:
|
|
156
|
+
rdoc_options: []
|
|
157
|
+
require_paths:
|
|
158
|
+
- lib
|
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
|
+
requirements:
|
|
161
|
+
- - ">="
|
|
162
|
+
- !ruby/object:Gem::Version
|
|
163
|
+
version: '0'
|
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
|
+
requirements:
|
|
166
|
+
- - ">="
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '0'
|
|
169
|
+
requirements: []
|
|
170
|
+
rubyforge_project:
|
|
171
|
+
rubygems_version: 2.2.2
|
|
172
|
+
signing_key:
|
|
173
|
+
specification_version: 4
|
|
174
|
+
summary: Analyze package upgrade options on debian based systems.
|
|
175
|
+
test_files:
|
|
176
|
+
- spec/lib/package_spec.rb
|
|
177
|
+
- spec/lib/reporter_spec.rb
|
|
178
|
+
- spec/spec_helper.rb
|