Commit Graph

68 Commits (5ee6b6e6e335f345824d9cdb4f93a2bb997acb97)

Author SHA1 Message Date
Jeremy Apthorp d795ab891c Use system unzip on macOS
Modern macOS has no problem unzipping big zip files. To test:

$ gsutil cp gs://chromium-git-cache/chromium.googlesource.com-chromium-src/516491.zip test.zip
$ unzip -l test.zip

Change-Id: I84b3cff21cb9b7033c04b427e23f27a75ab1d8ae
Reviewed-on: https://chromium-review.googlesource.com/1152294
Commit-Queue: Jeremy Apthorp <jeremya@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Edward Lemur 2f38df65f9 gclient: Reset the fetch config also when --force is passed.
The update_scripts step doesn't set '--reset'
Additionally, if there was no fetch config, don't fail trying to unset it.

Tbr: agable@chromium.org
No-Try: True
Bug: 862547
Change-Id: I90886ca7d1dd20ae59b378a5998de47dc67c60f9
Reviewed-on: https://chromium-review.googlesource.com/1137693
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Edward Lemur 579c98612b Reset the fetch config in the bots before each run.
If a ref is incorrectly set, it will affect later runs.
For example, [1] caused a bad refspec to be added to the fetch config,
(+refs/branch-heads/refs/branch-heads/6.7:refs/branch-heads/refs/branch-heads/6.7)
which affects all subsequent runs in the same bot: [2], [3].

This makes bot_update clear the fetch config before each run, so it is more
robust against these kind of failures.

[1] https://logs.chromium.org/v/?s=v8%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8942033142534034848%2F%2B%2Fsteps%2Fbot_update%2F0%2Fstdout
[2] https://logs.chromium.org/v/?s=v8%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8941307871443322944%2F%2B%2Fsteps%2Fbot_update%2F0%2Fstdout
[3] https://logs.chromium.org/v/?s=v8%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8941333453153279680%2F%2B%2Fsteps%2Fbot_update%2F0%2Fstdout

Bug: 862547
Change-Id: I2f849c604656e81ebd7377465d287226b8bdea1a
Reviewed-on: https://chromium-review.googlesource.com/1135645
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Robert Iannucci a19649b86b Clean up cache_dir handling in gclient/git_cache/bot_update.
This CL makes a couple changes:
  * The goal here is to be able to specify git cache entirely from the
    environment variable $GIT_CACHE_PATH and not require special treatment from
    bot_update. Eventually this will be specified at the swarming task level
    instead of in the recipe (i.e. "cached git" will eventually be an
    implementation detail of git on the bots and completely transparent to
    all other software).
  * Removal of the general --cache-dir option from gclient. This option was
    error-prone; it doesn't actually make sense to configure this on
    a per-invocation basis. The sole exception was `gclient config`, which
    now allows this option to be set directly.
  * Consolidation of GitWrapper.cache_dir and GitWrapper._GetMirror; previously
    these two things could disagree, leading to weird intermediate states. Now
    they're the same value.

R=agable@chromium.org, ehmaldonado@chromium.org, tandrii@chromium.org

Bug: 823434
Change-Id: I14adc7619b5fc10768ce32be2651c6215ba94aff
Reviewed-on: https://chromium-review.googlesource.com/1105473
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Takuto Ikuta 4fbf4bece2 Remove windows specific git pack limit
This is full version of
https://chromium-review.googlesource.com/823544

After the CL landing, we see no performance regression in bot_update step.
And regular 95%ile in 1h window improved from more than 300s to less than or around 200s.
See tandrii's query in https://bugs.chromium.org/p/chromium/issues/detail?id=749709#c91 for detail.

Let me reduce frequency of slow bot_update step more like below.
https://ci.chromium.org/buildbot/tryserver.chromium.win/win7_chromium_rel_ng/69844
https://ci.chromium.org/buildbot/tryserver.chromium.win/win7_chromium_rel_ng/69886
https://ci.chromium.org/buildbot/tryserver.chromium.win/win7_chromium_rel_ng/69892

