icedtea: Simplify update script
This commit is contained in:
parent
d2488119cc
commit
31522e13c7
@ -3,7 +3,7 @@
|
|||||||
import subprocess, urllib.request, re, os, tarfile
|
import subprocess, urllib.request, re, os, tarfile
|
||||||
from html.parser import HTMLParser
|
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_URL = 'http://icedtea.wildebeest.org/download/source/'
|
||||||
DOWNLOAD_HTML = DOWNLOAD_URL + '?C=M;O=D'
|
DOWNLOAD_HTML = DOWNLOAD_URL + '?C=M;O=D'
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ def get_old_bundle_attrs(jdk, bundle):
|
|||||||
def get_old_attrs(jdk):
|
def get_old_attrs(jdk):
|
||||||
attrs = {}
|
attrs = {}
|
||||||
|
|
||||||
for attr in ('branch', 'version', 'url', 'sha256'):
|
for attr in ('version', 'url', 'sha256'):
|
||||||
attrs[attr] = get_jdk_attr(jdk, attr)
|
attrs[attr] = get_jdk_attr(jdk, attr)
|
||||||
|
|
||||||
attrs['bundles'] = {}
|
attrs['bundles'] = {}
|
||||||
@ -128,8 +128,8 @@ def get_new_bundle_attr(makefile, bundle, attr):
|
|||||||
|
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
|
|
||||||
def get_new_bundle_attrs(jdk, version, branch, path):
|
def get_new_bundle_attrs(jdk, version, path):
|
||||||
hg_url = HG_URL.format(jdk, branch)
|
url = URL.format(jdk, version)
|
||||||
|
|
||||||
attrs = {}
|
attrs = {}
|
||||||
|
|
||||||
@ -139,14 +139,16 @@ def get_new_bundle_attrs(jdk, version, branch, path):
|
|||||||
makefile = get_member_file(tar, 'Makefile.am')
|
makefile = get_member_file(tar, 'Makefile.am')
|
||||||
hotspot_map = get_member_file(tar, 'hotspot.map.in')
|
hotspot_map = get_member_file(tar, 'hotspot.map.in')
|
||||||
|
|
||||||
|
hotspot_map = hotspot_map.replace('@ICEDTEA_RELEASE@', version)
|
||||||
|
|
||||||
for bundle in BUNDLES:
|
for bundle in BUNDLES:
|
||||||
battrs = {}
|
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':
|
if bundle == 'hotspot':
|
||||||
m = re.search(r'^default (.*?) (.*?) (.*?) (.*?)$', hotspot_map, re.MULTILINE)
|
m = re.search(r'^default (.*?) (.*?) (.*?) (.*?)$', hotspot_map, re.MULTILINE)
|
||||||
if m == None:
|
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)
|
battrs['sha256'] = m.group(4)
|
||||||
else:
|
else:
|
||||||
@ -182,7 +184,6 @@ def get_new_attrs(jdk):
|
|||||||
print('Update available, generating new attributes for JDK {}...'.format(jdk))
|
print('Update available, generating new attributes for JDK {}...'.format(jdk))
|
||||||
|
|
||||||
attrs['version'] = version
|
attrs['version'] = version
|
||||||
attrs['branch'] = '.'.join(version.split('.')[:2])
|
|
||||||
attrs['url'] = url
|
attrs['url'] = url
|
||||||
|
|
||||||
print('Downloading tarball from url "{}"...'.format(url))
|
print('Downloading tarball from url "{}"...'.format(url))
|
||||||
@ -192,7 +193,7 @@ def get_new_attrs(jdk):
|
|||||||
|
|
||||||
print('Inspecting tarball for bundle information...')
|
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!')
|
print('Done!')
|
||||||
|
|
||||||
@ -201,21 +202,19 @@ def get_new_attrs(jdk):
|
|||||||
def generate_jdk(jdk):
|
def generate_jdk(jdk):
|
||||||
attrs = get_new_attrs(jdk)
|
attrs = get_new_attrs(jdk)
|
||||||
|
|
||||||
branch = attrs['branch']
|
version = attrs['version']
|
||||||
src_version = attrs['version'].replace(branch, '${branch}')
|
src_url = attrs['url'].replace(version, '${version}')
|
||||||
src_url = attrs['url'].replace(attrs['version'], '${version}')
|
|
||||||
|
|
||||||
hg_url = HG_URL.format(jdk, branch)
|
common_url = URL.format(jdk, version)
|
||||||
src_hg_url = HG_URL.format(jdk, '${branch}')
|
src_common_url = URL.format(jdk, '${version}')
|
||||||
|
|
||||||
src = ' icedtea{} = rec {{\n'.format(jdk)
|
src = ' icedtea{} = rec {{\n'.format(jdk)
|
||||||
src += ' branch = "{}";\n'.format(branch)
|
src += ' version = "{}";\n'.format(version)
|
||||||
src += ' version = "{}";\n'.format(src_version)
|
|
||||||
src += '\n'
|
src += '\n'
|
||||||
src += ' url = "{}";\n'.format(src_url)
|
src += ' url = "{}";\n'.format(src_url)
|
||||||
src += ' sha256 = "{}";\n'.format(attrs['sha256'])
|
src += ' sha256 = "{}";\n'.format(attrs['sha256'])
|
||||||
src += '\n'
|
src += '\n'
|
||||||
src += ' hg_url = "{}";\n'.format(src_hg_url)
|
src += ' common_url = "{}";\n'.format(src_common_url)
|
||||||
src += '\n'
|
src += '\n'
|
||||||
src += ' bundles = {\n'
|
src += ' bundles = {\n'
|
||||||
|
|
||||||
@ -223,7 +222,7 @@ def generate_jdk(jdk):
|
|||||||
battrs = attrs['bundles'][bundle]
|
battrs = attrs['bundles'][bundle]
|
||||||
|
|
||||||
b_url = battrs['url']
|
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 += ' {} = rec {{\n'.format(bundle)
|
||||||
src += ' url = "{}";\n'.format(b_url)
|
src += ' url = "{}";\n'.format(b_url)
|
||||||
|
Loading…
Reference in New Issue
Block a user