Commit Graph

2232 Commits (c3daf77a40e8ba8269c57294ae94e45c96cd32c7)

Author SHA1 Message Date
Joanna Wang 5400d9ef5a Add ListSubmodules helper for presubmits.
We need this for this presubmit otherwise we cannot remove git deps from DEPS: http://shortn/_P7Xkt33SRx
We will also be able to reuse this and replace: http://shortn/_WYBIUC9pa4

Bug: 1475770
Change-Id: I4cea689d130df77c344d82d4d8f9db02d42cd847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5209098
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Brian Ryner 60d2ba87c3 Update cipd_bootstrap_test to use a newer cipd client binary.
The previous binary was so old that it does not work on recent
versions of macOS.

Note that `cipd selfupdate-roll` requires the cipd package to exist
at the given tag for all platforms that the package has ever been
built for. Therefore, I'm using a revision after the latest platform
was added to the builders.

Change-Id: I865c31a5e3823ffc344bcb6585a29935ef6214a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5191588
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Auto-Submit: Brian Ryner <bryner@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 312cd0453c Reland^3 "Upgrade python to 3.11"
This is a reland of commit 6a9dd48b27

Bug: 1500415
Change-Id: I9de26bf55de10da15d7c809cc9223b36b7ae31f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5189582
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 783c919a44 Revert "Upgrade python to 3.11"
This reverts commit 6a9dd48b27.

Reason for revert: breaks release branches

Original change's description:
> Reland "Reland "Upgrade python to 3.11""
>
> This is a reland of commit 32c1207c9e
>
> Original change's description:
> > Reland "Upgrade python to 3.11"
> >
> > This is a reland of commit 6a167d1e1f
> >
> > Original change's description:
> > > Upgrade python to 3.11
> > >
> > > R=bryner
> > >
> > > Bug: 1500415
> > > Change-Id: Ie379744131f7a9ced204a31f21079cb697c889a6
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030767
> > > Reviewed-by: Brian Ryner <bryner@google.com>
> > > Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
> >
> > Bug: 1500415
> > Change-Id: I0cce81772186a26c3bdb67c5b49ce383b8a1443e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5118884
> > Commit-Queue: Peter Wen <wnwen@chromium.org>
> > Reviewed-by: Brian Ryner <bryner@google.com>
>
> Bug: 1500415
> Change-Id: I01872caa1bb0bf75e3696edb7bb07dc33aeb6ce6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5165860
> Reviewed-by: Brian Ryner <bryner@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 1500415
Change-Id: I55a6f75d1003bcbc2236cf15c6e556f1ed842b92
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5170270
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 6a9dd48b27 Reland "Reland "Upgrade python to 3.11""
This is a reland of commit 32c1207c9e

Original change's description:
> Reland "Upgrade python to 3.11"
>
> This is a reland of commit 6a167d1e1f
>
> Original change's description:
> > Upgrade python to 3.11
> >
> > R=bryner
> >
> > Bug: 1500415
> > Change-Id: Ie379744131f7a9ced204a31f21079cb697c889a6
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030767
> > Reviewed-by: Brian Ryner <bryner@google.com>
> > Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
>
> Bug: 1500415
> Change-Id: I0cce81772186a26c3bdb67c5b49ce383b8a1443e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5118884
> Commit-Queue: Peter Wen <wnwen@chromium.org>
> Reviewed-by: Brian Ryner <bryner@google.com>

Bug: 1500415
Change-Id: I01872caa1bb0bf75e3696edb7bb07dc33aeb6ce6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5165860
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Gavin Mak edba22d4eb Fix multiline comment formatting
Many incorrectly formatted comments exist from the switch to
4 space indent: https://crrev.com/c/4836379

Bug: 1514505
Change-Id: I6366f9da812919bd35b999f18fa8a49b7a66c09b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5153633
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 31a590e0cd [scm] Cache ResolveCommit call
The cache won't be used if ResolveCommit throws an exception or when
non-sha1 is used.

This optimization saves about 7% of overall gclient sync on
chromium/src.

R=gavinmak@google.com

