From 6b3a8e3688c85dfa5afe7e581bdb9439d9007a84 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 10:19:17 -0700 Subject: [PATCH 1/7] cleanup --- tools/fuchsia/gen_package.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index f9a2685c0ef0f..7a895d3a746fb 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -91,20 +91,12 @@ def main(): ] # Build the package - try: - output = subprocess.check_output(pm_command_base + ['build']) - except subprocess.CalledProcessError as e: - print('The "%s" command failed:' % e.cmd) - print(e.output) - raise + # Use check_output so if anything goes wrong we get the output. + output = subprocess.check_output(pm_command_base + ['build']) # Archive the package - try: - output = subprocess.check_output(pm_command_base + ['archive']) - except subprocess.CalledProcessError as e: - print('The "%s" command failed:' % e.cmd) - print(e.output) - raise + # Use check_output so if anything goes wrong we get the output. + output = subprocess.check_output(pm_command_base + ['archive']) return 0 From bf06e4f432544a5d7eaa97b44d79dd1e3beb0f48 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 10:32:01 -0700 Subject: [PATCH 2/7] do not store unused var --- tools/fuchsia/gen_package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index 7a895d3a746fb..2c53b6c2ae033 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -92,11 +92,11 @@ def main(): # Build the package # Use check_output so if anything goes wrong we get the output. - output = subprocess.check_output(pm_command_base + ['build']) + subprocess.check_output(pm_command_base + ['build']) # Archive the package # Use check_output so if anything goes wrong we get the output. - output = subprocess.check_output(pm_command_base + ['archive']) + subprocess.check_output(pm_command_base + ['archive']) return 0 From 1103757caf512c3ba71d2934a9b3f2374e8f4c22 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 12:52:10 -0700 Subject: [PATCH 3/7] assertion --- tools/fuchsia/gen_package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index 2c53b6c2ae033..ba2c58b0983d9 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -24,6 +24,7 @@ def GenerateManifest(package_dir): common_prefix = os.path.commonprefix([root, package_dir]) rel_path = os.path.relpath(os.path.join(root, f), common_prefix) from_package = os.path.abspath(os.path.join(package_dir, rel_path)) + assert from_package, 'Failed to create from_package for %s' % os.path.join(root, f) full_paths.append('%s=%s' % (rel_path, from_package)) parent_dir = os.path.abspath(os.path.join(package_dir, os.pardir)) manifest_file_name = os.path.basename(package_dir) + '.manifest' From 4dab559dbb0c881e83e6fac23440d263f0a2db19 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 13:40:08 -0700 Subject: [PATCH 4/7] print manifest contents --- tools/fuchsia/gen_package.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index ba2c58b0983d9..79adec660e6cc 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -43,10 +43,10 @@ def CreateFarPackage(pm_bin, package_dir, signing_key, dst_dir): ] # Build the package - subprocess.check_call(pm_command_base + ['build']) + subprocess.check_output(pm_command_base + ['build']) # Archive the package - subprocess.check_call(pm_command_base + ['archive']) + subprocess.check_output(pm_command_base + ['archive']) return 0 @@ -91,13 +91,17 @@ def main(): manifest_file, ] - # Build the package - # Use check_output so if anything goes wrong we get the output. - subprocess.check_output(pm_command_base + ['build']) - - # Archive the package + # Build and then archive the package # Use check_output so if anything goes wrong we get the output. - subprocess.check_output(pm_command_base + ['archive']) + try: + subprocess.check_output(pm_command_base + ['build']) + subprocess.check_output(pm_command_base + ['archive']) + except subprocess.CalledProcessError as e: + print('==================== Manifest contents =========================================') + with open(manifest_file, 'r') as manifest: + print(manifest)) + print('==================== End manifest contents ====================================='). + raise return 0 From 91963ca14d28ffa87d93f40c2ed241e08178e146 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 13:56:19 -0700 Subject: [PATCH 5/7] stray paren --- tools/fuchsia/gen_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index 79adec660e6cc..4fadfe3e62ac3 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -99,7 +99,7 @@ def main(): except subprocess.CalledProcessError as e: print('==================== Manifest contents =========================================') with open(manifest_file, 'r') as manifest: - print(manifest)) + print(manifest) print('==================== End manifest contents ====================================='). raise From a1424f6bfef71b8fba48f62fff69aa35d65b6ee4 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 14:53:27 -0700 Subject: [PATCH 6/7] stray period --- tools/fuchsia/gen_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index 4fadfe3e62ac3..756b8df715041 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -100,7 +100,7 @@ def main(): print('==================== Manifest contents =========================================') with open(manifest_file, 'r') as manifest: print(manifest) - print('==================== End manifest contents ====================================='). + print('==================== End manifest contents =====================================') raise return 0 From 2315ef076973ed8edc879ada38ea09d85b826d30 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 11 Oct 2019 14:55:13 -0700 Subject: [PATCH 7/7] ... --- tools/fuchsia/gen_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/fuchsia/gen_package.py b/tools/fuchsia/gen_package.py index 756b8df715041..27961618ad597 100755 --- a/tools/fuchsia/gen_package.py +++ b/tools/fuchsia/gen_package.py @@ -99,7 +99,7 @@ def main(): except subprocess.CalledProcessError as e: print('==================== Manifest contents =========================================') with open(manifest_file, 'r') as manifest: - print(manifest) + print(manifest.read()) print('==================== End manifest contents =====================================') raise