Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: scripts/slave/zip_build.py

Issue 2128613005: Archive Linux perf builds for manual bisect (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Archive Linux perf builds for manual bisect [2] Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/zip_build.py
diff --git a/scripts/slave/zip_build.py b/scripts/slave/zip_build.py
index c02908bd4aac99a1520b69ae3689872ab78127eb..755fdd35c78ad1d7d7045d7922fd6aa4ae2f1645 100755
--- a/scripts/slave/zip_build.py
+++ b/scripts/slave/zip_build.py
@@ -23,6 +23,9 @@ from common import chromium_utils
from slave import build_directory
from slave import slave_utils
+STRIP_LIST_LINUX = ['chrome', 'nacl_helper']
dimu1 2016/07/07 21:54:11 Add the list as an argument, and pass this as a ar
+
+
class StagingError(Exception): pass
@@ -167,8 +170,40 @@ def WriteRevisionFile(dirname, build_revision):
print 'Writing to revision file in %s failed.' % dirname
+
+def unzip_strip_zip(zip_file, zip_file_list, strip_list):
dimu1 2016/07/07 21:54:11 Is it possible to strip, then zip? To avoid the zi
+ """Unzips a zip file and strips symbols from designated files and make it into a zip file.
+ Replaces the target file in place.
+
+ Args:
+ zip_file: Directory of the zip file
+ zip_file_list: List of files to be contained in the new zip file
+ strip list: List of file names to strip symbols
+
+ Returns: The path of the written file.
+ """
+ output_dir = os.path.abspath(os.path.join(zip_file, '..'))
+ tmp_dir = os.path.abspath(os.path.join(output_dir, 'tmp'))
+ unzip_dir = os.path.abspath(os.path.join(tmp_dir,
+ os.path.basename(os.path.splitext(zip_file)[0])))
+ chromium_utils.ExtractZip(zip_file, tmp_dir)
+
+ for file in strip_list:
+ os.system('strip %s/%s' %(unzip_dir, file))
+
+ chromium_utils.RemoveFile(zip_file)
+ (zip_dir, zip_file) = chromium_utils.MakeZip(output_dir,
+ os.path.splitext(zip_file)[0],
+ zip_file_list,
+ unzip_dir
+ )
+ chromium_utils.RemoveDirectory(tmp_dir)
+ chromium_utils.RemoveDirectory(zip_dir)
+
+
+
def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
- zip_file_name):
+ zip_file_name, strip_symbol=False):
"""Creates an unversioned full build archive.
Returns the path of the created archive."""
(zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir,
@@ -176,9 +211,12 @@ def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
zip_file_list,
build_dir,
raise_error=True)
+
chromium_utils.RemoveDirectory(zip_dir)
if not os.path.exists(zip_file):
raise StagingError('Failed to make zip package %s' % zip_file)
+ if strip_symbol:
+ unzip_strip_zip(zip_file, zip_file_list, STRIP_LIST_LINUX)
chromium_utils.MakeWorldReadable(zip_file)
# Report the size of the zip file to help catch when it gets too big and
@@ -260,6 +298,7 @@ class PathMatcher(object):
self.regex_whitelist = FileRegexWhitelist(options)
self.regex_blacklist = FileRegexBlacklist(options)
self.exclude_unmatched = options.exclude_unmatched
+ self.exclusive_include = options.exclusive_include
def __str__(self):
return '\n '.join([
@@ -273,6 +312,9 @@ class PathMatcher(object):
def Match(self, filename):
if filename in self.inclusions:
return True
+ # Added to implement exclusive include
+ if self.exclusive_include:
+ return False
if filename in self.exclusions:
return False
if re.match(self.regex_whitelist, filename):
@@ -286,7 +328,6 @@ def Archive(options):
build_dir = build_directory.GetBuildOutputDirectory(
options.src_dir, options.cros_board)
build_dir = os.path.abspath(os.path.join(build_dir, options.target))
-
staging_dir = slave_utils.GetStagingDir(options.src_dir)
chromium_utils.MakeParentDirectoriesWorldReadable(staging_dir)
@@ -352,7 +393,7 @@ def Archive(options):
zip_file_list.extend(mojom_files)
zip_file = MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
- unversioned_base_name)
+ unversioned_base_name, strip_symbol=options.strip_symbol)
zip_base, zip_ext, versioned_file = MakeVersionedArchive(
zip_file, version_suffix, options)
@@ -399,6 +440,8 @@ def main(argv):
option_parser.add_option('--include-files', default='',
help='Comma separated list of files that should '
'always be included in the zip.')
+ option_parser.add_option('--exclusive_include', action='store_true',
+ default=False, help='Only include the files in include-files list')
option_parser.add_option('--master-name', help='Name of the buildbot master.')
option_parser.add_option('--slave-name', help='Name of the buildbot slave.')
option_parser.add_option('--build-number', type=int,
@@ -430,6 +473,8 @@ def main(argv):
default=False, help='Add also dSYM files.')
option_parser.add_option('--append-deps-patch-sha', action='store_true')
option_parser.add_option('--gs-acl')
+ option_parser.add_option('--strip_symbol', action='store_true',
+ default=False, help='Strip symbols from chrome executable.')
option_parser.add_option('--json-urls',
help=('Path to json file containing uploaded '
'archive urls. If this is omitted then '

Powered by Google App Engine
This is Rietveld 408576698