berkshelf 7.0.3 → 7.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/berkshelf/uploader.rb +15 -9
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/uploader_spec.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a9aad824018ff76341d429a3f3d1a56a3a20baa0a47353b71214103dd0b82db
|
4
|
+
data.tar.gz: e99375d510d02668eeb7734aad0dacc173aadd0b8751f0bcea2d6f23821da4b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86965767066caf25df3b87b33d17968d7dde55bf34613d5748fecebba7f00ac36bd0b0c1217f02342435f6c3e6106f9bd019bf687823aac9107ffc6c8e420e85
|
7
|
+
data.tar.gz: 65f4eb23956d447c36eb2fb90b8d96bd89ab39352f1478bed5ff4969479a4b6781a1943009439e5b41c5ea5631dc81fbb44a5ad1c2b10c0fdcd8d18bbc92fb69
|
data/Gemfile.lock
CHANGED
data/lib/berkshelf/uploader.rb
CHANGED
@@ -104,18 +104,22 @@ module Berkshelf
|
|
104
104
|
#
|
105
105
|
# @return [Array<CachedCookbook>]
|
106
106
|
#
|
107
|
-
def lookup_dependencies(cookbook,
|
107
|
+
def lookup_dependencies(cookbook, checked = {})
|
108
108
|
Berkshelf.log.debug " Looking up dependencies for #{cookbook}"
|
109
|
+
|
110
|
+
dependencies = []
|
111
|
+
|
109
112
|
lockfile.graph.find(cookbook).dependencies.each do |name, _|
|
110
113
|
next if checked[name]
|
111
114
|
|
112
|
-
|
113
|
-
|
115
|
+
# break cyclic graphs
|
114
116
|
checked[name] = true
|
115
117
|
|
116
|
-
|
118
|
+
# this is your standard depth-first tree traversal with the deps first...
|
119
|
+
dependencies += lookup_dependencies(name, checked)
|
120
|
+
# ..then the node itself
|
121
|
+
dependencies << name
|
117
122
|
end
|
118
|
-
|
119
123
|
dependencies
|
120
124
|
end
|
121
125
|
|
@@ -134,11 +138,13 @@ module Berkshelf
|
|
134
138
|
# that would be a bad idea...
|
135
139
|
dependencies = berksfile.dependencies.map(&:name)
|
136
140
|
|
137
|
-
|
138
|
-
|
139
|
-
|
141
|
+
checked = {}
|
142
|
+
cookbook_order = dependencies.map do |dependency|
|
143
|
+
# for each dep add all its deps first, then the dep itself
|
144
|
+
lookup_dependencies(dependency, checked) + [ dependency ]
|
145
|
+
end.flatten
|
140
146
|
|
141
|
-
cookbook_order.
|
147
|
+
cookbook_order.uniq.map { |dependency| lockfile.retrieve(dependency) }
|
142
148
|
end
|
143
149
|
end
|
144
150
|
end
|
data/lib/berkshelf/version.rb
CHANGED
@@ -231,7 +231,18 @@ module Berkshelf
|
|
231
231
|
subject { described_class.new(berksfile).send(:filtered_cookbooks) }
|
232
232
|
|
233
233
|
it "returns filtered list in correct order" do
|
234
|
-
|
234
|
+
upload_order = subject.map(&:name)
|
235
|
+
# assert that dependent cookbooks are uploaded before the cookbooks that depend on them
|
236
|
+
expect(upload_order.index("apt")).to be < upload_order.index("jenkins")
|
237
|
+
expect(upload_order.index("runit")).to be < upload_order.index("jenkins")
|
238
|
+
expect(upload_order.index("yum")).to be < upload_order.index("jenkins")
|
239
|
+
expect(upload_order.index("jenkins")).to be < upload_order.index("jenkins-config")
|
240
|
+
expect(upload_order.index("yum")).to be < upload_order.index("jenkins-config")
|
241
|
+
expect(upload_order.index("build-essential")).to be < upload_order.index("runit")
|
242
|
+
expect(upload_order.index("yum")).to be < upload_order.index("runit")
|
243
|
+
expect(upload_order.index("yum-epel")).to be < upload_order.index("runit")
|
244
|
+
expect(upload_order.index("yum")).to be < upload_order.index("yum-epel")
|
245
|
+
expect(upload_order.uniq.length).to eql(upload_order.length)
|
235
246
|
end
|
236
247
|
end
|
237
248
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2018-06-
|
15
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: mixlib-shellout
|