Change-Id: I9c36d937dc7b8553818888e2e9c4eecd029a978c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5147496
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 1bdc5c8db4 [presubmit] Don't replace os.environ
Assigning os.environ the result of os.environ.copy() replaces it
with a standard dict. This breaks reflection into the actual
environment, as well as features such as case-insensitivity on
Windows, leading to undefined standard library behavior.

R=bryner, gavinmak

Bug: 1511316
Change-Id: I63d026387104ae92669256567854f8bf9d2397a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5133887
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Brian Ryner <bryner@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
1 year ago
Helmut Januschka 6444de14d1 fix crash in case HEAD exists as a file
Bug: 1428373
Change-Id: If9d988d542345dbfa0e02f7c3d6f935b48372df4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5018937
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Helmut Januschka <helmut@januschka.com>
1 year ago
Ben Pastene d6aaf4522a Revert "Reland "Upgrade python to 3.11""
This reverts commit 32c1207c9e.

Reason for revert: spec reverting for `FileNotFoundError: shell not found` errors on win-presubmit
https://ci.chromium.org/ui/p/chromium/builders/try/win-presubmit?limit=200
eg
https://ci.chromium.org/ui/p/chromium/builders/try/win-presubmit/377708/overview

Original change's description:
> Reland "Upgrade python to 3.11"
>
> This is a reland of commit 6a167d1e1f
>
> Original change's description:
> > Upgrade python to 3.11
> >
> > R=bryner
> >
> > Bug: 1500415
> > Change-Id: Ie379744131f7a9ced204a31f21079cb697c889a6
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030767
> > Reviewed-by: Brian Ryner <bryner@google.com>
> > Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
>
> Bug: 1500415
> Change-Id: I0cce81772186a26c3bdb67c5b49ce383b8a1443e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5118884
> Commit-Queue: Peter Wen <wnwen@chromium.org>
> Reviewed-by: Brian Ryner <bryner@google.com>

Bug: 1500415
Change-Id: Ic57bdd4919f44b38b7edc334dc7e504e19256067
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5119766
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Brian Ryner <bryner@google.com>
1 year ago
Josip Sokcevic 32c1207c9e Reland "Upgrade python to 3.11"
This is a reland of commit 6a167d1e1f

Original change's description:
> Upgrade python to 3.11
>
> R=bryner
>
> Bug: 1500415
> Change-Id: Ie379744131f7a9ced204a31f21079cb697c889a6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030767
> Reviewed-by: Brian Ryner <bryner@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 1500415
Change-Id: I0cce81772186a26c3bdb67c5b49ce383b8a1443e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5118884
Commit-Queue: Peter Wen <wnwen@chromium.org>
Reviewed-by: Brian Ryner <bryner@google.com>
1 year ago
Josip Sokcevic 18bb70aed6 Revert "Upgrade python to 3.11"
This reverts commit 6a167d1e1f.

Reason for revert: https://crbug.com/1511105

Original change's description:
> Upgrade python to 3.11
>
> R=bryner
>
> Bug: 1500415
> Change-Id: Ie379744131f7a9ced204a31f21079cb697c889a6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030767
> Reviewed-by: Brian Ryner <bryner@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 1500415
Change-Id: I8d0b04ca679c1581d4572e89efbb8cf2012cfa78
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5118878
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
1 year ago
Josip Sokcevic 6a167d1e1f Upgrade python to 3.11
R=bryner

Bug: 1500415
Change-Id: Ie379744131f7a9ced204a31f21079cb697c889a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030767
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Takuto Ikuta aa65be9856 autoninja: cache negative result of gcloud account check
This is to remove 1~3 seconds from no-op build using autoninja.

Bug: b/309720176
Change-Id: I2c15a43517d5a99eae794015c18c884a3f3fdef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5092847
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
1 year ago
Aravind Vasudevan 259774c3ac [gclient_scm] Update _CheckClean() to use `git status`
This change updates the `_CheckClean()` fn to use `git status` instead
of `git update-index` and `git diff-index`. The `_CheckClean()` fn is
run during every update and this change reduces the subprocess calls
made by it by half.

Change-Id: Ie9a23b0bce748bec4cac88df09655569e88e4841
Bug: 1501984
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5076224
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
1 year ago
Takuto Ikuta cccca95d8f Revert^2 "autoninja.py: disallow external account from corp machine"
This reverts commit ed596dadf9.