Bug: 749709
Change-Id: I44474aa9ecdd733d68fd13fe8b791820fb80381f
Reviewed-on: https://chromium-review.googlesource.com/838766
Commit-Queue: Takuto Ikuta <tikuta@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Takuto Ikuta 9fce213bdb Partial revert of "git_cache: lower max num of .pack files before re-bootstrap on Win."
This partially reverts commit d51ed57edb.

Reason for revert:
New git client for windows was rolled including fix for slow `git fetch`.
I guess smaller pack limit causes frequent bootstrap taking 2~3 minutes longer than
the case it does not happen.
Let me see what happen if we increase pack limit 9 -> 30.
I will increase this to 50 if this won't cause regression again.

Original change's description:
> git_cache: lower max num of .pack files before re-bootstrap on Win.
>
> It used to be 50, I think ~9 gives best results for Chromium on Win:
>   on golo VM, it takes <4 minutes to re-boostrap + git fetch small
>   delta, assuming zipped git checkout for bootstrap is fresh (~1day).
>
> For other repos, which are significantly smaller, this change should
> have minor effect if at all.
>
> Test: I tested this using `led` tool on Win7 machines running LUCI
> stack extensively. For example,
>
>   * https://ci.chromium.org/swarming/task/3a0102e8c8657410
>     shows case with few .pack files, hence just 1 fetch
>
>   * https://ci.chromium.org/swarming/task/3a010282f9fd8010
>     shows case with 39 .pack files and so bootstrapping + fetch.
>     If you look at prior tasks on the same VM, you'd find this:
>     https://ci.chromium.org/swarming/task/39ffe843d01ed010
>     which spent 8 minutes doing 1 incremental fetch with 39 .pack
>     files.
>
> **Troopers/Sheriffs**: This change is safe to revert.
> However, beware that you should also at the same time revert the recipe
> roll of this CL to the repo, in which the failed builder's recipe is
> located, typically `chromium/tools/build`.
>
> Bug: 749709
> Change-Id: I18e2b63283100d466e9fb981a9094862463f6909
> Reviewed-on: https://chromium-review.googlesource.com/787174
> Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
> Reviewed-by: Takuto Ikuta <tikuta@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 749709
Change-Id: I3052abe4a9b53277a60c0791a85355e7a0bbdf8f
Reviewed-on: https://chromium-review.googlesource.com/823544
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@google.com>
7 years ago
Andrii Shyshkalov 46a672bafa gclient: don't update cache if needed revision is already there.
Tested end-to-end, for example
  https://ci.chromium.org/swarming/task/3a0147207378b910
which contains:
  src/media/cdm/api (Elapsed: 0:00:01)
  ----------------------------------------
  [0:00:00] Started.
  _____ src\media\cdm\api at ea5df8e78fbd0a4c24cc3a1f3faefefcd1b45237
  [0:00:00] running "git cat-file -e ea5df8e78fbd0a4c24cc3a1f3faefefcd1b45237" in "e:\b\s\w\ir\cache\git\chromium.googlesource.com-chromium-cdm"
  skipping mirror update, it has rev=ea5df8e78fbd0a4c24cc3a1f3faefefcd1b45237 already

thereby saving on needless git fetch (~40s in glcient sync on win trybots),
and reducing the rate of .pack file accumulation inside cache directories.


Risks: silently broken recipes which run gclient sync (or worse, bot_update)
as a means of fetching latest commits in all repos of a solution. I think
the benefit of faster bot_update in chromium CQ is worth the potential risk.

PSA: https://groups.google.com/a/chromium.org/d/msg/infra-dev/UYLdBwAXm1Y/OV9QB6JnBQAJ

