Merge pull request #18802 from chris-martin/libreoffice-sha256

libreoffice: md5 -> sha256
This commit is contained in:
Michael Raskin 2016-09-21 05:47:32 +00:00 committed by GitHub
commit 9a1cd1e811
5 changed files with 1106 additions and 1088 deletions

View file

@ -28,25 +28,17 @@ let
lib = stdenv.lib;
langsSpaces = lib.concatStringsSep " " langs;
fetchThirdParty = {name, md5, brief, subDir ? ""}: fetchurl {
inherit name md5;
url = if brief then
"http://dev-www.libreoffice.org/src/${subDir}${name}"
else
"http://dev-www.libreoffice.org/src/${subDir}${md5}-${name}";
};
fetchSrc = {name, sha256}: fetchurl {
url = "http://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${name}-${version}.tar.xz";
inherit sha256;
};
srcs = {
third_party = [ (fetchurl rec {
third_party = [ (let md5 = "185d60944ea767075d27247c3162b3bc"; in fetchurl rec {
url = "http://dev-www.libreoffice.org/extern/${md5}-${name}";
md5 = "185d60944ea767075d27247c3162b3bc";
sha256 = "1infwvv1p6i21scywrldsxs22f62x85mns4iq8h6vr6vlx3fdzga";
name = "unowinreg.dll";
}) ] ++ (map fetchThirdParty (import ./libreoffice-srcs.nix));
}) ] ++ (map fetchurl (import ./libreoffice-srcs.nix));
translations = fetchSrc {
name = "translations";

View file

@ -8,28 +8,64 @@ of the input file, and writes the result to stdout.
todo - Ideally we would move as much as possible into derivation dependencies.
"""
import collections, itertools, json, re, sys, os
import collections, itertools, json, re, subprocess, sys, os
def main():
packages = list(get_packages())
for x in packages:
print(x, file=sys.stderr)
print('[')
for x in get_packages():
for x in packages:
print('{')
md5 = x['md5']
tarball = x['tarball']
print(' name = "{}";'.format(x['tarball']))
print(' md5 = "{}";'.format(x['md5']))
print(' brief = {};'.format('true' if x['brief'] else 'false'))
url = construct_url(x)
print('url: {}'.format(url), file=sys.stderr)
if 'subdir' in x:
print(' subDir = "{}";'.format(x['subdir']))
path = download(url, tarball, md5)
print('path: {}'.format(path), file=sys.stderr)
print('}')
sha256 = get_sha256(path)
print('sha256: {}'.format(sha256), file=sys.stderr)
print(' {')
print(' name = "{}";'.format(tarball))
print(' url = "{}";'.format(url))
print(' sha256 = "{}";'.format(sha256))
print(' }')
print(']')
def construct_url(x):
if x['brief']:
return 'http://dev-www.libreoffice.org/src/{}{}'.format(
x.get('subdir', ''), x['tarball'])
else:
return 'http://dev-www.libreoffice.org/src/{}{}-{}'.format(
x.get('subdir', ''), x['md5'], x['tarball'])
def download(url, name, md5):
cmd = ['nix-prefetch-url', url, md5, '--print-path',
'--type', 'md5', '--name', name]
proc = subprocess.run(cmd, stdout=subprocess.PIPE, check=True,
universal_newlines=True)
return proc.stdout.split('\n')[1].strip()
def get_sha256(path):
cmd = ['sha256sum', path]
proc = subprocess.run(cmd, stdout=subprocess.PIPE, check=True,
universal_newlines=True)
return proc.stdout.split(' ')[0].strip()
def get_packages():
"""
All of the package data: What's parsed from download.lst,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -28,25 +28,17 @@ let
lib = stdenv.lib;
langsSpaces = lib.concatStringsSep " " langs;
fetchThirdParty = {name, md5, brief, subDir ? ""}: fetchurl {
inherit name md5;
url = if brief then
"http://dev-www.libreoffice.org/src/${subDir}${name}"
else
"http://dev-www.libreoffice.org/src/${subDir}${md5}-${name}";
};
fetchSrc = {name, sha256}: fetchurl {
url = "http://download.documentfoundation.org/libreoffice/src/${subdir}/libreoffice-${name}-${version}.tar.xz";
inherit sha256;
};
srcs = {
third_party = [ (fetchurl rec {
third_party = [ (let md5 = "185d60944ea767075d27247c3162b3bc"; in fetchurl rec {
url = "http://dev-www.libreoffice.org/extern/${md5}-${name}";
md5 = "185d60944ea767075d27247c3162b3bc";
sha256 = "1infwvv1p6i21scywrldsxs22f62x85mns4iq8h6vr6vlx3fdzga";
name = "unowinreg.dll";
}) ] ++ (map fetchThirdParty (import ./libreoffice-srcs-still.nix));
}) ] ++ (map fetchurl (import ./libreoffice-srcs-still.nix));
translations = fetchSrc {
name = "translations";