diff options
author | Ralph Nathan <ralphnathan@chromium.org> | 2015-03-24 10:41:17 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-26 18:44:28 +0000 |
commit | 599004268612f9d4f3f6eb63378321566e066600 (patch) | |
tree | ef52a449616d5fec688f524ee306b41f63f4c9ea /scripts | |
parent | 58b3bb604f50b6810934cd18eee4f285d0e43522 (diff) | |
download | chromite-599004268612f9d4f3f6eb63378321566e066600.tar.gz |
logging: Use cros_logging instead of cros_build_lib.Error
In chromite, replace all calls to cros_build_lib.Error with calls to
cros_logging.error.
BUG=brillo:600
TEST=unittests + trybot
Change-Id: Ib036983fced3d90036d6dbf4bcebc39e317479c8
Reviewed-on: https://chromium-review.googlesource.com/262240
Reviewed-by: David Pursell <dpursell@chromium.org>
Commit-Queue: Ralph Nathan <ralphnathan@chromium.org>
Trybot-Ready: Ralph Nathan <ralphnathan@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/cbuildbot.py | 2 | ||||
-rw-r--r-- | scripts/chrome_update_extension_cache.py | 10 | ||||
-rw-r--r-- | scripts/cros_generate_breakpad_symbols.py | 9 | ||||
-rw-r--r-- | scripts/cros_mark_as_stable.py | 4 | ||||
-rw-r--r-- | scripts/cros_sdk.py | 3 | ||||
-rw-r--r-- | scripts/gather_builder_stats.py | 18 | ||||
-rw-r--r-- | scripts/gconv_strip.py | 4 | ||||
-rw-r--r-- | scripts/pushimage.py | 15 | ||||
-rw-r--r-- | scripts/summarize_build_stats.py | 8 | ||||
-rw-r--r-- | scripts/upload_symbols.py | 2 |
10 files changed, 35 insertions, 40 deletions
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py index 11318bf35..9fd776887 100644 --- a/scripts/cbuildbot.py +++ b/scripts/cbuildbot.py @@ -888,7 +888,7 @@ def _PostParseCheck(parser, options, args): if not build_config: invalid_targets.append(arg) - cros_build_lib.Error('No such configuraton target: "%s".', arg) + logging.error('No such configuraton target: "%s".', arg) continue is_payloads_build = build_config.build_type == constants.PAYLOADS_TYPE diff --git a/scripts/chrome_update_extension_cache.py b/scripts/chrome_update_extension_cache.py index 0018683ce..02f1048be 100644 --- a/scripts/chrome_update_extension_cache.py +++ b/scripts/chrome_update_extension_cache.py @@ -45,14 +45,14 @@ def DownloadCrx(ext, extension, crxdir): (extension['external_update_url'], ext)) response = urllib.urlopen(update_url) if response.getcode() != 200: - cros_build_lib.Error('Cannot get update response, URL: %s, error: %d', - update_url, response.getcode()) + logging.error('Cannot get update response, URL: %s, error: %d', update_url, + response.getcode()) return False dom = xml.dom.minidom.parse(response) status = dom.getElementsByTagName('app')[0].getAttribute('status') if status != 'ok': - cros_build_lib.Error('Cannot fetch extension, status: %s', status) + logging.error('Cannot fetch extension, status: %s', status) return False node = dom.getElementsByTagName('updatecheck')[0] @@ -61,8 +61,8 @@ def DownloadCrx(ext, extension, crxdir): filename = '%s-%s.crx' % (ext, version) response = urllib.urlopen(url) if response.getcode() != 200: - cros_build_lib.Error('Cannot download extension, URL: %s, error: %d', - url, response.getcode()) + logging.error('Cannot download extension, URL: %s, error: %d', url, + response.getcode()) return False osutils.WriteFile(os.path.join(crxdir, 'extensions', filename), diff --git a/scripts/cros_generate_breakpad_symbols.py b/scripts/cros_generate_breakpad_symbols.py index b13c63f48..4a581a627 100644 --- a/scripts/cros_generate_breakpad_symbols.py +++ b/scripts/cros_generate_breakpad_symbols.py @@ -136,8 +136,8 @@ def GenerateBreakpadSymbol(elf_file, debug_file=None, breakpad_dir=None, logging.warning('no symbols found for %s', elf_file) else: num_errors.value += 1 - cros_build_lib.Error('dumping symbols for %s failed:\n%s', - elf_file, result.error) + logging.error('dumping symbols for %s failed:\n%s', elf_file, + result.error) return num_errors.value # Move the dumped symbol file to the right place: @@ -260,8 +260,7 @@ def GenerateBreakpadSymbols(board, breakpad_dir=None, strip_cfi=False, files_not_found = [x for x, found in file_filter.iteritems() if not found] bg_errors.value += len(files_not_found) if files_not_found: - cros_build_lib.Error('Failed to find requested files: %s', - files_not_found) + logging.error('Failed to find requested files: %s', files_not_found) # Now start generating symbols for the discovered elfs. with parallel.BackgroundTaskRunner(GenerateBreakpadSymbol, @@ -330,7 +329,7 @@ def main(argv): exclude_dirs=opts.exclude_dir, file_list=opts.file_list) if ret: - cros_build_lib.Error('encountered %i problem(s)', ret) + logging.error('encountered %i problem(s)', ret) # Since exit(status) gets masked, clamp it to 1 so we don't inadvertently # return 0 in case we are a multiple of the mask. ret = 1 diff --git a/scripts/cros_mark_as_stable.py b/scripts/cros_mark_as_stable.py index 8841bea3d..a9cb522eb 100644 --- a/scripts/cros_mark_as_stable.py +++ b/scripts/cros_mark_as_stable.py @@ -128,8 +128,8 @@ def PushChange(stable_branch, tracking_branch, dryrun, cwd): push_branch, stable_branch)] bad_cls = git.RunGit(cwd, bad_cl_cmd).output if bad_cls.strip() and not dryrun: - cros_build_lib.Error('The Uprev stage found changes from users other' - ' than chrome-bot:\n\n%s', bad_cls) + logging.error('The Uprev stage found changes from users other than ' + 'chrome-bot:\n\n%s', bad_cls) raise AssertionError('Unexpected CLs found during uprev stage.') description = git.RunGit( diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py index 681d5a089..70c7208fd 100644 --- a/scripts/cros_sdk.py +++ b/scripts/cros_sdk.py @@ -16,6 +16,7 @@ from chromite.cbuildbot import constants from chromite.lib import cgroups from chromite.lib import commandline from chromite.lib import cros_build_lib +from chromite.lib import cros_logging as logging from chromite.lib import locking from chromite.lib import namespaces from chromite.lib import osutils @@ -395,7 +396,7 @@ def _ProxySimSetup(options): try: cros_build_lib.RunCommand(cmd_cleanup, print_cmd=False) except cros_build_lib.RunCommandError: - cros_build_lib.Error('running %r failed', cmd_cleanup) + logging.error('running %r failed', cmd_cleanup) raise SystemExit('Running %r failed!' % (cmd,)) os.write(parent_writefd, SUCCESS_FLAG) os.close(parent_writefd) diff --git a/scripts/gather_builder_stats.py b/scripts/gather_builder_stats.py index e361606a2..06445b5e2 100644 --- a/scripts/gather_builder_stats.py +++ b/scripts/gather_builder_stats.py @@ -15,7 +15,6 @@ from chromite.cbuildbot import cbuildbot_config from chromite.cbuildbot import metadata_lib from chromite.cbuildbot import constants from chromite.lib import commandline -from chromite.lib import cros_build_lib from chromite.lib import cros_logging as logging from chromite.lib import gdata_lib from chromite.lib import gs @@ -526,9 +525,8 @@ class SSUploader(object): logging.debug('Adding spreadsheet row for %s %s.', id_col, id_val) self._scomm.InsertRow(row_dict) except gdata_lib.SpreadsheetError as e: - cros_build_lib.Error('Failure while uploading spreadsheet row for' - ' %s %s with data %s. Error: %s.', id_col, id_val, - row_dict, e) + logging.error('Failure while uploading spreadsheet row for %s %s with ' + 'data %s. Error: %s.', id_col, id_val, row_dict, e) class StatsManager(object): @@ -682,9 +680,9 @@ class StatsManager(object): try: data_table.AppendBuildRow(build) except Exception: - cros_build_lib.Error('Failed to add row for builder_number %s to' - ' table. It came from %s.', build.build_number, - build.metadata_url) + logging.error('Failed to add row for builder_number %s to table. It' + ' came from %s.', build.build_number, + build.metadata_url) raise # Upload data table to sheet. @@ -775,13 +773,13 @@ def _CheckOptions(options): # Ensure that specified start date is in the past. now = datetime.datetime.now() if options.start_date and now.date() < options.start_date: - cros_build_lib.Error('Specified start date is in the future: %s', - options.start_date) + logging.error('Specified start date is in the future: %s', + options.start_date) return False # The --save option requires --email. if options.save and not options.email: - cros_build_lib.Error('You must specify --email with --save.') + logging.error('You must specify --email with --save.') return False return True diff --git a/scripts/gconv_strip.py b/scripts/gconv_strip.py index 27a0d3c8d..406c80772 100644 --- a/scripts/gconv_strip.py +++ b/scripts/gconv_strip.py @@ -97,8 +97,8 @@ class GconvModules(object): toset = toset.rstrip('/') # Warn if the same charset is defined as two different aliases. if self._alias.get(fromset, toset) != toset: - cros_build_lib.Error('charset "%s" already defined as "%s".', - fromset, self._alias[fromset]) + logging.error('charset "%s" already defined as "%s".', fromset, + self._alias[fromset]) self._alias[fromset] = toset else: cros_build_lib.Die('Unknown line: %s', line) diff --git a/scripts/pushimage.py b/scripts/pushimage.py index 7889eaea0..7c087249a 100644 --- a/scripts/pushimage.py +++ b/scripts/pushimage.py @@ -318,8 +318,7 @@ def PushImage(src_path, board, versionrev=None, profile=None, priority=50, continue except gs.GSContextException: unknown_error = True - cros_build_lib.Error('Skipping %s due to unknown GS error', src, - exc_info=True) + logging.error('Skipping %s due to unknown GS error', src, exc_info=True) continue if image_type: @@ -351,8 +350,8 @@ def PushImage(src_path, board, versionrev=None, profile=None, priority=50, except gs.GSContextException: unknown_error = True exists = False - cros_build_lib.Error('Unknown error while checking %s', - gs_artifact_path, exc_info=True) + logging.error('Unknown error while checking %s', gs_artifact_path, + exc_info=True) if not exists: logging.info('%s does not exist. Nothing to sign.', gs_artifact_path) @@ -379,16 +378,16 @@ def PushImage(src_path, board, versionrev=None, profile=None, priority=50, ctx.Copy(insns_path.name, gs_insns_path) except gs.GSContextException: unknown_error = True - cros_build_lib.Error('Unknown error while uploading insns %s', - gs_insns_path, exc_info=True) + logging.error('Unknown error while uploading insns %s', + gs_insns_path, exc_info=True) continue try: MarkImageToBeSigned(ctx, tbs_base, gs_insns_path, priority) except gs.GSContextException: unknown_error = True - cros_build_lib.Error('Unknown error while marking for signing %s', - gs_insns_path, exc_info=True) + logging.error('Unknown error while marking for signing %s', + gs_insns_path, exc_info=True) continue logging.info('Signing %s image %s', image_type, gs_insns_path) instruction_urls.setdefault(channel, []).append(gs_insns_path) diff --git a/scripts/summarize_build_stats.py b/scripts/summarize_build_stats.py index 352acfb3e..b27128215 100644 --- a/scripts/summarize_build_stats.py +++ b/scripts/summarize_build_stats.py @@ -18,7 +18,6 @@ from chromite.cbuildbot import metadata_lib from chromite.lib import cidb from chromite.lib import clactions from chromite.lib import commandline -from chromite.lib import cros_build_lib from chromite.lib import cros_logging as logging from chromite.lib import gdata_lib from chromite.scripts import gather_builder_stats @@ -616,13 +615,12 @@ def _CheckOptions(options): # Ensure that specified start date is in the past. now = datetime.datetime.now() if options.start_date and now.date() < options.start_date: - cros_build_lib.Error('Specified start date is in the future: %s', - options.start_date) + logging.error('Specified start date is in the future: %s', + options.start_date) return False if not options.email and not options.annotations_from_cidb: - cros_build_lib.Error('--email is required if not using ' - '--annotations-from-cidb.') + logging.error('--email is required if not using --annotations-from-cidb.') return False return True diff --git a/scripts/upload_symbols.py b/scripts/upload_symbols.py index d2237408e..9b090bd0a 100644 --- a/scripts/upload_symbols.py +++ b/scripts/upload_symbols.py @@ -859,7 +859,7 @@ def main(argv): failed_list=opts.failed_list, root=opts.root, dedupe_namespace=dedupe_namespace) if ret: - cros_build_lib.Error('encountered %i problem(s)', ret) + logging.error('encountered %i problem(s)', ret) # Since exit(status) gets masked, clamp it to 1 so we don't inadvertently # return 0 in case we are a multiple of the mask. ret = 1 |