From b39eb2c4b4576855c3d2416e67fa84206ae51bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20W=C3=B6gerer?= Date: Thu, 17 Mar 2016 10:29:50 +0100 Subject: [PATCH 1/4] Fix results argument for NativeTARDistribution --- mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.py b/mx.py index 90c2121e..53c92c8c 100755 --- a/mx.py +++ b/mx.py @@ -5745,7 +5745,7 @@ def _load_projects(self): native = attrs.pop('native', False) if native: output = attrs.pop('output', None) - results = Suite._pop_list(attrs, 'output', context) + results = Suite._pop_list(attrs, 'results', context) p = NativeProject(self, name, subDir, srcDirs, deps, workingSets, results, output, d, theLicense=theLicense) else: javaCompliance = attrs.pop('javaCompliance', None) From acca667f7705075827cf4b1400123e26d047df67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20W=C3=B6gerer?= Date: Wed, 16 Mar 2016 15:58:52 +0100 Subject: [PATCH 2/4] Provide optional NativeTARDistribution subdirs --- mx.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mx.py b/mx.py index 53c92c8c..3f683b0e 100755 --- a/mx.py +++ b/mx.py @@ -1096,9 +1096,10 @@ def cleanForbidden(self): path: suite-local path to where the tar file will be placed """ class NativeTARDistribution(Distribution): - def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, theLicense): + def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, theLicense, relpath): Distribution.__init__(self, suite, name, deps, excludedLibs, platformDependent, theLicense) self.path = _make_absolute(path, suite.dir) + self.relpath = relpath def make_archive(self): directory = dirname(self.path) @@ -1108,8 +1109,13 @@ def make_archive(self): for d in self.archived_deps(): if not d.isNativeProject(): abort('Unsupported dependency for native distribution {}: {}'.format(self.name, d.name)) + output = d.getOutput() + output = join(self.suite.dir, output) if output else None for r in d.getResults(): - filename = basename(r) + if output and self.relpath: + filename = os.path.relpath(r, output) + else: + filename = basename(r) assert filename not in files, filename # Make debug-info files optional for distribution if is_debug_lib_file(r) and not os.path.exists(r): @@ -5304,7 +5310,8 @@ def _load_distribution(self, name, attrs): platformDependent = bool(os_arch) if native: path = attrs.pop('path') - d = NativeTARDistribution(self, name, deps, path, exclLibs, platformDependent, theLicense) + relpath = attrs.pop('relpath', False) + d = NativeTARDistribution(self, name, deps, path, exclLibs, platformDependent, theLicense, relpath) else: defaultPath = join(self.get_output_root(), 'dists', _map_to_maven_dist_name(name) + '.jar') defaultSourcesPath = join(self.get_output_root(), 'dists', _map_to_maven_dist_name(name) + '.src.zip') @@ -12877,7 +12884,7 @@ def alarm_handler(signum, frame): # no need to show the stack trace when the user presses CTRL-C abort(1) -version = VersionSpec("5.14.0") +version = VersionSpec("5.14.1") currentUmask = None From d7c93d092fe2632dc8debb252cf9d622474bf04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20W=C3=B6gerer?= Date: Wed, 16 Mar 2016 17:44:41 +0100 Subject: [PATCH 3/4] Provide optional NativeTARDistribution extraction --- mx.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mx.py b/mx.py index 3f683b0e..1ba6d584 100755 --- a/mx.py +++ b/mx.py @@ -1096,10 +1096,11 @@ def cleanForbidden(self): path: suite-local path to where the tar file will be placed """ class NativeTARDistribution(Distribution): - def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, theLicense, relpath): + def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, theLicense, relpath, output): Distribution.__init__(self, suite, name, deps, excludedLibs, platformDependent, theLicense) self.path = _make_absolute(path, suite.dir) self.relpath = relpath + self.output = output def make_archive(self): directory = dirname(self.path) @@ -1140,9 +1141,17 @@ def localExtension(self): def postPull(self, f): assert f.endswith('.gz') logv('Uncompressing {}...'.format(f)) + tarfilename = None with gzip.open(f, 'rb') as gz, open(f[:-len('.gz')], 'wb') as tar: shutil.copyfileobj(gz, tar) + tarfilename = tar.name os.remove(f) + if self.output: + output = join(self.suite.dir, self.output) + assert tarfilename + with tarfile.open(tarfilename, 'r:') as tar: + log('Extract {} to {}'.format(tarfilename, output)) + tar.extractall(output) def prePush(self, f): tgz = f + '.gz' @@ -5311,7 +5320,8 @@ def _load_distribution(self, name, attrs): if native: path = attrs.pop('path') relpath = attrs.pop('relpath', False) - d = NativeTARDistribution(self, name, deps, path, exclLibs, platformDependent, theLicense, relpath) + output = attrs.pop('output', None) + d = NativeTARDistribution(self, name, deps, path, exclLibs, platformDependent, theLicense, relpath, output) else: defaultPath = join(self.get_output_root(), 'dists', _map_to_maven_dist_name(name) + '.jar') defaultSourcesPath = join(self.get_output_root(), 'dists', _map_to_maven_dist_name(name) + '.src.zip') @@ -12884,7 +12894,7 @@ def alarm_handler(signum, frame): # no need to show the stack trace when the user presses CTRL-C abort(1) -version = VersionSpec("5.14.1") +version = VersionSpec("5.14.2") currentUmask = None From 6a5dd660d8509a007b90fdf99e7ff1f73459a592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20W=C3=B6gerer?= Date: Thu, 17 Mar 2016 13:16:52 +0100 Subject: [PATCH 4/4] Fix log message --- mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.py b/mx.py index 1ba6d584..7e58cf25 100755 --- a/mx.py +++ b/mx.py @@ -1150,7 +1150,7 @@ def postPull(self, f): output = join(self.suite.dir, self.output) assert tarfilename with tarfile.open(tarfilename, 'r:') as tar: - log('Extract {} to {}'.format(tarfilename, output)) + logv('Extracting {} to {}'.format(tarfilename, output)) tar.extractall(output) def prePush(self, f):