Reason for revert:
Ignore exception when getting account for application default
credentials.

Original change's description:
> Revert "autoninja.py: disallow external account from corp machine"
>
> This reverts commit 0d0f28a4fc.
>
> Reason for revert:
> http://b/309720176#comment7
>
> Original change's description:
> > autoninja.py: disallow external account from corp machine
> >
> > This disallows Googler to use non-google account with reclient and
> > siso from corp machine.
> >
> > Bug: b/309720176
> > Change-Id: I8077eff8bbf47f579462e1fefa3609a5d492a013
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5035266
> > Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> > Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
>
> Bug: b/309720176
> Change-Id: I62b4891b1e2e2554d088d162057982b95c8adcd7
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5065849
> Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> Owners-Override: Takuto Ikuta <tikuta@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: b/309720176
Change-Id: Ib9aef1b7fa8e3c9bb20ac8d6b461c6bcff72dc83
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5065052
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
1 year ago
Aravind Vasudevan 8197d724a6 [detect_host_arch] Cache HostArch() function
From my recent go/gclient-sync-no-ops analysis, I noticed that
HostArch() is repeated called within get_builtin_vars() fn. The
`platform.architecture()` call made in arm-based systems and some x64 is
expensive and adds to gclient sync's runtime when repeatedly called.

When caching HostArch(), I noticed 22.4% speed-up in incremental no-op
gclient sync when run on arm-based machine.

Change-Id: I962c4fb0879d2931268f5bec1678ef782c56e7f2
Bug: 5076224
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5076226
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Takuto Ikuta b5393e57bb ninjalog_uploader.py: use cipd to check authenticated account
Googlers authenticate with CIPD now to use reclient.

This is for
https://crrev.com/c/5035266/20#message-6bcb2d14f6758d0ba82d5cff99d699985c934707

Change-Id: Ie78675e6f7a8b47f7cafd85141f87139d1472f1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5058275
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
1 year ago
Takuto Ikuta ed596dadf9 Revert "autoninja.py: disallow external account from corp machine"
This reverts commit 0d0f28a4fc.

Reason for revert:
http://b/309720176#comment7

Original change's description:
> autoninja.py: disallow external account from corp machine
>
> This disallows Googler to use non-google account with reclient and
> siso from corp machine.
>
> Bug: b/309720176
> Change-Id: I8077eff8bbf47f579462e1fefa3609a5d492a013
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5035266
> Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>

Bug: b/309720176
Change-Id: I62b4891b1e2e2554d088d162057982b95c8adcd7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5065849
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Owners-Override: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
1 year ago
Takuto Ikuta 0d0f28a4fc autoninja.py: disallow external account from corp machine
This disallows Googler to use non-google account with reclient and
siso from corp machine.

Bug: b/309720176
Change-Id: I8077eff8bbf47f579462e1fefa3609a5d492a013
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5035266
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
1 year ago
Michael Savigny af69249965 Fix deletion of old build logs
The code rotating the old build logs expects to delete directories
(since it uses rmtree) but tries to delete all items returned by
os.listdir(...) which may includes symbolic links or regular files.

Change it to only consider the old build logs directories instead.

Based on crrev/5028323, with fix to unit test.

Fixed: b/310900283
Change-Id: I4c618e6618c0193331c063028ebf02d8c4e7baee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5038467
Auto-Submit: Michael Savigny <msavigny@google.com>
Reviewed-by: Ramy Medhat <abdelaal@google.com>
Commit-Queue: Michael Savigny <msavigny@google.com>
1 year ago
Josip Sokcevic f1cbc0c0b5 tests: Skip tests for old stacked changes flow
R=jojwang

Bug: 5030767
Change-Id: I8e9ff580404f386b9ad8bbeac2328e6228afbe63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5033924
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
1 year ago
Josip Sokcevic 4cf6518959 scm: Remove usage of distutil
The package is deprecated and will be removed in py 3.12.

R=ddoman@google.com

