Skip to content

Commit

Permalink
thunderbird-bin: 38.3.0 -> 38.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
taku0 committed Nov 28, 2015
1 parent 8cd52ce commit 50a842f
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ stdenv.mkDerivation {

src = fetchurl {
url = "http://download-installer.cdn.mozilla.net/pub/thunderbird/releases/${version}/${source.arch}/${source.locale}/thunderbird-${version}.tar.bz2";
inherit (source) sha1;
inherit (source) sha256;
};

phases = "unpackPhase installPhase";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,61 @@
require "open-uri"

version = if ARGV.empty?
"latest"
else
ARGV[0]
end

base_path = "http://archive.mozilla.org/pub/thunderbird/releases"
base_path = "archive.mozilla.org/pub/thunderbird/releases"

Source = Struct.new(:hash, :arch, :locale, :filename)
arches = ["linux-i686", "linux-x86_64"]

sources = open("#{base_path}/#{version}/SHA1SUMS") do |input|
input.readlines
end.select do |line|
/\/thunderbird-.*\.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]
arches.each do |arch|
system("wget", "--recursive", "--continue", "--no-parent", "--reject-regex", ".*\\?.*", "--reject", "xpi", "http://#{base_path}/#{version}/#{arch}/")
end

real_version = sources[0].filename.match(/thunderbird-([0-9.]*)\.tar\.bz2/)[1]
locales = Dir.glob("#{base_path}/#{version}/#{arches[0]}/*").map do |path|
File.basename(path)
end.sort

locales.delete("index.html")
locales.delete("xpi")

# real version number, e.g. "30.0" instead of "latest".
real_version = Dir.glob("#{base_path}/#{version}/#{arches[0]}/#{locales[0]}/thunderbird-*")[0].match(/thunderbird-([0-9.]*)/)[1][0..-2]

locale_arch_path_tuples = locales.flat_map do |locale|
arches.map do |arch|
path = Dir.glob("#{base_path}/#{version}/#{arch}/#{locale}/thunderbird-*")[0]

[locale, arch, path]
end
end

paths = locale_arch_path_tuples.map do |tuple| tuple[2] end

hashes = IO.popen(["sha256sum", "--binary", *paths]) do |input|
input.each_line.map do |line|
$stderr.puts(line)

line.match(/^[0-9a-f]*/)[0]
end
end

arches = ["linux-i686", "linux-x86_64"]

puts(<<"EOH")
# This file is generated from generate_nix.rb. DO NOT EDIT.
# This file is generated from generate_sources.rb. DO NOT EDIT.
# Execute the following command in a temporary directory to update the file.
#
# ruby generate_source.rb > source.nix
# ruby generate_sources.rb > sources.nix
{
version = "#{real_version}";
sources = [
EOH

sources.each do |source|
puts(%Q| { locale = "#{source.locale}"; arch = "#{source.arch}"; sha1 = "#{source.hash}"; }|)
locale_arch_path_tuples.zip(hashes) do |tuple, hash|
locale, arch, path = tuple

puts(%Q| { locale = "#{locale}"; arch = "#{arch}"; sha256 = "#{hash}"; }|)
end

puts(<<'EOF')
Expand Down
Loading

0 comments on commit 50a842f

Please sign in to comment.