Running gclient_smoketests times out on windows when using git daemon,
so use a local directory as remote instead.
Bug: 1024683
Change-Id: I6ca506d74de463d914317f176eefbe74996298c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1879723
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Ran:
vi $(git grep --name-only iteritems | grep -v third_party)
vi $(git grep --name-only itervalues | grep -v third_party)
vi $(git grep --name-only 'print ' | grep -v third_party)
and edited the files quickly with adhoc macros. Then ran in recipes/:
./recipes.py test train
There was only a small subset of files that had been updated to use
six.iteritems() and six.itervalues(). Since the dataset size that is
being used in gclient is small (pretty much always below 200 items),
it's better to just switch to .items() right away and take the temporary
performance hit, so that we don't need to come back to rewrite the code.
Recipe-Nontrivial-Roll: build
Bug: 984182
Change-Id: I5faf11486b66b0d73c9098ab0f2ce1b15a45c53e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1854900
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Marc-Antoine Ruel <maruel@chromium.org>
Python doesn't guarantee that the file created by tempfile.NamedTemporaryFile can be opened by multiple programs at once.
This is the case on Windows, so we need to close the temporary PID file and only then pass it to Git.
Bug: 962263
Change-Id: Idf4a36b33ce06d7ab06453c20a690622179aef58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1608560
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
This avoids the need to do the decoding everywhere separately.
Also a small fix for filter() no longer returning a list on Py3.
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: Id0f5153011b2ef1b64394359087864cd9434e45e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595685
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
connect(2) says stream sockets may only succeed to connect once. This means
if the call to sock.connect() fails it will continue failing for the
entirety of the wait loop, and we will fail to wait for a port to bind even
when it eventually becomes available.
Make sure we create a new socket every time we are about to try to connect
to it.
Change-Id: I16d7dbea3590c5bf7f7240bdefcc5ec0bcd1edb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1528291
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
This is a reland of 67ef3f67e8
We no longer call cipd unconditionally.
Original change's description:
> gclient: delete unversioned directory before adding cipd dep for the same path
>
> Bug: 882611
> Change-Id: I46e41cc9693b90874b5d6569a12ec638eaac1050
> Reviewed-on: https://chromium-review.googlesource.com/1228655
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Bug: 882611
Change-Id: I683bfc62bd1eebfec0853583f96f3981c2c6bdf2
Reviewed-on: https://chromium-review.googlesource.com/1232891
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
When a recursive dependency has use_relative_paths it also makes sense
to have the hooks working directory by the dependency's directory.
Otherwise if a hook uses one of the relative dependencies it is impossible
to know which path prefix to use.
However we cannot change the behavior of hooks with use_relative_paths
because it would break existing projects that use_relative_paths but
hardcoded the prefix for hooks. Instead we add a second boolean,
use_relative_hooks that triggers the behavior.
Adds tests for the new behavior and a test for existing interactio
between hooks and recursedeps.
BUG=chromium:875245
Change-Id: Ie4c526baa425ff887b3be54e0feca7c597ededec
Reviewed-on: https://chromium-review.googlesource.com/1213327
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
When a git mirror is configured, it fetches only refs/heads/*,
and possibly branch-heads and tags, but not refs/changes.
When gclient attempts to sync refs/changes/* from a mirror,
it fails, since the mirror has no such objects.
See for example [1], where the DEPS entry for builtools was
modified to sync to a CL, but all the bots failed to sync to it.
This change modifies gclient to always fetch refs/changes/*
directly from the repo, even when a mirror is configured.
[1] https://chromium-review.googlesource.com/c/chromium/src/+/1119098/6
Bug: 858894
Change-Id: I71bb313e4325a81b2985db1d00c70a8844dc7c22
Reviewed-on: https://chromium-review.googlesource.com/1119525
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
crrev.com/c/1097623 broke the official bots because the cipd variable
escaping present in the normal DEPS file wasn't present in the flattened
DEPS file.
Change-Id: Iaae8b95a9d8c5ce0ed80071169e731a24e98b4c4
Reviewed-on: https://chromium-review.googlesource.com/1112935
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Report the dependencies that were not synced, due to their, or their parent's
condition evaluating to False.
Bug: 853010
Change-Id: I375703a1b91e3c3e31e444b0df1c95ecae17b6ba
Reviewed-on: https://chromium-review.googlesource.com/1111113
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This reverts commit c912114140.
Reason for revert: broke patch application on infra/config https://crbug.com/853032
Original change's description:
> gclient_scm: Use cherry-picking instead of rebasing.
>
> We have a problem when in this situation, we checkout |patch| and rebase it on
> top of |base|, thus including an |extra commit| that we shouldn't.
>
> o master
> |
> . o patch
> |/
> o extra commit
> |
> o base (what gclient synced src at)
>
> This does merge-base between |patch| and |master|, and cherry-picks only the
> changes belonging to the patch.
>
> Bug: 850812
> Change-Id: Id09ae1682e53b69ed49b2fb649310de6a6a8a29e
> Reviewed-on: https://chromium-review.googlesource.com/1098228
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>
TBR=agable@chromium.org,ehmaldonado@chromium.org
Change-Id: Ib3feeee2f44f5441713383f1dbf08db16fae4717
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850812, 853032
Reviewed-on: https://chromium-review.googlesource.com/1101977
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
We have a problem when in this situation, we checkout |patch| and rebase it on
top of |base|, thus including an |extra commit| that we shouldn't.
o master
|
. o patch
|/
o extra commit
|
o base (what gclient synced src at)
This does merge-base between |patch| and |master|, and cherry-picks only the
changes belonging to the patch.
Bug: 850812
Change-Id: Id09ae1682e53b69ed49b2fb649310de6a6a8a29e
Reviewed-on: https://chromium-review.googlesource.com/1098228
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
This is a reland of e877b1776a
Original change's description:
> gclient: Get rid of parsed_url.
>
> There is no reason I can see to set parsed_url so late.
> Also, the tests are misleading, since relative URLs don't behave the way
> the tests led you to believe.
>
> Bug: 839925
> Change-Id: I08d92b7b7847bdc406f003d4a4139d968cc662b1
> Reviewed-on: https://chromium-review.googlesource.com/1047797
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
TBR=agable@chromium.org
Bug: 839925
Change-Id: I9200ec5fbe7289022e9754f0c78676dc931fcaeb
Reviewed-on: https://chromium-review.googlesource.com/1054567
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Suspected of breaking the world.
This reverts commit e877b1776a.
TBR=ehmaldonado@chromium.org,tandrii@chromium.org
Bug: 841936
Change-Id: Iad2b55a2235d8d0b1a3d7681cbd577f795cb89dd
Reviewed-on: https://chromium-review.googlesource.com/1054440
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
There is no reason I can see to set parsed_url so late.
Also, the tests are misleading, since relative URLs don't behave the way
the tests led you to believe.
Bug: 839925
Change-Id: I08d92b7b7847bdc406f003d4a4139d968cc662b1
Reviewed-on: https://chromium-review.googlesource.com/1047797
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Previously, 'gclient sync' would process "gn_args" settings in any
recursed DEPS files, potentially producing multiple output files or
conflicting output files, but 'gclient flatten' would only ever include
one set of "gn_args" settings in the flattened output, and only if they
occurred in the top-level DEPS file.
This makes 'gclient sync' and 'gclient flatten' more consistent by
restricting them both to a single instance of those setting, and
requiring those setting to be defined either in the top-level DEPS file,
or in a recursedeps file specificed by the new 'gclient_gn_args_from'
setting.
R=dpranke@google.com, ehmaldonado@google.com
Bug: 825063
Change-Id: If90d952e47367c50b36daade16a26b29aec0c9db
Reviewed-on: https://chromium-review.googlesource.com/1039870
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Michael Moss <mmoss@chromium.org>
This fixes an issue where cumulative conditions would fail to evaluate
if the recursed DEP (or custom_var overrides) didn't happen to redeclare
all the variables used by the parent conditions.
TBR=dpranke@google.com, ehmaldonado@google.com
Bug: 825063
Change-Id: Icb53f04928f914dfacc2c3035d01be103d9f8247
Reviewed-on: https://chromium-review.googlesource.com/1000836
Commit-Queue: Michael Moss <mmoss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
This is useful for processing purely "local" DEPS files, with a command-line like:
gclient revinfo --output-json /tmp/out \
--spec 'solutions=[{"name": ".", "deps_file": "myDEPS", "url": None}]'
This is specifically to fix the "revinfo --output-json" case, but it
also cleans up some errors in the 'flattening' test cases. Note that
None values already work when using 'revinfo' with stdout output, it's
just the json output that complains.
BUG=825063
Change-Id: If5f69ba51cb9d0aa0f2b48a2f9b4ed8706b4c738
Reviewed-on: https://chromium-review.googlesource.com/989022
Commit-Queue: Michael Moss <mmoss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Mimics bot_update's functionality to apply gerrit refs in gclient
via --gerrit-ref flags.
When the patch fails to apply, gclient sync will return exit code 2.
The idea is to move this logic from bot_update to gclient sync to
deal when patches for projects like ANGLE are tried on Chromium bots.
This way the patch is applied before recursively parsing and syncing
ANGLE’s DEPS.chromium file, which doesn't currently happen.
Bug: 643346
Change-Id: I7e2018b3c393a5ac9852b8c3611f906977eeeb18
Reviewed-on: https://chromium-review.googlesource.com/961605
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Previously, gclient would attempt to write an args file after
a dependency was checked out, but before any sub-dependencies
had been checked out. If the args file path pointed at something
inside a sub-dependency, this wouldn't work, because the directory
might not yet exist. This most obviously happened for buildspec
clobber builds.
The fix is to wait until after the sub-dependencies have been
checked out to write the file.
R=phajdan.jr@chromium.org, mmoss@chromium.org
BUG=773933
Change-Id: I0cf4564204f7dabd9f843dc7904db7050fcc0d23
Reviewed-on: https://chromium-review.googlesource.com/714644
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
We need to pass OS info to recursively called _flatten_dep.
Regular deps entries in OS-specific DEPS file recursed into
need to be marked as OS-specific in the flattened file.
Bug: 570091
Change-Id: If3055b84143d8a52d10d8753113893b5054b4d07
Reviewed-on: https://chromium-review.googlesource.com/621046
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Bug: 570091
Change-Id: I773b74b042233efa2a525f5f47e920468b7fea4a
Reviewed-on: https://chromium-review.googlesource.com/618930
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
This finally makes the code structure seem right as well: there's just
one method (_flatten_dep), with a simpler control flow.
Also added a regression test.
Bug: 570091
Change-Id: I22ac7a3af0429a7ffd874b4b1715c0f6c72e0006
Reviewed-on: https://chromium-review.googlesource.com/608241
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Nice side-effect of this change is simplifying the code.
Also added regression test coverage.
Bug: 570091
Change-Id: I470e9efc319632f997b02d210483988c17a7d3c8
Reviewed-on: https://chromium-review.googlesource.com/600369
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
This is an exact reland of https://chromium-review.googlesource.com/583617 .
One of the main use cases is making it clear which revision hashes
need to be changed together. The way it's usually done is one variable
referenced several times. With this CL, we preserve the references
from original DEPS, as opposed to evaluating them and losing some info.
This CL actually makes Var() emit a variable placeholder
instead of its value, and adds support for these placeholders
to gclient.
One of possible next steps might be to deprecate Var().
Bug: 570091, 748486
Change-Id: Id47e3771b7163149a4cd427b84f84ece52772f34
Reviewed-on: https://chromium-review.googlesource.com/586594
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
This reverts commit e79ddeaabf.
Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=748486
Original change's description:
> gclient flatten: preserve variable placeholders
>
> One of the main use cases is making it clear which revision hashes
> need to be changed together. The way it's usually done is one variable
> referenced several times. With this CL, we preserve the references
> from original DEPS, as opposed to evaluating them and losing some info.
>
> This CL actually makes Var() emit a variable placeholder
> instead of its value, and adds support for these placeholders
> to gclient.
>
> One of possible next steps might be to deprecate Var().
>
> Bug: 570091
> Change-Id: I9b13a691b5203cc284c33a59438720e31c9ebf7a
> Reviewed-on: https://chromium-review.googlesource.com/583617
> Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
TBR=phajdan.jr@chromium.org,dpranke@chromium.org
Change-Id: If9c52ebfa78aba8041ce797ff842d09952d0e2ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 570091, 748486
Reviewed-on: https://chromium-review.googlesource.com/584907
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
One of the main use cases is making it clear which revision hashes
need to be changed together. The way it's usually done is one variable
referenced several times. With this CL, we preserve the references
from original DEPS, as opposed to evaluating them and losing some info.
This CL actually makes Var() emit a variable placeholder
instead of its value, and adds support for these placeholders
to gclient.
One of possible next steps might be to deprecate Var().
Bug: 570091
Change-Id: I9b13a691b5203cc284c33a59438720e31c9ebf7a
Reviewed-on: https://chromium-review.googlesource.com/583617
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Added a regression test. Simplified some logic - if we don't add os-specific
deps and hooks to |dependencies|, we don't need to keep separate original values.
Bug: 570091
Change-Id: I5bdd0b6a66df6b3a2b99d0ad9c6e54ee7114f09b
Reviewed-on: https://chromium-review.googlesource.com/581687
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>