Bug: 749709
Change-Id: I7a9e8ab82a5e2b848e450f19a798ac18a0b5e201
Reviewed-on: https://chromium-review.googlesource.com/787331
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
7 years ago
Andrii Shyshkalov d51ed57edb git_cache: lower max num of .pack files before re-bootstrap on Win.
It used to be 50, I think ~9 gives best results for Chromium on Win:
  on golo VM, it takes <4 minutes to re-boostrap + git fetch small
  delta, assuming zipped git checkout for bootstrap is fresh (~1day).

For other repos, which are significantly smaller, this change should
have minor effect if at all.

Test: I tested this using `led` tool on Win7 machines running LUCI
stack extensively. For example,

  * https://ci.chromium.org/swarming/task/3a0102e8c8657410
    shows case with few .pack files, hence just 1 fetch

  * https://ci.chromium.org/swarming/task/3a010282f9fd8010
    shows case with 39 .pack files and so bootstrapping + fetch.
    If you look at prior tasks on the same VM, you'd find this:
    https://ci.chromium.org/swarming/task/39ffe843d01ed010
    which spent 8 minutes doing 1 incremental fetch with 39 .pack
    files.

**Troopers/Sheriffs**: This change is safe to revert.
However, beware that you should also at the same time revert the recipe
roll of this CL to the repo, in which the failed builder's recipe is
located, typically `chromium/tools/build`.

Bug: 749709
Change-Id: I18e2b63283100d466e9fb981a9094862463f6909
Reviewed-on: https://chromium-review.googlesource.com/787174
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@google.com>
7 years ago
Andrii Shyshkalov 4f56f234f9 git_cache: add more diagnostic logging wrt bootstrapping.
This is short of sending this metrics to ts_mon, but is still useful
for diagnose and then claim improvements in git cache performance on
bots.

This change has been tested for realz with led, particularly on windows
https://ci.chromium.org/swarming/task/3a01358af14a7d10

Bug: 749709
Change-Id: I2b3589079d2caa7f70007f90fcbce85a0205d24b
Reviewed-on: https://chromium-review.googlesource.com/787173
Reviewed-by: Takuto Ikuta <tikuta@google.com>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Andrii Shyshkalov 82d8dcd6e5 git_cache: remove redundant code.
R=iannucci@chromium.org, nodir@chromium.org

Change-Id: If7d48775b01a55e884a4c1fd6c26b1ff65992f4e
Reviewed-on: https://chromium-review.googlesource.com/786823
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Vadim Shtayura 08049e2db2 Revert "git_cache: Remove locks"
This reverts commit c3eb3fa335.

Reason for revert: lots of "runhooks" failure everywhere

Example: https://build.chromium.org/p/chromium.linux/builders/Linux%20Builder/builds/92720

Original change's description:
> git_cache: Remove locks
> 
> These aren't in use, and the original problem they were
> meant to solve has been solved at the gclient.py layer 
> using resource locking:
>   https://codereview.chromium.org/2049583003
> 
> Bug: 773008
> Change-Id: I6609f39d7f15604e0bb3d742a41c4f9fec87a57a
> Reviewed-on: https://chromium-review.googlesource.com/707728
> Reviewed-by: Aaron Gable <agable@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Ryan Tseng <hinoka@chromium.org>

TBR=iannucci@chromium.org,hinoka@chromium.org,agable@chromium.org,phajdan.jr@chromium.org

Change-Id: I31d5fef94f39f3a9f97b9e59121073b1f433d11e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 773008
Reviewed-on: https://chromium-review.googlesource.com/711054
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
7 years ago
Ryan Tseng c3eb3fa335 git_cache: Remove locks
These aren't in use, and the original problem they were
meant to solve has been solved at the gclient.py layer 
using resource locking:
  https://codereview.chromium.org/2049583003

Bug: 773008
Change-Id: I6609f39d7f15604e0bb3d742a41c4f9fec87a57a
Reviewed-on: https://chromium-review.googlesource.com/707728
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
7 years ago
Ryan Tseng 3beabd0aa4 git_cache.py: Don't bootstrap from Google storage for unrecognized repos.
Also - Turn on GC for the unrecognized repos.

