2014-10-15 15:00:26 +01:00
|
|
|
# TODO share code with thunderbird-bin/generate_sources.rb
|
|
|
|
|
|
|
|
require "open-uri"
|
2014-10-12 14:57:43 +01:00
|
|
|
|
|
|
|
version = if ARGV.empty?
|
|
|
|
"latest"
|
|
|
|
else
|
|
|
|
ARGV[0]
|
|
|
|
end
|
|
|
|
|
2014-10-15 15:00:26 +01:00
|
|
|
base_path = "http://download-installer.cdn.mozilla.net/pub/firefox/releases"
|
2014-10-12 14:57:43 +01:00
|
|
|
|
2014-10-15 15:00:26 +01:00
|
|
|
Source = Struct.new(:hash, :arch, :locale, :filename)
|
2014-10-12 14:57:43 +01:00
|
|
|
|
2014-10-15 15:00:26 +01:00
|
|
|
sources = open("#{base_path}/#{version}/SHA1SUMS") 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]
|
2014-10-12 14:57:43 +01:00
|
|
|
end
|
|
|
|
|
2014-10-15 15:00:26 +01:00
|
|
|
real_version = sources[0].filename.match(/firefox-([0-9.]*)\.tar\.bz2/)[1]
|
2014-10-12 14:57:43 +01:00
|
|
|
|
2014-10-15 15:00:26 +01:00
|
|
|
arches = ["linux-i686", "linux-x86_64"]
|
2014-10-12 14:57:43 +01:00
|
|
|
|
|
|
|
puts(<<"EOH")
|
2014-10-15 15:00:26 +01:00
|
|
|
# This file is generated from generate_nix.rb. DO NOT EDIT.
|
2014-10-12 14:57:43 +01:00
|
|
|
# Execute the following command in a temporary directory to update the file.
|
|
|
|
#
|
2014-10-15 15:00:26 +01:00
|
|
|
# ruby generate_source.rb > source.nix
|
2014-10-12 14:57:43 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
version = "#{real_version}";
|
|
|
|
sources = [
|
|
|
|
EOH
|
|
|
|
|
2014-10-15 15:00:26 +01:00
|
|
|
sources.each do |source|
|
|
|
|
puts(%Q| { locale = "#{source.locale}"; arch = "#{source.arch}"; sha1 = "#{source.hash}"; }|)
|
2014-10-12 14:57:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
puts(<<'EOF')
|
|
|
|
];
|
|
|
|
}
|
|
|
|
EOF
|