Bug: 1500415
Change-Id: Ia130c556ad3f2135fac4a9b1d9bb4ecc088cfe9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030818
Reviewed-by: Scott Lee <ddoman@chromium.org>
Reviewed-by: Jonathan Nieder <jrn@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Commit-Queue: Jonathan Nieder <jrn@google.com>
1 year ago
Josip Sokcevic 88cc0b8ca8 Remove old Cog detection
This is no longer needed.

R=aravindvasudev@google.com

Change-Id: Ic1b2bbf0f00ca9d288c21fa1623c4ada80d59644
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5014581
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Josip Sokcevic a309d29905 Remove .git suffix from git submodules
.git suffix is not well supported by the systems that utilize
submodules. Since some tools expect DEPS to have .git suffix, it's not
possible to simply update DEPS without breaking the tools.

This patch updates `gclient gitmodules` to omit .git suffix and trailing
slashes. However, if `.gitmodule` already exists, we are expecting the
tool to generate the same result if DEPS didn't change.

R=aravindvasudev@google.com

Bug: b/303296048
Change-Id: I30497b9d5f4e9681e16b4a913151de0f4a7c9545
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5008942
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Aravind Vasudevan a413ee7249 [gsutil.py] Skip luci-auth wrapper on unsupported platforms
On unsupported platforms, luci-auth is not downloaded from CIPD and
hence the scripts relying on gsutil.py fail. Given we aren't using
luci-auth in unsupported platforms anyway, skip wrapping gsutil with
luci-auth on unsupported platforms.

Curently, only "aix" is added to the unsupported platforms list
eventhough we have other unsupported platforms too. This list will be
expanded if necessary.

R=yiwzhang

Change-Id: I70f6fceddc672c76bbea9a108a75b84662e26459
Fixed: 1467752
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4989412
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
2 years ago
Yiwei Zhang 23c4defd8d fetch: stop setting submodules config as we are not using it at all
R=sokcevic

Bug: 1496925
Change-Id: I448fb1f49b225d1a5f60103dbbcacaea2c69bd9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4995365
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Takuto Ikuta 00777b41d5 reclient_helper: simplify tests
This is followup CL for https://crrev.com/c/4916355.

Bug: b/300945159
Change-Id: I27ee47e8b66671aba81d73347f9d5ebe77a098f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4975086
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
2 years ago
Takuto Ikuta 5388959fd7 reclient_helper: delete directory synchronously
This is for
https://crrev.com/c/4916355/8/reclient_helper.py#177

Let me use synchronous directory deletion as reclient doesn't produce
many log files.

Change-Id: I44f616c9d825bc6b9dbeea329ca1db00a578a9fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4988347
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Michael Savigny <msavigny@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
2 years ago
Ben Segall 27ea34f94e [reclient] Keep previous 5 builds worth of logs
Test: Updated unit tests

Bug: b/300945159
Change-Id: Id0ce3471be17ab05dbef8e3091333149bd9bde6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4916355
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Michael Savigny <msavigny@google.com>
2 years ago
Philipp Wollermann 0b943400a4 Execute Ninja / Siso directly from autoninja.py.
Instead of printing a command-line, we just directly call into the respective main functions from Python. This saves spawning another interpreter and prevents things that can go wrong from having to quote, unquote, split and tunnel arguments through shells.

Part of my bigger auto{ninja,siso} refactoring.

Tested:
- Handling of the ^^ suffix on Windows still works correctly.
- Handling of error codes - i.e.; making sure
  "autoninja base_unittests && base_unittests.exe" behaves properly
  in the success/failure case.
- Make sure the command prompt title is reliably reset on exit.

I tested autoninja with all combinations of these:
- Host platform: Linux, macOS, Windows
- Remote GN args: <none>, use_goma=true, use_remoteexec=true
- Siso GN args: <none>, use_siso=true
- Targets: base, ../../base/types/expected_macros_unittest.cc^ (on Linux) and ../../base/types/expected_macros_unittest.cc^^ (on Windows)

R=brucedawson@chromium.org, jwata@google.com, tikuta@chromium.org