BUG=skia:6241
TEST=local
  git_cache.py populate with chromium and non-chromium repo.

Change-Id: I100d3665e317b29c5b3f69b49c165ce88cd019d6
Reviewed-on: https://chromium-review.googlesource.com/455979
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Quinten Yearsley b2cc4a94da depot_tools: Replace pylint error numbers with symbolic names.
This affects a bunch of files, but only changes comments,
and shouldn't make any difference to behavior.

The purpose is to slightly improve readability of pylint
disable comments.

Change-Id: Ic6cd0f8de792b31d91c6125f6da2616450b30f11
Reviewed-on: https://chromium-review.googlesource.com/420412
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
8 years ago
dnj 4625b5adb8 Add retries to file operations for Windows.
BUG=chromium:663990
TEST=None
R=hinoka@chromium.org, nodir@chromium.org

Review-Url: https://codereview.chromium.org/2497503002
8 years ago
dnj b445ef568c bot_update: Use 'gclient' from same repository.
Currently, 'bot_update' uses the 'gclient' that is on the system path.
Now, it will use the 'gclient.py' that is in the same 'depot_tools'
checkout as the 'bot_update' recipe module.

Also don't ignore "git_cache" move errors.

BUG=664254,663990,663440
TEST=None

Review-Url: https://codereview.chromium.org/2492963002
8 years ago
hinoka dcd840489d Reland: git_cache.py: Clobber git repos if the config is corrupt
Reland of: https://codereview.chromium.org/2049463003/

See https://build.chromium.org/p/tryserver.chromium.win/builders/win10_chromium_x64_rel_ng_exp/builds/1801/steps/bot_update/logs/stdio
[Mirror] https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.win%2Fwin10_chromium_x64_rel_ng_exp%2F1801%2F%2B%2Frecipes%2Fsteps%2Fbot_update%2F0%2Fstdout

Sometimes repos become corrupt and bot_update fails spectacularly.  This usually happens due to the process being interrupted during a fetch. Git
cache should be able to recover from this by clobbering.

BUG=

