packaging 0.99.5 → 0.99.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/tar.rb +9 -0
- data/lib/packaging/util/net.rb +7 -3
- data/lib/packaging/util/ship.rb +3 -14
- data/spec/fixtures/config/ext/build_defaults.yaml +1 -0
- data/spec/fixtures/config/ext/project_data.yaml +1 -0
- data/spec/lib/packaging/tar_spec.rb +34 -40
- data/tasks/jenkins.rake +3 -0
- data/tasks/tar.rake +0 -6
- metadata +3 -3
- data/spec/fixtures/config/ext/build_defaults.yaml +0 -2
- data/spec/fixtures/config/ext/project_data.yaml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba97fcaafa8f44758ff46728fc92b8a9deba25c0
|
4
|
+
data.tar.gz: 8237f37fa5bf175ca83a5b0585d5ff3cd4290c86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 574e7666a242a85dacee420f6170b1415f1fec4efa89822c440fb6b2bba352778f671b51cd056a337f265813157a158f3ad915a1b2f89d92f6cb8aa1fb2ad3d6
|
7
|
+
data.tar.gz: 1f0154a3631c4400be640c2a93db32225cafb872f57e176b85c66b7baa8f952775dc61a7a1354d986877641398ddeb7642c561ac7a0de05450efd692516e92b8
|
data/lib/packaging/tar.rb
CHANGED
@@ -14,6 +14,10 @@ module Pkg
|
|
14
14
|
@files = Pkg::Config.files
|
15
15
|
@target = File.join(Pkg::Config.project_root, "pkg", "#{@project}-#{@version}.tar.gz")
|
16
16
|
|
17
|
+
# If the user did not specify any files, then archive the entire working directory
|
18
|
+
# instead
|
19
|
+
@files ||= Dir.glob('*')
|
20
|
+
|
17
21
|
# We require that the excludes list be a string (which is space
|
18
22
|
# separated, we hope)(deprecated) or an array.
|
19
23
|
#
|
@@ -30,6 +34,11 @@ module Pkg
|
|
30
34
|
@excludes = []
|
31
35
|
end
|
32
36
|
|
37
|
+
# If the user has specified things to exclude via config file, they will be
|
38
|
+
# honored by the tar class, but we also always exclude the packaging repo
|
39
|
+
# and 'pkg' directory.
|
40
|
+
@excludes += ['pkg', 'ext/packaging']
|
41
|
+
|
33
42
|
# On the other hand, support for explicit templates started with Arrays,
|
34
43
|
# so that's all we support.
|
35
44
|
#
|
data/lib/packaging/util/net.rb
CHANGED
@@ -294,9 +294,13 @@ module Pkg::Util::Net
|
|
294
294
|
# e.g. 'agent' if only searching for 'puppet'.
|
295
295
|
def remote_create_latest_symlink(package_name, dir, platform_ext, options = {})
|
296
296
|
ls_cmd = "ls -1 *.#{platform_ext} | grep -v latest | grep -v rc | grep #{package_name} "
|
297
|
+
|
298
|
+
# store this in a separate var to avoid side affects
|
299
|
+
full_package_name = String.new(package_name)
|
300
|
+
|
297
301
|
if options[:arch]
|
298
302
|
ls_cmd << "| grep #{options[:arch]}"
|
299
|
-
|
303
|
+
full_package_name << "-#{options[:arch]}"
|
300
304
|
end
|
301
305
|
if options[:excludes]
|
302
306
|
options[:excludes].each do |excl|
|
@@ -312,11 +316,11 @@ module Pkg::Util::Net
|
|
312
316
|
pushd '#{dir}'
|
313
317
|
link_target=$(#{ls_cmd})
|
314
318
|
if [ -z "$link_target" ] ; then
|
315
|
-
echo "Unable to find a link target for '#{
|
319
|
+
echo "Unable to find a link target for '#{full_package_name}' in '#{dir}'; skipping link creation"
|
316
320
|
exit 0
|
317
321
|
fi
|
318
322
|
echo "creating link to '$link_target'"
|
319
|
-
ln -sf "$link_target" #{
|
323
|
+
ln -sf "$link_target" #{full_package_name}-latest.#{platform_ext}
|
320
324
|
CMD
|
321
325
|
|
322
326
|
_, err = Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.staging_server, cmd, true)
|
data/lib/packaging/util/ship.rb
CHANGED
@@ -137,12 +137,8 @@ module Pkg::Util::Ship
|
|
137
137
|
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, remote_path, opts[:nonfinal])
|
138
138
|
|
139
139
|
Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
|
140
|
-
# TODO remove the PC1 links when we no longer need to maintain them
|
141
|
-
# [written by Melissa, copied by Molly]
|
142
|
-
_, version, arch = Pkg::Platforms.parse_platform_tag(platform_tag)
|
143
|
-
Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', "/opt/downloads/mac/#{version}/PC1/#{arch}", 'dmg')
|
144
140
|
# Create the latest symlink for the current supported repo
|
145
|
-
Pkg::Util::Net.remote_create_latest_symlink(
|
141
|
+
Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(platform_tag, remote_path), 'dmg')
|
146
142
|
end
|
147
143
|
end
|
148
144
|
|
@@ -157,15 +153,8 @@ module Pkg::Util::Ship
|
|
157
153
|
|
158
154
|
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, remote_path, opts[:nonfinal])
|
159
155
|
# Create the symlinks for the latest supported repo
|
160
|
-
Pkg::Util::Net.remote_create_latest_symlink(
|
161
|
-
Pkg::Util::Net.remote_create_latest_symlink(
|
162
|
-
|
163
|
-
# We provide symlinks to the latest package in a given directory. This
|
164
|
-
# allows users to upgrade more easily to the latest version that we release
|
165
|
-
# TODO remove the links to PC1 when we no longer ship to that repo [written
|
166
|
-
# by Melissa, copied by Molly]
|
167
|
-
Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', '/opt/downloads/windows', 'msi', arch: 'x64')
|
168
|
-
Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', '/opt/downloads/windows', 'msi', arch: 'x86')
|
156
|
+
Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path), 'msi', arch: 'x64')
|
157
|
+
Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path), 'msi', arch: 'x86')
|
169
158
|
end
|
170
159
|
|
171
160
|
def ship_gem(local_staging_directory, remote_path, opts = {})
|
@@ -0,0 +1 @@
|
|
1
|
+
../params.yaml
|
@@ -0,0 +1 @@
|
|
1
|
+
../params.yaml
|
@@ -20,34 +20,44 @@ describe "tar.rb" do
|
|
20
20
|
"#{PROJECT_ROOT}/ext/debian/changelog.erb"
|
21
21
|
]
|
22
22
|
end
|
23
|
+
before(:each) do
|
24
|
+
Pkg::Config.config_from_hash(
|
25
|
+
{
|
26
|
+
:templates => templates,
|
27
|
+
:project => project,
|
28
|
+
:version => version,
|
29
|
+
:files => files,
|
30
|
+
:project_root => PROJECT_ROOT,
|
31
|
+
:packaging_root => "ext/packaging"
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#initialize' do
|
36
|
+
it 'should always mark ext/packaging and pkg directories as excluded files' do
|
37
|
+
Pkg::Config.tar_excludes = ['foo']
|
38
|
+
expect(Pkg::Tar.new.excludes).to eql(['foo', 'pkg', 'ext/packaging'])
|
39
|
+
|
40
|
+
Pkg::Config.tar_excludes = []
|
41
|
+
expect(Pkg::Tar.new.excludes).to eql(['pkg', 'ext/packaging'])
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should archive the entire project directory by default' do
|
45
|
+
Pkg::Config.files = nil
|
46
|
+
expect(Pkg::Tar.new.files).to eql(Dir.glob('*'))
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should archive the user-specified list of files' do
|
50
|
+
expect(Pkg::Tar.new.files).to eql(files)
|
51
|
+
end
|
52
|
+
end
|
23
53
|
|
24
54
|
describe "#expand_templates" do
|
25
55
|
it "should be invoked when Pkg::Config.templates is set" do
|
26
|
-
Pkg::Config.config_from_hash(
|
27
|
-
{
|
28
|
-
:templates => templates,
|
29
|
-
:project => project,
|
30
|
-
:version => version,
|
31
|
-
:files => files,
|
32
|
-
:project_root => PROJECT_ROOT,
|
33
|
-
:packaging_root => "ext/packaging"
|
34
|
-
})
|
35
|
-
|
36
56
|
Pkg::Tar.any_instance.should_receive(:expand_templates)
|
37
57
|
Pkg::Tar.new
|
38
58
|
end
|
39
59
|
|
40
60
|
it "packaging templates should be filtered and paths should be expanded" do
|
41
|
-
Pkg::Config.config_from_hash(
|
42
|
-
{
|
43
|
-
:templates => templates,
|
44
|
-
:project => project,
|
45
|
-
:version => version,
|
46
|
-
:files => files,
|
47
|
-
:project_root => PROJECT_ROOT,
|
48
|
-
:packaging_root => "ext/packaging"
|
49
|
-
})
|
50
|
-
|
51
61
|
templates.each do |temp|
|
52
62
|
if temp.is_a?(String)
|
53
63
|
Dir.stub(:glob).with(File.join(PROJECT_ROOT, temp)).and_return(File.join(PROJECT_ROOT, temp))
|
@@ -62,17 +72,11 @@ describe "tar.rb" do
|
|
62
72
|
end
|
63
73
|
|
64
74
|
describe "#template" do
|
65
|
-
|
66
|
-
Pkg::Config.
|
67
|
-
|
68
|
-
:templates => expanded_templates,
|
69
|
-
:project => project,
|
70
|
-
:version => version,
|
71
|
-
:files => files,
|
72
|
-
:project_root => PROJECT_ROOT,
|
73
|
-
:packaging_root => "ext/packaging"
|
74
|
-
})
|
75
|
+
before(:each) do
|
76
|
+
Pkg::Config.templates = expanded_templates
|
77
|
+
end
|
75
78
|
|
79
|
+
it "should handle hashes and strings correctly" do
|
76
80
|
# Set up correct stubs and expectations
|
77
81
|
expanded_templates.each do |temp|
|
78
82
|
if temp.is_a?(String)
|
@@ -92,16 +96,6 @@ describe "tar.rb" do
|
|
92
96
|
end
|
93
97
|
|
94
98
|
it "should raise an error if the template source can't be found" do
|
95
|
-
Pkg::Config.config_from_hash(
|
96
|
-
{
|
97
|
-
:templates => expanded_templates,
|
98
|
-
:project => project,
|
99
|
-
:version => version,
|
100
|
-
:files => files,
|
101
|
-
:project_root => PROJECT_ROOT,
|
102
|
-
:packaging_root => "ext/packaging"
|
103
|
-
})
|
104
|
-
|
105
99
|
# Set up correct stubs and expectations
|
106
100
|
expanded_templates.each do |temp|
|
107
101
|
if temp.is_a?(String)
|
data/tasks/jenkins.rake
CHANGED
@@ -259,11 +259,14 @@ namespace :pl do
|
|
259
259
|
ship_swix
|
260
260
|
ship_tar
|
261
261
|
ship_msi
|
262
|
+
ship_gem
|
262
263
|
)
|
263
264
|
tasks.map { |t| "pl:#{t}" }.each do |t|
|
264
265
|
puts "Running #{t} . . ."
|
265
266
|
Rake::Task[t].invoke
|
266
267
|
end
|
268
|
+
# mark the build as successfully shipped
|
269
|
+
Rake::Task["pl:jenkins:ship"].invoke("shipped")
|
267
270
|
end
|
268
271
|
|
269
272
|
task :stage_nightlies => "pl:fetch" do
|
data/tasks/tar.rake
CHANGED
@@ -16,12 +16,6 @@ namespace :package do
|
|
16
16
|
#
|
17
17
|
tar.templates ||= Dir[File.join(Pkg::Config.project_root, "ext", "**", "*.erb")].select { |i| i !~ /ext\/packaging|ext\/osx/ }
|
18
18
|
|
19
|
-
|
20
|
-
# If the user has specified things to exclude via config file, they will be
|
21
|
-
# honored by the tar class, but we also always exclude the packaging repo.
|
22
|
-
#
|
23
|
-
tar.excludes << "ext/packaging"
|
24
|
-
|
25
19
|
tar.pkg!
|
26
20
|
|
27
21
|
puts "Wrote #{`pwd`.strip}/pkg/#{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
211
|
+
rubygems_version: 2.5.2.1
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: Puppet Labs' packaging automation
|