2016-05-04 02:29:45 +02:00
|
|
|
# TODO share code with thunderbird-bin/generate_sources.rb
|
2014-10-12 15:57:43 +02:00
|
|
|
|
2016-05-04 02:29:45 +02:00
|
|
|
require "open-uri"
|
2014-10-12 15:57:43 +02:00
|
|
|
|
2016-05-04 02:29:45 +02:00
|
|
|
version =
|
|
|
|
if ARGV.empty?
|
|
|
|
$stderr.puts("Usage: ruby generate_sources.rb <version> > sources.nix")
|
|
|
|
exit(-1)
|
|
|
|
else
|
|
|
|
ARGV[0]
|
2015-11-04 13:29:25 +01:00
|
|
|
end
|
|
|
|
|
2016-07-16 13:04:04 +02:00
|
|
|
base_path = "http://download-installer.cdn.mozilla.net/pub/firefox/releases"
|
2015-11-04 13:29:25 +01:00
|
|
|
|
2016-05-04 02:29:45 +02:00
|
|
|
Source = Struct.new(:hash, :arch, :locale, :filename)
|
2015-11-04 13:29:25 +01:00
|
|
|
|
2016-05-04 02:29:45 +02:00
|
|
|
sources = open("#{base_path}/#{version}/SHA512SUMS") do |input|
|
|
|
|
input.readlines
|
|
|
|
end.select do |line|
|
|
|
|
/\/firefox-.*\.tar\.bz2$/ === line && !(/source/ === line)
|
|
|
|
end.map do |line|
|
|
|
|
hash, name = line.chomp.split(/ +/)
|
|
|
|
Source.new(hash, *(name.split("/")))
|
|
|
|
end.sort_by do |source|
|
|
|
|
[source.locale, source.arch]
|
2015-11-04 13:29:25 +01:00
|
|
|
end
|
2014-10-12 15:57:43 +02:00
|
|
|
|
2016-05-04 02:29:45 +02:00
|
|
|
arches = ["linux-i686", "linux-x86_64"]
|
2014-10-12 15:57:43 +02:00
|
|
|
|
|
|
|
puts(<<"EOH")
|
2015-11-04 13:29:25 +01:00
|
|
|
# This file is generated from generate_sources.rb. DO NOT EDIT.
|
2016-05-04 02:29:45 +02:00
|
|
|
# Execute the following command to update the file.
|
2014-10-12 15:57:43 +02:00
|
|
|
#
|
2016-05-04 02:29:45 +02:00
|
|
|
# ruby generate_sources.rb 46.0.1 > sources.nix
|
2014-10-12 15:57:43 +02:00
|
|
|
|
|
|
|
{
|
2016-05-04 02:29:45 +02:00
|
|
|
version = "#{version}";
|
2014-10-12 15:57:43 +02:00
|
|
|
sources = [
|
|
|
|
EOH
|
|
|
|
|
2016-05-04 02:29:45 +02:00
|
|
|
sources.each do |source|
|
2016-07-16 13:04:04 +02:00
|
|
|
puts(%Q| { url = "#{base_path}/#{version}/#{source.arch}/#{source.locale}/firefox-#{version}.tar.bz2"; locale = "#{source.locale}"; arch = "#{source.arch}"; sha512 = "#{source.hash}"; }|)
|
2014-10-12 15:57:43 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
puts(<<'EOF')
|
|
|
|
];
|
|
|
|
}
|
|
|
|
EOF
|