AMBARI-22444 - Add Native Libraries To Tez Tarball (part2) (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0936f463 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0936f463 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0936f463 Branch: refs/heads/branch-feature-AMBARI-20859 Commit: 0936f463042cf5ba195b0461479d8c29c88330dd Parents: 8fe6ac4 Author: Jonathan Hurley <jhur...@hortonworks.com> Authored: Wed Nov 15 17:37:57 2017 -0500 Committer: Jonathan Hurley <jhur...@hortonworks.com> Committed: Wed Nov 15 17:40:29 2017 -0500 ---------------------------------------------------------------------- .../libraries/functions/copy_tarball.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0936f463/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py index f62aa3d..7bca967 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py @@ -33,6 +33,7 @@ from resource_management.core import shell from resource_management.core import sudo from resource_management.core.logger import Logger from resource_management.core.exceptions import Fail +from resource_management.core.resources.system import Directory from resource_management.core.resources.system import Execute from resource_management.libraries.functions import stack_tools, stack_features, stack_select from resource_management.libraries.functions import tar_archive @@ -77,7 +78,14 @@ def _prepare_tez_tarball(): Execute(("cp", "-a", hadoop_lib_native_dir, tez_lib_dir), sudo = True) - tez_tarball_with_native_lib = os.path.join(os.path.dirname(tez_source_file), "tez-native.tar.gz") + tez_native_tarball_staging_dir = os.path.join(temp_dir, "tez-native-tarball-staging") + if not os.path.exists(tez_native_tarball_staging_dir): + Directory(tez_native_tarball_staging_dir, + cd_access='a', + create_parents = True, + recursive_ownership = True) + + tez_tarball_with_native_lib = os.path.join(tez_native_tarball_staging_dir, "tez-native.tar.gz") Logger.info("Creating a new Tez tarball at {0}".format(tez_tarball_with_native_lib)) # tar up Tez, making sure to specify nothing for the arcname so that it does not include an absolute path