packaging 0.88.77
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/LICENSE +17 -0
- data/README-Solaris.md +117 -0
- data/README.md +977 -0
- data/lib/packaging.rb +32 -0
- data/lib/packaging/archive.rb +126 -0
- data/lib/packaging/artifactory.rb +651 -0
- data/lib/packaging/artifactory/extensions.rb +94 -0
- data/lib/packaging/config.rb +492 -0
- data/lib/packaging/config/params.rb +387 -0
- data/lib/packaging/config/validations.rb +13 -0
- data/lib/packaging/deb.rb +28 -0
- data/lib/packaging/deb/repo.rb +264 -0
- data/lib/packaging/gem.rb +70 -0
- data/lib/packaging/metrics.rb +15 -0
- data/lib/packaging/nuget.rb +39 -0
- data/lib/packaging/paths.rb +376 -0
- data/lib/packaging/platforms.rb +507 -0
- data/lib/packaging/repo.rb +155 -0
- data/lib/packaging/retrieve.rb +75 -0
- data/lib/packaging/rpm.rb +5 -0
- data/lib/packaging/rpm/repo.rb +254 -0
- data/lib/packaging/sign.rb +8 -0
- data/lib/packaging/sign/deb.rb +9 -0
- data/lib/packaging/sign/dmg.rb +41 -0
- data/lib/packaging/sign/ips.rb +57 -0
- data/lib/packaging/sign/msi.rb +124 -0
- data/lib/packaging/sign/rpm.rb +115 -0
- data/lib/packaging/tar.rb +163 -0
- data/lib/packaging/util.rb +146 -0
- data/lib/packaging/util/date.rb +20 -0
- data/lib/packaging/util/execution.rb +85 -0
- data/lib/packaging/util/file.rb +125 -0
- data/lib/packaging/util/git.rb +174 -0
- data/lib/packaging/util/git_tags.rb +73 -0
- data/lib/packaging/util/gpg.rb +66 -0
- data/lib/packaging/util/jenkins.rb +95 -0
- data/lib/packaging/util/misc.rb +69 -0
- data/lib/packaging/util/net.rb +410 -0
- data/lib/packaging/util/os.rb +17 -0
- data/lib/packaging/util/platform.rb +40 -0
- data/lib/packaging/util/rake_utils.rb +112 -0
- data/lib/packaging/util/serialization.rb +19 -0
- data/lib/packaging/util/ship.rb +300 -0
- data/lib/packaging/util/tool.rb +41 -0
- data/lib/packaging/util/version.rb +334 -0
- data/spec/fixtures/config/ext/build_defaults.yaml +2 -0
- data/spec/fixtures/config/ext/project_data.yaml +2 -0
- data/spec/fixtures/configs/components/test_file.json +1 -0
- data/spec/fixtures/configs/components/test_file_2.json +0 -0
- data/spec/fixtures/configs/components/test_file_not_tagged.json +1 -0
- data/spec/fixtures/configs/components/test_file_wrong_ext.txt +0 -0
- data/spec/fixtures/configs/components/test_file_wrong_ext.wrong +0 -0
- data/spec/fixtures/util/pre_tasks.yaml +4 -0
- data/spec/lib/packaging/artifactory_spec.rb +221 -0
- data/spec/lib/packaging/config_spec.rb +576 -0
- data/spec/lib/packaging/deb/repo_spec.rb +157 -0
- data/spec/lib/packaging/deb_spec.rb +52 -0
- data/spec/lib/packaging/gem_spec.rb +86 -0
- data/spec/lib/packaging/paths_spec.rb +418 -0
- data/spec/lib/packaging/platforms_spec.rb +178 -0
- data/spec/lib/packaging/repo_spec.rb +135 -0
- data/spec/lib/packaging/retrieve_spec.rb +100 -0
- data/spec/lib/packaging/rpm/repo_spec.rb +133 -0
- data/spec/lib/packaging/sign_spec.rb +133 -0
- data/spec/lib/packaging/tar_spec.rb +116 -0
- data/spec/lib/packaging/util/execution_spec.rb +56 -0
- data/spec/lib/packaging/util/file_spec.rb +139 -0
- data/spec/lib/packaging/util/git_spec.rb +160 -0
- data/spec/lib/packaging/util/git_tag_spec.rb +36 -0
- data/spec/lib/packaging/util/gpg_spec.rb +64 -0
- data/spec/lib/packaging/util/jenkins_spec.rb +112 -0
- data/spec/lib/packaging/util/misc_spec.rb +31 -0
- data/spec/lib/packaging/util/net_spec.rb +259 -0
- data/spec/lib/packaging/util/os_spec.rb +31 -0
- data/spec/lib/packaging/util/rake_utils_spec.rb +70 -0
- data/spec/lib/packaging/util/ship_spec.rb +199 -0
- data/spec/lib/packaging/util/version_spec.rb +123 -0
- data/spec/lib/packaging_spec.rb +19 -0
- data/spec/spec_helper.rb +22 -0
- data/static_artifacts/PackageInfo.plist +3 -0
- data/tasks/00_utils.rake +214 -0
- data/tasks/30_metrics.rake +33 -0
- data/tasks/apple.rake +268 -0
- data/tasks/archive.rake +69 -0
- data/tasks/build.rake +12 -0
- data/tasks/clean.rake +5 -0
- data/tasks/config.rake +35 -0
- data/tasks/deb.rake +129 -0
- data/tasks/deb_repos.rake +28 -0
- data/tasks/deprecated.rake +130 -0
- data/tasks/doc.rake +20 -0
- data/tasks/education.rake +57 -0
- data/tasks/fetch.rake +60 -0
- data/tasks/gem.rake +159 -0
- data/tasks/jenkins.rake +538 -0
- data/tasks/jenkins_dynamic.rake +202 -0
- data/tasks/load_extras.rake +21 -0
- data/tasks/mock.rake +348 -0
- data/tasks/nightly_repos.rake +286 -0
- data/tasks/pe_deb.rake +12 -0
- data/tasks/pe_rpm.rake +13 -0
- data/tasks/pe_ship.rake +226 -0
- data/tasks/pe_sign.rake +13 -0
- data/tasks/pe_tar.rake +5 -0
- data/tasks/retrieve.rake +52 -0
- data/tasks/rpm.rake +66 -0
- data/tasks/rpm_repos.rake +29 -0
- data/tasks/ship.rake +692 -0
- data/tasks/sign.rake +154 -0
- data/tasks/tag.rake +8 -0
- data/tasks/tar.rake +28 -0
- data/tasks/update.rake +16 -0
- data/tasks/vanagon.rake +35 -0
- data/tasks/vendor_gems.rake +117 -0
- data/tasks/version.rake +33 -0
- data/tasks/z_data_dump.rake +65 -0
- data/templates/README +1 -0
- data/templates/downstream.xml.erb +47 -0
- data/templates/msi.xml.erb +197 -0
- data/templates/packaging.xml.erb +346 -0
- data/templates/repo.xml.erb +117 -0
- metadata +287 -0
data/tasks/sign.rake
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
namespace :pl do
|
|
2
|
+
desc "Sign the tarball, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
|
|
3
|
+
task :sign_tar do
|
|
4
|
+
unless Pkg::Config.vanagon_project
|
|
5
|
+
tarballs_to_sign = Pkg::Util::Ship.collect_packages(['pkg/*.tar.gz'], ['signing_bundle', 'packaging-bundle'])
|
|
6
|
+
Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
|
|
7
|
+
tarballs_to_sign.each do |file|
|
|
8
|
+
Pkg::Util::Gpg.sign_file file
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# If no directory to sign is specified assume "pkg"
|
|
14
|
+
$DEFAULT_DIRECTORY = "pkg"
|
|
15
|
+
|
|
16
|
+
desc "Sign the Arista EOS swix packages, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
|
|
17
|
+
task :sign_swix, :root_dir do |_t, args|
|
|
18
|
+
swix_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
19
|
+
packages = Dir["#{swix_dir}/**/*.swix"]
|
|
20
|
+
unless packages.empty?
|
|
21
|
+
Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
|
|
22
|
+
packages.each do |swix_package|
|
|
23
|
+
Pkg::Util::Gpg.sign_file swix_package
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
desc "Detach sign any solaris svr4 packages"
|
|
29
|
+
task :sign_svr4, :root_dir do |_t, args|
|
|
30
|
+
svr4_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
31
|
+
unless Dir["#{svr4_dir}/**/*.pkg.gz"].empty?
|
|
32
|
+
Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
|
|
33
|
+
Dir["#{svr4_dir}/**/*.pkg.gz"].each do |pkg|
|
|
34
|
+
Pkg::Util::Gpg.sign_file pkg
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
desc "Sign mocked rpms, Defaults to PL Key, pass GPG_KEY to override"
|
|
40
|
+
task :sign_rpms, :root_dir do |t, args|
|
|
41
|
+
rpm_directory = args.root_dir || $DEFAULT_DIRECTORY
|
|
42
|
+
Pkg::Sign::Rpm.sign_all(rpm_directory)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
desc "Sign ips package, uses PL certificates by default, update privatekey_pem, certificate_pem, and ips_inter_cert in build_defaults.yaml to override."
|
|
46
|
+
task :sign_ips, :root_dir do |_t, args|
|
|
47
|
+
ips_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
48
|
+
Pkg::Sign::Ips.sign(ips_dir) unless Dir["#{ips_dir}/**/*.p5p"].empty?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
desc "Sign built gems, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
|
|
52
|
+
task :sign_gem, :root_dir do |_t, args|
|
|
53
|
+
gems_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
54
|
+
gems = FileList["#{gems_dir}/*.gem"]
|
|
55
|
+
gems.each do |gem|
|
|
56
|
+
puts "signing gem #{gem}"
|
|
57
|
+
Pkg::Util::Gpg.sign_file(gem)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
desc "Check if all rpms are signed"
|
|
62
|
+
task :check_rpm_sigs, :root_dir do |_t, args|
|
|
63
|
+
rpm_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
64
|
+
signed = true
|
|
65
|
+
rpms = Dir["#{rpm_dir}/**/*.rpm"]
|
|
66
|
+
print 'Checking rpm signatures'
|
|
67
|
+
rpms.each do |rpm|
|
|
68
|
+
if Pkg::Sign::Rpm.has_sig? rpm
|
|
69
|
+
print '.'
|
|
70
|
+
else
|
|
71
|
+
puts "#{rpm} is unsigned."
|
|
72
|
+
signed = false
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
fail unless signed
|
|
76
|
+
puts "All rpms signed"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
desc "Sign generated debian changes files. Defaults to PL Key, pass GPG_KEY to override"
|
|
80
|
+
task :sign_deb_changes, :root_dir do |_t, args|
|
|
81
|
+
begin
|
|
82
|
+
deb_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
83
|
+
change_files = Dir["#{deb_dir}/**/*.changes"]
|
|
84
|
+
unless change_files.empty?
|
|
85
|
+
Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
|
|
86
|
+
change_files.each do |file|
|
|
87
|
+
Pkg::Sign::Deb.sign_changes(file)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
ensure
|
|
91
|
+
Pkg::Util::Gpg.kill_keychain
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
desc "Sign OSX packages"
|
|
96
|
+
task :sign_osx, [:root_dir] => "pl:fetch" do |_t, args|
|
|
97
|
+
dmg_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
98
|
+
Pkg::Sign::Dmg.sign(dmg_dir) unless Dir["#{dmg_dir}/**/*.dmg"].empty?
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
desc "Sign MSI packages"
|
|
102
|
+
task :sign_msi, [:root_dir] => "pl:fetch" do |_t, args|
|
|
103
|
+
msi_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
104
|
+
Pkg::Sign::Msi.sign(msi_dir) unless Dir["#{msi_dir}/**/*.msi"].empty?
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
##
|
|
108
|
+
# This crazy piece of work establishes a remote repo on the signing
|
|
109
|
+
# server, ships our packages out to it, signs them, and brings them back.
|
|
110
|
+
#
|
|
111
|
+
namespace :jenkins do
|
|
112
|
+
desc "Sign all locally staged packages on #{Pkg::Config.signing_server}"
|
|
113
|
+
task :sign_all, :root_dir do |_t, args|
|
|
114
|
+
Pkg::Util::RakeUtils.invoke_task('pl:fetch')
|
|
115
|
+
root_dir = args.root_dir || $DEFAULT_DIRECTORY
|
|
116
|
+
Dir["#{root_dir}/*"].empty? and fail "There were no files found in #{root_dir}. Maybe you wanted to build/retrieve something first?"
|
|
117
|
+
|
|
118
|
+
# Because rpms and debs are laid out differently in PE under pkg/ they
|
|
119
|
+
# have a different sign task to address this. Rather than create a whole
|
|
120
|
+
# extra :jenkins task for signing PE, we determine which sign task to use
|
|
121
|
+
# based on if we're building PE.
|
|
122
|
+
# We also listen in on the environment variable SIGNING_BUNDLE. This is
|
|
123
|
+
# _NOT_ intended for public use, but rather with the internal promotion
|
|
124
|
+
# workflow for Puppet Enterprise. SIGNING_BUNDLE is the path to a tarball
|
|
125
|
+
# containing a git bundle to be used as the environment for the packaging
|
|
126
|
+
# repo in a signing operation.
|
|
127
|
+
signing_bundle = ENV['SIGNING_BUNDLE']
|
|
128
|
+
rpm_sign_task = Pkg::Config.build_pe ? "pe:sign_rpms" : "pl:sign_rpms"
|
|
129
|
+
deb_sign_task = Pkg::Config.build_pe ? "pe:sign_deb_changes" : "pl:sign_deb_changes"
|
|
130
|
+
sign_tasks = [rpm_sign_task]
|
|
131
|
+
sign_tasks << deb_sign_task unless Dir["#{root_dir}/**/*.changes"].empty?
|
|
132
|
+
sign_tasks << "pl:sign_tar" if Pkg::Config.build_tar
|
|
133
|
+
sign_tasks << "pl:sign_gem" if Pkg::Config.build_gem
|
|
134
|
+
sign_tasks << "pl:sign_osx" if Pkg::Config.build_dmg || Pkg::Config.vanagon_project
|
|
135
|
+
sign_tasks << "pl:sign_swix" if Pkg::Config.vanagon_project
|
|
136
|
+
sign_tasks << "pl:sign_svr4" if Pkg::Config.vanagon_project
|
|
137
|
+
sign_tasks << "pl:sign_ips" if Pkg::Config.vanagon_project
|
|
138
|
+
sign_tasks << "pl:sign_msi" if Pkg::Config.build_msi || Pkg::Config.vanagon_project
|
|
139
|
+
remote_repo = Pkg::Util::Net.remote_unpack_git_bundle(Pkg::Config.signing_server, 'HEAD', nil, signing_bundle)
|
|
140
|
+
build_params = Pkg::Util::Net.remote_buildparams(Pkg::Config.signing_server, Pkg::Config)
|
|
141
|
+
Pkg::Util::Net.rsync_to(root_dir, Pkg::Config.signing_server, remote_repo)
|
|
142
|
+
rake_command = <<-DOC
|
|
143
|
+
cd #{remote_repo} ;
|
|
144
|
+
#{Pkg::Util::Net.remote_bundle_install_command}
|
|
145
|
+
bundle exec rake #{sign_tasks.map { |task| task + "[#{root_dir}]" }.join(" ")} PARAMS_FILE=#{build_params}
|
|
146
|
+
DOC
|
|
147
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.signing_server, rake_command)
|
|
148
|
+
Pkg::Util::Net.rsync_from("#{remote_repo}/#{root_dir}/", Pkg::Config.signing_server, "#{root_dir}/")
|
|
149
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.signing_server, "rm -rf #{remote_repo}")
|
|
150
|
+
Pkg::Util::Net.remote_execute(Pkg::Config.signing_server, "rm #{build_params}")
|
|
151
|
+
puts "Signed packages staged in #{root_dir}/ directory"
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
data/tasks/tag.rake
ADDED
data/tasks/tar.rake
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
namespace :package do
|
|
2
|
+
desc "Create a source tar archive"
|
|
3
|
+
task :tar => [:clean] do
|
|
4
|
+
|
|
5
|
+
if Pkg::Config.pre_tar_task
|
|
6
|
+
Pkg::Util::RakeUtils.invoke_task(Pkg::Config.pre_tar_task)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Rake::Task["package:doc"].invoke if Pkg::Config.build_doc
|
|
10
|
+
|
|
11
|
+
tar = Pkg::Tar.new
|
|
12
|
+
|
|
13
|
+
# If the user has specified templates via config file, they will be ack'd
|
|
14
|
+
# by the tar class. Otherwise, we load what we consider to be the "default"
|
|
15
|
+
# set, which is default for historical purposes.
|
|
16
|
+
#
|
|
17
|
+
tar.templates ||= Dir[File.join(Pkg::Config.project_root, "ext", "**", "*.erb")].select { |i| i !~ /ext\/packaging|ext\/osx/ }
|
|
18
|
+
|
|
19
|
+
tar.pkg!
|
|
20
|
+
|
|
21
|
+
puts "Wrote #{`pwd`.strip}/pkg/#{Pkg::Config.project}-#{Pkg::Config.version}.tar.gz"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
namespace :pl do
|
|
26
|
+
task :tar => ["package:tar"]
|
|
27
|
+
end
|
|
28
|
+
|
data/tasks/update.rake
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
namespace :package do
|
|
2
|
+
desc "Update your clone of the packaging repo with `git pull`"
|
|
3
|
+
task :update do
|
|
4
|
+
cd 'ext/packaging' do
|
|
5
|
+
remote = Pkg::Config.packaging_url.split(' ')[0]
|
|
6
|
+
branch = Pkg::Config.packaging_url.split(' ')[1].split('=')[1]
|
|
7
|
+
if branch.nil? or remote.nil?
|
|
8
|
+
$stderr.puts "Couldn't parse the packaging repo URL from 'ext/build_defaults.yaml'."
|
|
9
|
+
$stderr.puts "Normally this is a string in the format git@github.com:<User>/<packaging_repo> --branch=<branch>"
|
|
10
|
+
else
|
|
11
|
+
Pkg::Util::Git.pull(remote, branch)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
data/tasks/vanagon.rake
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
namespace :vanagon do
|
|
2
|
+
# vanagon:check_tags is used to report the tagged status of vanagon components
|
|
3
|
+
# with "ref" fields indicated in their json files. This function does not create
|
|
4
|
+
# any barriers or stop execution, it's only a report
|
|
5
|
+
desc "Check for tagged components in vanagon projects"
|
|
6
|
+
task :check_tags do
|
|
7
|
+
# only available to vanagon projects
|
|
8
|
+
unless Pkg::Config.vanagon_project
|
|
9
|
+
puts "This is not a vanagon project"
|
|
10
|
+
return
|
|
11
|
+
end
|
|
12
|
+
puts "*" * (ENV["COLUMNS"] || 70).to_i
|
|
13
|
+
Pkg::Util.in_project_root do
|
|
14
|
+
Pkg::Util::File.files_with_ext("configs/components", ".json").each do |json_file|
|
|
15
|
+
json_data = Pkg::Util::Misc.load_from_json(json_file)
|
|
16
|
+
# Don't report on anything without a ref
|
|
17
|
+
if json_data["ref"].is_a?(String)
|
|
18
|
+
Pkg::Util::Version.report_json_tags(json_data)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# This is just a wrapper for uber_build that runs the check_tags report and
|
|
25
|
+
# pauses for input, mainly so we can manually check for tagged components
|
|
26
|
+
# before spending time on a build
|
|
27
|
+
desc "Run component tag reports, if the report is okay, run an uber_build"
|
|
28
|
+
task :build_all, [:poll_interval] do |t, args|
|
|
29
|
+
args.with_defaults(:poll_interval => 0)
|
|
30
|
+
Rake::Task["vanagon:check_tags"].invoke
|
|
31
|
+
puts "Does this look correct?"
|
|
32
|
+
return unless Pkg::Util.ask_yes_or_no
|
|
33
|
+
Rake::Task["pl:jenkins:uber_build"].invoke(args.poll_interval)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# This is an optional pre-tar-task, so we only want to present it if we're
|
|
2
|
+
# using it
|
|
3
|
+
if Pkg::Config.pre_tar_task
|
|
4
|
+
namespace :package do
|
|
5
|
+
desc "vendor gems required by project"
|
|
6
|
+
task :vendor_gems do
|
|
7
|
+
Pkg::Util::Tool.check_tool("bundle")
|
|
8
|
+
require 'bundler'
|
|
9
|
+
|
|
10
|
+
class UI
|
|
11
|
+
LEVELS = %w(silent error warn confirm info debug)
|
|
12
|
+
|
|
13
|
+
def warn(message, newline = nil)
|
|
14
|
+
puts message
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def debug(message, newline = nil)
|
|
18
|
+
puts message
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def trace(message, newline = nil)
|
|
22
|
+
puts message
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def error(message, newline = nil)
|
|
26
|
+
puts message
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def info(message, newline = nil)
|
|
30
|
+
puts message
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def confirm(message, newline = nil)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def debug?
|
|
37
|
+
true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def ask(message)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def quiet?
|
|
44
|
+
false
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def level=(level)
|
|
48
|
+
raise ArgumentError unless LEVELS.include?(level.to_s)
|
|
49
|
+
@level = level
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def level(name = nil)
|
|
53
|
+
name ? LEVELS.index(name) <= LEVELS.index(@level) : @level
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def silence
|
|
57
|
+
old_level, @level = @level, "silent"
|
|
58
|
+
yield
|
|
59
|
+
ensure
|
|
60
|
+
@level = old_level
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
class RGProxy < ::Gem::SilentUI
|
|
66
|
+
def initialize(ui)
|
|
67
|
+
@ui = ui
|
|
68
|
+
super()
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def say(message)
|
|
72
|
+
if message =~ /native extensions/
|
|
73
|
+
@ui.info "with native extensions "
|
|
74
|
+
else
|
|
75
|
+
@ui.debug(message)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# Cache all the gems locally without using the shared GEM_PATH
|
|
82
|
+
Bundler.settings[:cache_all] = true
|
|
83
|
+
Bundler.settings[:local] = true
|
|
84
|
+
Bundler.settings[:disable_shared_gems] = true
|
|
85
|
+
# Make sure we cache all the gems, despite what the local config file says...
|
|
86
|
+
Bundler.settings.without = []
|
|
87
|
+
|
|
88
|
+
# Stupid bundler requires this because it's not abstracted out into a library that doesn't need IO
|
|
89
|
+
Bundler.ui = UI.new
|
|
90
|
+
Bundler.rubygems.ui = ::RGProxy.new(Bundler.ui)
|
|
91
|
+
Bundler.ui.level = "debug"
|
|
92
|
+
|
|
93
|
+
# Load the the Gemfile and resolve gems using RubyGems.org
|
|
94
|
+
definition = Bundler.definition
|
|
95
|
+
definition.validate_ruby!
|
|
96
|
+
definition.resolve_remotely!
|
|
97
|
+
|
|
98
|
+
mkdir_p Bundler.app_cache
|
|
99
|
+
|
|
100
|
+
# Cache the gems
|
|
101
|
+
definition.specs.each do |spec|
|
|
102
|
+
# Fetch Rubygem specs
|
|
103
|
+
if spec.source.respond_to?(:fetch_gem, true)
|
|
104
|
+
spec.source.send(:fetch_gem, spec) if spec.source.is_a?(Bundler::Source::Rubygems)
|
|
105
|
+
elsif Bundler::Fetcher.respond_to?(:fetch, true)
|
|
106
|
+
# Retain this call in case we are dealing with an older version of bundler.
|
|
107
|
+
Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems)
|
|
108
|
+
else
|
|
109
|
+
# shrug
|
|
110
|
+
fail "Cannot find a way to download the gem for caching! Did the `fetch_gem` method move?"
|
|
111
|
+
end
|
|
112
|
+
# Cache everything but bundler itself...
|
|
113
|
+
spec.source.cache(spec) unless spec.name == "bundler"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
data/tasks/version.rake
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This is something of a work in progress. Unfortunately,
|
|
2
|
+
# many of the projects that use the packaging repo carry
|
|
3
|
+
# version files with hard-coded versions, and many of these
|
|
4
|
+
# are in completely disparate formats.
|
|
5
|
+
#
|
|
6
|
+
# This task attempts to automate the updating of this file
|
|
7
|
+
# with the version to be packaged, but given the many version
|
|
8
|
+
# file formats in use, doing so cleanly is difficult. With
|
|
9
|
+
# any luck, going forward some of these projects will move
|
|
10
|
+
# away from maintaining hard-coded versions in source.
|
|
11
|
+
# However, if this effort loses momentum, we may end up
|
|
12
|
+
# revisiting this task and improving it substantially,
|
|
13
|
+
# and/or standardizing the expected version file format.
|
|
14
|
+
namespace :package do
|
|
15
|
+
desc "Set and commit the version in #{Pkg::Config.version_file}, requires VERSION."
|
|
16
|
+
task :versionset do
|
|
17
|
+
Pkg::Util.check_var('VERSION', ENV['VERSION'])
|
|
18
|
+
Pkg::Util::Version.versionbump
|
|
19
|
+
Pkg::Util::Git.commit_file(Pkg::Config.version_file, "update to #{ENV['VERSION']}")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
task :versionbump, :workdir do |t, args|
|
|
23
|
+
Pkg::Util::Version.versionbump(args.workdir)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# A set of tasks for printing the version
|
|
27
|
+
[:version, :rpmversion, :rpmrelease, :debversion, :release].each do |task|
|
|
28
|
+
task "#{task}" do
|
|
29
|
+
$stdout.puts Pkg::Config.instance_variable_get("@#{task}")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
##
|
|
2
|
+
# These tasks are just wrappers for the build objects capabilities, exposed
|
|
3
|
+
# for our debugging purposes. This file is prepended with `z_` to ensure it is
|
|
4
|
+
# loaded last, so that any variable manipulations that occur in the rake tasks
|
|
5
|
+
# happen prior to printing (although ideally all variables have been set after
|
|
6
|
+
# loading `20_setupextrasvars.rake`).
|
|
7
|
+
#
|
|
8
|
+
namespace :pl do
|
|
9
|
+
##
|
|
10
|
+
# Utility rake task that will dump all current build parameters and variables
|
|
11
|
+
# to a yaml file to a temporary location and print the path. Given the
|
|
12
|
+
# environment variable 'OUTPUT_DIR', output file at 'OUTPUT_DIR'. The
|
|
13
|
+
# environment variable TASK sets the task instance variable of the build to the
|
|
14
|
+
# supplied args, allowing us to use this file for later builds.
|
|
15
|
+
#
|
|
16
|
+
desc "Write all package build parameters to a yaml file, pass OUTPUT_DIR to specify outut location"
|
|
17
|
+
task :write_build_params do
|
|
18
|
+
if ENV['TASK']
|
|
19
|
+
task_args = ENV['TASK'].split(' ')
|
|
20
|
+
Pkg::Config.task = { :task => task_args[0], :args => task_args[1..-1] }
|
|
21
|
+
end
|
|
22
|
+
Pkg::Config.config_to_yaml(ENV['OUTPUT_DIR'])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Print all build parameters to $stdout.
|
|
27
|
+
#
|
|
28
|
+
desc "Print all package build parameters"
|
|
29
|
+
task :print_build_params do
|
|
30
|
+
Pkg::Config.print_config
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Print a parameter passed as an argument to $stdout.
|
|
35
|
+
desc "Print a build parameter"
|
|
36
|
+
task :print_build_param, :param do |t, args|
|
|
37
|
+
# We want a string that is the from "@<param name>"
|
|
38
|
+
if param = args.param
|
|
39
|
+
getter = param.dup
|
|
40
|
+
if param[0] == ':'
|
|
41
|
+
getter = param[1..-1]
|
|
42
|
+
param[0] = "@"
|
|
43
|
+
elsif param[0] == "@"
|
|
44
|
+
getter = param[1..-1]
|
|
45
|
+
else
|
|
46
|
+
param.insert(0, "@")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# We want to fail if the param passed is bogus, print 'nil' if its not
|
|
50
|
+
# set, and print the value if its set.
|
|
51
|
+
if Pkg::Config.respond_to?(getter)
|
|
52
|
+
if val = Pkg::Config.instance_variable_get(param)
|
|
53
|
+
puts val
|
|
54
|
+
else
|
|
55
|
+
puts 'nil'
|
|
56
|
+
end
|
|
57
|
+
else
|
|
58
|
+
fail "Could not locate a build parameter called #{param}. For a list of available parameters, do `rake pl:print_build_params`"
|
|
59
|
+
end
|
|
60
|
+
else
|
|
61
|
+
fail "To print a build parameter, pass the param name as a rake argument. Ex: rake pl:print_build_param[:version]"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|