Review-Url: https://codereview.chromium.org/2045243004
9 years ago
sergeyberezin 0f4ee8193b Revert of git_cache.py: Clobber git repos if the config is corrupt (patchset #4 id:60001 of https://codereview.chromium.org/2031773002/ )
Reason for revert:
Suspected to break builds: http://crbug.com/618124

Original issue's description:
> git_cache.py: Clobber git repos if the config is corrupt
>
> See https://build.chromium.org/p/tryserver.chromium.win/builders/win10_chromium_x64_rel_ng_exp/builds/1801/steps/bot_update/logs/stdio
> [Mirror] https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.win%2Fwin10_chromium_x64_rel_ng_exp%2F1801%2F%2B%2Frecipes%2Fsteps%2Fbot_update%2F0%2Fstdout
>
> Sometimes repos become corrupt and bot_update fails spectacularly.  This usually happens due to the process being interrupted during a fetch. Git
> cache should be able to recover from this by clobbering.
>
> BUG=
>
> Committed: b48b126ffd

TBR=estaab@chromium.org,phajdan.jr@chromium.org,hinoka@google.com,hinoka@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.chromium.org/2049463003
9 years ago
hinoka b48b126ffd git_cache.py: Clobber git repos if the config is corrupt
See https://build.chromium.org/p/tryserver.chromium.win/builders/win10_chromium_x64_rel_ng_exp/builds/1801/steps/bot_update/logs/stdio
[Mirror] https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.win%2Fwin10_chromium_x64_rel_ng_exp%2F1801%2F%2B%2Frecipes%2Fsteps%2Fbot_update%2F0%2Fstdout

Sometimes repos become corrupt and bot_update fails spectacularly.  This usually happens due to the process being interrupted during a fetch. Git
cache should be able to recover from this by clobbering.

BUG=

Review-Url: https://codereview.chromium.org/2031773002
9 years ago
nodir@chromium.org 5b48e48c1a Set default --lock_timeout to 5m
gclient-sync + git-cache are racy because if two different DEPS files
dependent on the same repo URL, even if depsed to different checkout
dirs, they use same git cache dir. If both checkout dirs are synced at
the same time, one of them cannot acquire a lock.

This is a cheap solution to change --lock_timeout option default value
from 0 to 5m.

R=hinoka@chromium.org
BUG=593468

Review URL: https://codereview.chromium.org/1785083005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299386 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
szager@chromium.org dbb6f8246b Allow blocking git-cache update with a timeout.
I guess I'm the only developer using git-cache, which is sad.
Hopefully these fixes will make it easier to adapt this to developer
usage some time in the FUTURE.

BUG=583420
TEST=Works for me
R=agable@chromium.org,tandrii@chromium.org

Review URL: https://codereview.chromium.org/1650993005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298531 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
szager@chromium.org 66c8b850e4 Allow 'git cache fetch' to re-bootstrap.
With this change, 'git cache fetch' will automatically re-bootstrap
a repo from google storage if the local cache has too many pack
files.  The behavior can be disabled with the --no-bootstrap flag.

BUG=

Review URL: https://codereview.chromium.org/1320383004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296829 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org 8e095af012 Revert of Specify GIT_DIR when running git-config in a mirror. (patchset #4 id:60001 of https://codereview.chromium.org/1167193002/)
Reason for revert:
Potentially broke the NaCl toolchain builders:
crbug.com/498942

Speculative revert.

Original issue's description:
> Specify GIT_DIR when running git-config in a mirror.
> 
> BUG=497894
> R=hinoka@chromium.org,agable@chromium.org
> 
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=295587

TBR=agable@chromium.org,szager@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=497894

Review URL: https://codereview.chromium.org/1179593002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295607 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
szager@chromium.org e877e7beb9 Specify GIT_DIR when running git-config in a mirror.
BUG=497894
R=hinoka@chromium.org,agable@chromium.org

Review URL: https://codereview.chromium.org/1167193002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295587 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
sbc@chromium.org 9d0644d71d Add experimental support for python in 'git cl format'
Based on yapf (https://github.com/google/yapf) this
formatter currently only works with --full.  It defaults
to pep8 style and projects that use a different style
can add .style.yapf to the top level.

Review URL: https://codereview.chromium.org/1156743008

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295547 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
sbc@chromium.org 013731e832 Handle KeyboardInterrupt consistently in python scripts
Handle KeyboardInterrupt gracefully rather the printing a
backtrace. Most users of these tools don't expect a
backtrace when then hit Ctrl-C.

Also, fix a few other inconsistencies found in the python
startup code of these different scripts:
- always call main function 'main' (rather than 'Main')
- always return 0 from main function
- if main takes args never include argv[0]

Review URL: https://codereview.chromium.org/955993006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294250 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
loislo@chromium.org 0fb693ff7c Fix for print(file=something)
BUG=
TBR= dpranke@chromium.org, enne@chromium.org, apavlov@chromium.org

Review URL: https://codereview.chromium.org/829453004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293503 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
loislo@chromium.org 67b59e98dc Speculative fix for build on windows build bots.
The root of problem is a _cache_temp file.
git_cache expected that it is a folder.
So rmtree failed to remove it.

BUG=
TBR= dpranke@chromium.org, enne@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/825133002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293502 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org b091aa575e Switch the remaining third_party gsutil references to gsutil.py
BUG=
R=pgervais@chromium.org

Review URL: https://codereview.chromium.org/809203003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293481 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org 199bc5f92c Use gsutil.py for download_from_google_storage instead of the builtin one
This pins gsutil to a vanilla 4.7 instead of the weird custom 3.4 we have in depot_tools

BUG=
R=pgervais@chromium.org

Review URL: https://codereview.chromium.org/797663003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293413 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org 7b1cb6f56d Run prune in git cache update bootstrap to remove loose objects
BUG=411236

Review URL: https://codereview.chromium.org/545213002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291865 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org 42f9adffd3 Make git cache delete a defunct directory instead of moving it
So the original intention of moving it to a different directory to be deleted later
was to (1) save it for diagnosis (2) be a single inode swap rather than a long
rmtree delete.

1. No one is actually looking at these directories
2. The tmpdir sometimes end up on a different partition, so it ends up being
   a copy + delete instead.  Since we're not getting timeouts from that, its
   probably actually better to just straight up delete it.

BUG=410727

Review URL: https://codereview.chromium.org/538993002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291818 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org a5cda1e5db Remove the old cache dir before moving the bootstrapped cache dir into the real location
Seems like some combination of things (bad cache dir, shallow checkout, etc) causes
git cache to not clean up properly before trying to move new directory A into
already existing directory B.

So the logic is all there to detect that the cache is invalid, its just not
being cleaned up properly during shallow checkouts.

BUG=406864
TBR=iannucci

Review URL: https://codereview.chromium.org/499123002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291587 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 84c560061d Do threading.Lock the Right Way.
R=cmp@chromium.org, dnj@chromium.org, iannucci@chromium.org
BUG=

Review URL: https://codereview.chromium.org/499003002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291573 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org c532504d17 Fix thread lock around cachepath access.
R=cmp@chromium.org, agable@chromium.org
BUG=

Review URL: https://codereview.chromium.org/468253003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291571 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 1132f5f896 Add thread locking around GetCachePath().
BUG=406662
R=cmp@chromium.org, agable@chromium.org

Review URL: https://codereview.chromium.org/469073004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291569 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 965c44f41c Non-destructive editing of git cache config.
R=agable@chromium.org,iannucci@chromium.org
BUG=

Review URL: https://codereview.chromium.org/485663003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@290665 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
pgervais@chromium.org b9f2751b87 Added hyphen-only options
Some options have words separated by underscores. Added options with
same name and underscores replaced by hyphens.

BUG=400953

Review URL: https://codereview.chromium.org/436963005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@288366 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org f314511616 Add 'git cache fetch' subcommand.
If you're in a git checkout cloned from the git cache, this will:
  - Update the cache with the latest upstream commits.
  - Update the cwd with the latest commits from the cache.

For example:

> cd $HOME/workspace/chromium/src
> git cache fetch

R=agable@chromium.org,iannucci@chromium.org
BUG=

Review URL: https://codereview.chromium.org/440213005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@288140 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org 4e2ad84696 Git Cache speculative fix for windows
Git cache sometimes fail on:
Traceback (most recent call last):
  File "E:\b\depot_tools\\gclient.py", line 2064, in <module>
    sys.exit(Main(sys.argv[1:]))
  File "E:\b\depot_tools\\gclient.py", line 2052, in Main
    return dispatcher.execute(OptionParser(), argv)
  File "E:\b\depot_tools\subcommand.py", line 245, in execute
    return command(parser, args[1:])
  File "E:\b\depot_tools\\gclient.py", line 1830, in CMDsync
    ret = client.RunOnDeps('update', args)
  File "E:\b\depot_tools\\gclient.py", line 1342, in RunOnDeps
    work_queue.flush(revision_overrides, command, args, options=self._options)
  File "E:\b\depot_tools\gclient_utils.py", line 852, in flush
    self._run_one_task(self.queued.pop(i), args, kwargs)
  File "E:\b\depot_tools\gclient_utils.py", line 944, in _run_one_task
    task_item.run(*args, **kwargs)
  File "E:\b\depot_tools\\gclient.py", line 744, in run
    file_list)
  File "E:\b\depot_tools\gclient_scm.py", line 160, in RunCommand
    return getattr(self, command)(options, args, file_list)
  File "E:\b\depot_tools\gclient_scm.py", line 387, in update
    self._UpdateMirror(mirror, options)
  File "E:\b\depot_tools\gclient_scm.py", line 802, in _UpdateMirror
    ignore_lock=options.ignore_locks)
  File "E:\b\depot_tools\git_cache.py", line 409, in populate
    os.rename(tempdir, self.mirror_path)