Bug: b/293657720
Change-Id: I275a775fdc5abb6555f79d4beab76cd0914d4bd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4924185
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Philipp Wollermann <philwo@chromium.org>
2 years ago
Philipp Wollermann aabd869daf autoninja.py: Add unit test for gn_lines with 100% coverage
Part of my bigger auto{ninja,siso} refactoring.

R=brucedawson@chromium.org, jwata@google.com, tikuta@chromium.org

Bug: b/293657720
Change-Id: I5c228ecf9910b0a8ce18afc816f213f08b941299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4924715
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Philipp Wollermann <philwo@chromium.org>
2 years ago
Joanna Wang 60adf7b6d9 sync: Ensure child dependencies are always removed first.
Fixed: chromium:1454643, chromium:1486677
Change-Id: I3f8f5f9a2e2419830e94fa1419292717820830c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4914238
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Takuto Ikuta 1553f03225 remove unnecessary file writes from tests
Change-Id: Ic6da86d05ac29d13c727a1fbe1229e45a846cb14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4905171
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
2 years ago
Yuanjun Huang 5dffbd43c4 [config] change to use luci-config v2 in presubmit
In `CheckChangedLUCIConfigs`, it will call luci-config to list all
config sets. Change that call to v2.

Change-Id: I7a00d157fa631174b2124f0920026fa6b1fea04c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4900076
Commit-Queue: Yuanjun Huang <yuanjunh@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2 years ago
Andrew Grieve 6e8c18239d Cache values in gclient_paths.py
Several clients of this module call its methods repeatedly. Cache them
to speed them up.

E.g. "autosiso" calls FindGclientRoot() 5 times before building
E.g. "git cl format" calls it 5 times in one of my CLs.

Bug: None
Change-Id: I70995c2def9689d46a89896640cc748d9629df3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4904697
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Yuanjun Huang 4c1d6d90bc [auth] Be able to generate id_token
Make auth be able to generate id_token. Some services on Cloud Run will
need it (e.g. luci-config v2).

Bug: 1487020
Change-Id: Icfe95002f93ee552b99ab2694c7b777e2322484b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4899437
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yuanjun Huang <yuanjunh@google.com>
2 years ago
Maggie Chen 34e0ecf20e Change from PresubmitError to PresubmitWarning for bad license
We cannot distinguish if this is a moved third-party file. So just
do warnings for a license header from a third-party company.

Bug: 1462922
Change-Id: I78394dcccb9028bce6c535dfce625364dd29157b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4895337
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
2 years ago
Eli Trexler 8609345923 Revert "Clear existing Change-Ids from description if issue is 0"
This reverts commit 36d937d16d.

Reason for revert: Not sure the best way to notify you about this, but suspect this is the root cause of https://chat.google.com/room/AAAAXGgrwSo/hZDeSAsoQ4k

Verified via rolling back depot_tools

Original change's description:
> Clear existing Change-Ids from description if issue is 0
>
> git cl upload may not create a new change even if issue is 0 because
> of a leftover Change-Id footer in the commit message.
>
> Bug: 1484251
> Change-Id: Ibee0542e0f5a2cbf930b1882892fbb7640054b69
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4880971
> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1484251
Change-Id: Ic3230fd7432f57bf9f3d0266b2e2c0df6a7e9bae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4893199
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2 years ago
Gavin Mak 36d937d16d Clear existing Change-Ids from description if issue is 0
git cl upload may not create a new change even if issue is 0 because
of a leftover Change-Id footer in the commit message.

Bug: 1484251
Change-Id: Ibee0542e0f5a2cbf930b1882892fbb7640054b69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4880971
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Josip Sokcevic d95084e851 Adjust fsmonitor alert for Mac
Version 2.43 contains a fix for fsmonitor. Google managed git already
contains the fix.

R=aravindvasudev

Fixed: 1475405
Change-Id: I388b1e14e070595b8b0c6bca046dd3af2248a0ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4892305
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
2 years ago
Gavin Mak f936d540e1 Remove __future__ imports
All __future__ imports (unicode_literals, print_function) are already
mandatory in py3. Also remove an outdated py2 comment in
presubmit_canned_checks.py

