Add --bzip2 option to create-packages.rb to use bzip2 compression instead of deflate when creating the .zip packages

This results in smaller packages but the package creation will be slower
and the system 'zip' tool must support bzip2 compression.
This commit is contained in:
Robert Knight 2011-09-05 16:33:28 +01:00
parent c3dee80640
commit 38bb0e8787

View file

@ -272,6 +272,7 @@ end
updater_binary_input_path = nil
target_version = nil
target_platform = nil
zip_flags = nil
OptionParser.new do |parser|
parser.banner = "#{$0} [options] <input dir> <config file> <output dir>"
@ -284,6 +285,9 @@ OptionParser.new do |parser|
parser.on("-p","--platform [platform]","Specifies the target platform for this update") do |platform|
target_platform = platform
end
parser.on(nil,"--bzip2","Use bzip2 compression (requires that 'zip' supports the -Z bz2 argument)") do
zip_flags = "-Z bzip2"
end
end.parse!
raise "Platform not specified (use -p option)" if !target_platform
@ -365,7 +369,7 @@ package_file_map.each do |package,files|
File.unlink(output_file) if File.exist?(output_file)
Dir.chdir(input_dir) do
if (!system("zip #{output_file} #{quoted_file_list}"))
if (!system("zip #{zip_flags} #{output_file} #{quoted_file_list}"))
raise "Failed to generate package #{package}"
else
puts "Generated package #{package} : #{file_sha1(output_file)}"