WindowsError: [Error 183] Cannot create a file when that file already exists

It would appear that its being racy, but otherwise it doesn't make any sense.  A theory
is that this could be running twice and stepping on each other.  Allowing this
to pass on OSError allows us to test this theory.

BUG=395333

Review URL: https://codereview.chromium.org/408653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@284272 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org aa1e1a4f2f Have git cache bootstrap repo if repo is corrupt
We're seeing fetches fail in interesting ways:
running "git fetch -v --progress origin +refs/heads/*:refs/heads/*" in "/mnt/scratch0/b_used/build/slave/cache_dir/chrome--internal.googlesource.com-chrome-src--internal"
error: object file ./objects/a1/4bd89aa4cc7d7bbad7594cba0ae73e99dbb54c is empty
error: object file ./objects/a1/4bd89aa4cc7d7bbad7594cba0ae73e99dbb54c is empty
fatal: loose object a14bd89aa4cc7d7bbad7594cba0ae73e99dbb54c (stored in ./objects/a1/4bd89aa4cc7d7bbad7594cba0ae73e99dbb54c) is corrupt
fatal: The remote end hung up unexpectedly

And then the cache becomes corrupted.  This blows the cache away if this happens.

BUG=261741

Review URL: https://codereview.chromium.org/352543003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@280123 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 108eced497 Add --ignore-lock option.
Unfortunately, the locking mechanism is still flaky on Windows.
bot_update.py will use this, since we can be certain that there
won't be overlapping access to the cache.