Bug: 1475402
Change-Id: I27cf6a8268f6dd1081f22af782c4c29a975376ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4867135
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Joanna Wang 8572d4bdcd Require prompt from users to confirm submodules commit.
Bug: 1481266
Change-Id: Ib840d6e472e3709919518a294e5489ba099a6188
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4875411
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
2 years ago
Gavin Mak 50b27a5308 Add gclient installhooks to add pre-commit hook
With submodules, users can accidentally stage and commit gitlink
changes. Add a new gclient command to install a pre-commit hook to
automatically drop gitlink changes that don't correspond to a DEPS
change.

Dropping gitlinks can be bypassed by setting
SKIP_GITLINK_PRECOMMIT=1.

Bug: 1481266
Change-Id: Idd8b273e7d8e37d52627964e8ed6004d068b6b7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4863221
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Josip Sokcevic 3b9212b7ee [gclient_scm] Disable push recurseSubmodule
This option can lead to high `git cl upload` latency. We never want to
use this option for gclient managed repositories anyways since changes
need to go through code review.

Note: the default value is off, but it will be set to on if
`submodule.recurse` is set to true.

R=jojwang@google.com

Bug: b/299969165
Change-Id: I2173a2d96d478bf96bfe6e78ef0c5b21d4ac8015
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4874177
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Bruce Dawson 30c1cba02f Handle import statements in args.gn files
Did you know that args.gn files can have import statements and
conditionals? I did not, but apparently some developers make use of both
of these.

Supporting import statements is not too hard, so this change adds this
support. Supporting conditionals is possible, but risks turning
autoninja into a turing complete language which is more than I think we
want to do.

This doesn't use the similar code in tools/mb/mb.py because that
code is complex, and relies on the script location to find the src
directory.

This change also updates two of the existing test conditionals that
were not quite sufficient - ninja/autoninja default to num-cores
plus 2 so > cpu_count() is actually not sufficient to prove
anything.

Bug: 1482404
Change-Id: I0539d8068af59d11927cbdad260278a24ab912e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4864898
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
2 years ago
Anne Redulla 80226254ea [ssci] Modify metadata versioning info validation
This CL changes what is considered valid versioning info. Instead of
both Date and Revision being required if Version was unknown, now only
one of Date or Revision has to be specified.

Bug: b:277147404
Change-Id: Iedb06e2d55f0cd0ef0a2931013a2a52b15befd75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4852699
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Anne Redulla <aredulla@google.com>
Reviewed-by: Rachael Newitt <renewitt@google.com>
2 years ago
Yiwei Zhang 7a69b031d5 presubmit: support checking new TODO format
R=sokcevic

Bug: 1479023
Change-Id: I6eabb16447526fbc8de83b823763888aff1a8249
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4847314
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
2 years ago
Joanna Wang 56ee228caf Reland "Remove unnecessary notify=None from git cl upload."
This reverts commit cea35a3f77.

Reason for revert: b/298657697 is unrelated to this

Original change's description:
> Revert "Remove unnecessary notify=None from git cl upload."
>
> This reverts commit 7688e78450.
>
> Reason for revert: afaict there is a gerrit notifications bug b/297928626 unrelated to this change but i'm reverting this anyway and relanding when the gerrit bug is resolved.
>
> Original change's description:
> > Remove unnecessary notify=None from git cl upload.
> >
> > This is a NOOP change for all cases except for "Publish comments on push" which gets fixed with this CL.
> > Our hosts have the notify on each patchset turned off.
> >
> > Bug: 1472724
> > Change-Id: I3672c383b1e4ca1f6243c9b9d2c906473f5037d9
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4797981
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > Commit-Queue: Joanna Wang <jojwang@chromium.org>
>
> Bug: 1472724
> Change-Id: I3de1a25fe84a21a2adb8b4bbddb460dd45530418
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4817767
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Joanna Wang <jojwang@chromium.org>

Bug: 1472724
Change-Id: I63cdb99111ae89eb6edd5172d827f84b314c015e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4852217
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak 7f5b53ff8d Remove last py2 workarounds
python3 is the only supported version of python in depot_tools.

Changes include:
  * updating python version requirements
  * removing third_party/six

Bug: 1475402
Change-Id: Ib86231413fcac494ceb27d1783e53b9d86533c26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4845292
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago