From ede859f9eeafd245239c37dcf2b1b20b8f792cb4 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Thu, 1 Jun 2023 20:59:30 +0000 Subject: [PATCH] Revert "Add git_cache epoch to bot_update output.properties" This reverts commit 867d3267c1bc63a0bab67e2ecbdde843434e6d90. Reason for revert: breaks some builders, https://crbug.com/1448769#c5 Original change's description: > Add git_cache epoch to bot_update output.properties > > This change adds git cache's epoch timestamp to bot_update's output.properties. It achieves this by adding a marker file to the cache directory which stores the epoch time. > > Design: go/query-bot-update-cache-age > > Bug: 1448769 > Change-Id: I610c6bca5ced7e2a0fe3ee8570decf0f135fe54c > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4563726 > Reviewed-by: Josip Sokcevic > Commit-Queue: Aravind Vasudevan Bug: 1448769 Change-Id: I29db9ac364a9cf1d615b00ed75c1346e56b3f3b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4582291 Commit-Queue: Gavin Mak Bot-Commit: Rubber Stamper Reviewed-by: Aravind Vasudevan --- .../bot_update/resources/bot_update.py | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index 35481a3119..369c023b73 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -1044,19 +1044,6 @@ def checkout(options, git_slns, specs, revisions, step_text): ver = git('version').strip() print('Using %s' % ver) - # Get the epoch of the git cache from a cache epoch marker file. If this file - # does not exist, create one with the current timestamp. - cache_epoch_marker_path = os.path.join(options.git_cache_dir, '.cache_epoch') - if os.path.isfile(cache_epoch_marker_path): - with open(cache_epoch_marker_path) as f: - cache_epoch = f.readline().strip() - else: - with open(cache_epoch_marker_path, 'w') as f: - cache_epoch = int(time.time()) - print(cache_epoch, file=f) - - print('git_cache epoch: {}'.format(datetime.fromtimestamp(int(cache_epoch)))) - try: protocol = git('config', '--get', 'protocol.version') print('Using git protocol version %s' % protocol) @@ -1146,18 +1133,15 @@ def checkout(options, git_slns, specs, revisions, step_text): revision_mapping['got_revision'] = first_sln manifest = create_manifest() - properties = parse_got_revision(manifest, revision_mapping) + got_revisions = parse_got_revision(manifest, revision_mapping) - if not properties: + if not got_revisions: # TODO(hinoka): We should probably bail out here, but in the interest # of giving mis-configured bots some time to get fixed use a dummy # revision here. - properties = {'got_revision': 'BOT_UPDATE_NO_REV_FOUND'} + got_revisions = { 'got_revision': 'BOT_UPDATE_NO_REV_FOUND' } #raise Exception('No got_revision(s) found in gclient output') - # Add git cache age to the output.properties - properties['git_cache_epoch'] = cache_epoch - # Tell recipes information such as root, got_revision, etc. emit_json(options.output_json, did_run=True, @@ -1165,7 +1149,7 @@ def checkout(options, git_slns, specs, revisions, step_text): patch_root=options.patch_root, step_text=step_text, fixed_revisions=revisions, - properties=properties, + properties=got_revisions, manifest=manifest)