R=hinoka@google.com, agable@chromium.org, hinoka@chromium.org
BUG=

Review URL: https://codereview.chromium.org/340953003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@278490 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org c8444f3a2d Allow pruning other files when uploading bootstrap tarball
BUG=366748

Review URL: https://codereview.chromium.org/337763005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@278190 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 3341849a69 Don't os.listdir() on a non-existent dir (it raises).
TBR=agable@chromium.org,iannucci@chromium.org
BUG=

Review URL: https://codereview.chromium.org/342753003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@278141 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org b0a13a2a2f Refactor cache-updating code to eliminate unnecessary fetches.
This is an update of the following reverted change:

https://codereview.chromium.org/344443002/

R=hinoka@chromium.org,agable@chromium.org
BUG=

Review URL: https://codereview.chromium.org/343523002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@277931 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 1cbf1048a6 Clean up temp dirs when breaking locks.
A number of bots have been running out of disk space because they
are accumulating temp dirs and temp pack files.  Be more careful
to clean up temp dirs whenever UnlockAll() is called.

R=hinoka@chromium.org,agable@chromium.org
BUG=

Review URL: https://codereview.chromium.org/335253002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@277812 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org 301a7c3dd1 Tweak git gc settings, and periodically re-bootstrap.
BUG=383455
R=hinoka@chromium.org,iannucci@chromium.org

Review URL: https://codereview.chromium.org/331913003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@277473 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
szager@chromium.org cdfcd7cf83 Clean up temporary git pack files when breaking locks.
When a git-cache operation is interrupted, it can leave behind large
temporary pack files.  Over time, these pack files will fill up
disks.

R=agable@chromium.org,hinoka@chromium.org,iannucci@chromium.org
BUG=352268

Review URL: https://codereview.chromium.org/326203003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@276208 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org c58d11dd54 Have git_cache print out download progress when bootstrapping the git cache
BUG=261741,380958

Review URL: https://codereview.chromium.org/325903005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@275872 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org c2bc22d69d Fixed bad arguments to gsutil
boto is required.

BUG=261741
TBR=iannucci

Review URL: https://codereview.chromium.org/315343002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@275244 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago