From 31522e13c74ee15b2cc0b20475009cff672f1ad1 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Wed, 3 Dec 2014 05:41:51 +0100 Subject: [PATCH] icedtea: Simplify update script --- pkgs/development/compilers/icedtea/update.py | 33 ++++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/pkgs/development/compilers/icedtea/update.py b/pkgs/development/compilers/icedtea/update.py index 69cf0906bce..c41cf3d38d2 100755 --- a/pkgs/development/compilers/icedtea/update.py +++ b/pkgs/development/compilers/icedtea/update.py @@ -3,7 +3,7 @@ import subprocess, urllib.request, re, os, tarfile from html.parser import HTMLParser -HG_URL = 'http://icedtea.classpath.org/hg/release/icedtea{}-forest-{}' +URL = 'http://icedtea.classpath.org/download/drops/icedtea{}/{}' DOWNLOAD_URL = 'http://icedtea.wildebeest.org/download/source/' DOWNLOAD_HTML = DOWNLOAD_URL + '?C=M;O=D' @@ -89,7 +89,7 @@ def get_old_bundle_attrs(jdk, bundle): def get_old_attrs(jdk): attrs = {} - for attr in ('branch', 'version', 'url', 'sha256'): + for attr in ('version', 'url', 'sha256'): attrs[attr] = get_jdk_attr(jdk, attr) attrs['bundles'] = {} @@ -128,8 +128,8 @@ def get_new_bundle_attr(makefile, bundle, attr): return m.group(1) -def get_new_bundle_attrs(jdk, version, branch, path): - hg_url = HG_URL.format(jdk, branch) +def get_new_bundle_attrs(jdk, version, path): + url = URL.format(jdk, version) attrs = {} @@ -139,14 +139,16 @@ def get_new_bundle_attrs(jdk, version, branch, path): makefile = get_member_file(tar, 'Makefile.am') hotspot_map = get_member_file(tar, 'hotspot.map.in') + hotspot_map = hotspot_map.replace('@ICEDTEA_RELEASE@', version) + for bundle in BUNDLES: battrs = {} - battrs['url'] = 'http://icedtea.wildebeest.org/download/drops/icedtea{}/{}/{}.tar.bz2'.format(jdk, version, bundle) + battrs['url'] = '{}/{}.tar.bz2'.format(url, bundle) if bundle == 'hotspot': m = re.search(r'^default (.*?) (.*?) (.*?) (.*?)$', hotspot_map, re.MULTILINE) if m == None: - raise Exception('Could not find info for hotspot bundle in hotspot.map.in') + raise Exception('Could not find info for hotspot bundle in hotspot.map.in') battrs['sha256'] = m.group(4) else: @@ -182,7 +184,6 @@ def get_new_attrs(jdk): print('Update available, generating new attributes for JDK {}...'.format(jdk)) attrs['version'] = version - attrs['branch'] = '.'.join(version.split('.')[:2]) attrs['url'] = url print('Downloading tarball from url "{}"...'.format(url)) @@ -192,7 +193,7 @@ def get_new_attrs(jdk): print('Inspecting tarball for bundle information...') - attrs['bundles'] = get_new_bundle_attrs(jdk, attrs['version'], attrs['branch'], path) + attrs['bundles'] = get_new_bundle_attrs(jdk, attrs['version'], path) print('Done!') @@ -201,21 +202,19 @@ def get_new_attrs(jdk): def generate_jdk(jdk): attrs = get_new_attrs(jdk) - branch = attrs['branch'] - src_version = attrs['version'].replace(branch, '${branch}') - src_url = attrs['url'].replace(attrs['version'], '${version}') + version = attrs['version'] + src_url = attrs['url'].replace(version, '${version}') - hg_url = HG_URL.format(jdk, branch) - src_hg_url = HG_URL.format(jdk, '${branch}') + common_url = URL.format(jdk, version) + src_common_url = URL.format(jdk, '${version}') src = ' icedtea{} = rec {{\n'.format(jdk) - src += ' branch = "{}";\n'.format(branch) - src += ' version = "{}";\n'.format(src_version) + src += ' version = "{}";\n'.format(version) src += '\n' src += ' url = "{}";\n'.format(src_url) src += ' sha256 = "{}";\n'.format(attrs['sha256']) src += '\n' - src += ' hg_url = "{}";\n'.format(src_hg_url) + src += ' common_url = "{}";\n'.format(src_common_url) src += '\n' src += ' bundles = {\n' @@ -223,7 +222,7 @@ def generate_jdk(jdk): battrs = attrs['bundles'][bundle] b_url = battrs['url'] - b_url = b_url.replace(hg_url, '${hg_url}') + b_url = b_url.replace(common_url, '${common_url}') src += ' {} = rec {{\n'.format(bundle) src += ' url = "{}";\n'.format(b_url)