Currently using a license in the WITH_PERMISSION_ONLY list will create a
warning. By making an ALL_LICENSE list including this list and also
allowing it when checking for open source compatible licenses, it will
no longer create warnings.
This will enable us to change the current warnings into errors.
Bug: b/388620886
Change-Id: I883a3d3c825f0f1903b62d0b93810218b1f42bb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6188501
Commit-Queue: Jordan Brown <rop@google.com>
Reviewed-by: Rachael Newitt <renewitt@google.com>
Unfixed when we migrated Gerrit auth to git-credential-luci
Bug: b/342261857
Change-Id: I6660f03de830337b14b822a0245f6e0d18a58366
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6174308
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
There's some confusion on what account to use to login. Add the
context for Gerrit to hopefully make it a bit easier to decide.
Bug: b/342261857
Change-Id: Ie59b156c2a91f8168bcd2f381f85fb8157040d80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6178581
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
If the user uses SSO (and thus has SSO rewrite rules) for their global
config, a repo which locally uses an email that doesn't use SSO needs
an override.
Bug: b/390219533
Change-Id: I639dae4c1a45bbd2c17180855c22260979b0dbc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6177780
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
Adding a special entry for dependencies using this license id.
The Android Software Development Kit License is a special case.
It can introduce licensing complexities due to the potentially extensive
transitive dependency chain. Developers should carefully review the
licenses of all dependencies.
Change-Id: I8626391ce04f921a9efa519a5305afce62a5f1c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6174215
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Jordan Brown <rop@google.com>
The documentation aims to cover how to make, and review changes to this file.
Change-Id: I887ce938df71119f5d04f7cec30350beddcdef47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168292
Commit-Queue: Jordan Brown <rop@google.com>
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Rick Byers <rbyers@chromium.org>
This change introduces a new error for license fields that use any of
the following `["/", ";", " and ", " or "]`.
I chose to include the offending character/s in the error message
because I find it easier to parse error messages that tell me exactly
which character is the bad one. Similarly I've included conditions in
the reason to handle the plural cases correctly, generating either:
`License contains a bad delimiter character ...`, or
`License contains bad delimiter characters ...`
I realise this means that any downstream rules looking to detect this
error will need to check for a common subset, e.g 'bad delimiter
character', however I think it's worth it for the improved user
experience of receiving the error.
I've also anticipated that most of these errors will be due to
situations where multiple licenses are offered, and included additional
text explaining that only the most permissive of the choices should be
included.
This will affect 9 dependencies and they need to choose between multiple licenses anyway so it's okay to generate an error and have partybug file bugs.
Bug: http://b/374850412
Change-Id: I6eb53a8a3bd541a1801dff133884b719dcdfe04d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6181848
Reviewed-by: Jiewei Qian <qjw@chromium.org>
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Jordan Brown <rop@google.com>
This is a reland of https://crrev.com/c/6168707 with fixes.
The CL adds a new param, unified, to git_diff() and create_diffs()
as a required param.
The functions themselves are tested in presubmit_diffs_test.py, but
their usages in presubmit_support.py were not, and the missing param
caused a failure in CiderG (b/389876151)
This CL basically carries the same patch, but makes the params
optional with a default value and adds unit tests for the usage
in presubmit_support.py
Tested with CiderG: https://screenshot.googleplex.com/PYEDZ3NGn5cYGtV
Change-Id: Ic747c6a133c016dbcd80034e521c76a3db3a3f60
Bug: 389876151, 379902295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6182703
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Gary Tong <gatong@chromium.org>
RunHook being called at the beginning of the git cl upload command, is necessary for non-squash mode, but is an extra and unnecessary call for squash mode. This Runhook call can be moved later down the call stack as well, but would require a lot more changes to tests (in what needs to be mocked)
Change-Id: I0373c5de84d98c4e8c39dece95a247227562ab82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6181588
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Adds "BLAS", "LicenseRef-base64-cpp", and "SolarDesigner", to the allow
listed licenses.
Bug: 365320654
Change-Id: Id156b2cc881167e4dac88a9e671b21e5de8263bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172448
Reviewed-by: Jordan Brown <rop@google.com>
Commit-Queue: Jordan Brown <rop@google.com>
Sometimes I want to add a message without touching the attention set.
The default review call will automatically update it regardless. Add
a flag to explicitly control behavior.
Test:
# No attention set option.
$ ./gerrit_client.py ...
-> ignore_automatic_attention_set_rules not included in body of request
$ ./gerrit_client.py ... --automatic-attention
-> body has {'ignore_automatic_attention_set_rules': False}
$ ./gerrit_client.py ... --no-automatic-attention
-> body has {'ignore_automatic_attention_set_rules': True}
Change-Id: Idcf7975ba691942cfe385a2156ef3a3ec064a0b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172486
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
gerrit_utils retries failed HTTP requests 6 times by default. For SubmitChange the failure reason is often 409 on a merge conflict, which doesn't make sense to retry as the conflict remains.
This is being done as part of improving efficiency of submitting Chrome signing request changes. We currently spend a lot of time just retrying to submit a conflicting change. Reducing the number of retries in gerrit_util will free up the time for more retries that include fully recreating the change on top of the latest changes.
Bug: 365827690
Change-Id: Ifae83c14da7ca829a155c1cd6e79398e5ea0cf85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172303
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Alex Kravchuk <alexanderkr@google.com>
This reverts commit 4c54361841.
Reason for revert: Reland with a fix.
Find https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173762/1..2
Tested by running presubmit_support.py --generate_diff
Original change's description:
> Revert "add support for -U in presubmit_diff.py"
>
> This reverts commit b576ab3b78.
>
> Reason for revert: http://b/389876151
>
> Original change's description:
> > add support for -U in presubmit_diff.py
> >
> > presubmit_diff.py is going to be used to compute the changes to be
> > formatted, and -U helps minimize the number of irrelevant lines
> > from formatting.
> >
> > Bug: 379902295
> > Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > Commit-Queue: Scott Lee <ddoman@chromium.org>
>
> Bug: 379902295
> Change-Id: I82dd707e5ae3d4b1760e632506ee0e1bc1d76e09
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173760
> Reviewed-by: Scott Lee <ddoman@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bug: 379902295
Change-Id: Icbc4aa98bbfaa816143be064217fb2d992b48baf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173762
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
This includes a backported bugfix from 3.12 which prevents the
interpreter from hanging while generating stack traces - previously
the garbage collector could kick in during stack trace collection
and cause the interpreter to hang.
R=bjoyce, fancl
Bug: 387535231
Change-Id: I2b45c155377ad76dd5876228e9c4cccb374ba2ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6158273
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Chenlin Fan <fancl@chromium.org>
Reviewed-by: Benjamin Joyce (Ben) <bjoyce@chromium.org>
When adding tests, the LoadDescription function accidentally got called
with the wrong arguments in the main function. This fixes that; a future
CL (uploading shortly) adds more robust tests that would have caught this.
Bug: 389568463, 389069356
Change-Id: Icaf5e83cd8caa9f3975173f8c8ee7d92ef44ee56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6170638
Commit-Queue: Andy Perelson <ajp@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
Reviewed-by: Andy Perelson <ajp@google.com>
Auto-Submit: Devon Loehr <dloehr@google.com>
This is a little bit more boiler plate, but the UX is much nicer.
Asserts produce race tracebacks while parser.error produces a clean
error message. This in turn makes it much more obvious that the
user made an error vs the tool crashing.
If gerrit_client was written using argparse, we could just set
required=True on the option, but it's still using optparse, and
that has no built-in support for required options.
Before:
$ ./gerrit_client.py addmessage
Traceback (most recent call last):
File ".../depot_tools/./gerrit_client.py", line 563, in <module>
sys.exit(main(sys.argv[1:]))
^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 555, in main
return dispatcher.execute(OptionParser(), argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/subcommand.py", line 254, in execute
return command(parser, args[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 409, in CMDaddMessage
(opt, args) = parser.parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 547, in parse_args
assert options.host, "--host not defined."
^^^^^^^^^^^^
AssertionError: --host not defined.
After:
$ ./gerrit_client.py addmessage
Usage: gerrit_client.py addMessage [options] [args ...]
gerrit_client.py: error: --host is required.
Change-Id: I2f807628439e6399daaedc00cd42d160505ee4ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172484
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
This reverts commit b576ab3b78.
Reason for revert: http://b/389876151
Original change's description:
> add support for -U in presubmit_diff.py
>
> presubmit_diff.py is going to be used to compute the changes to be
> formatted, and -U helps minimize the number of irrelevant lines
> from formatting.
>
> Bug: 379902295
> Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>
Bug: 379902295
Change-Id: I82dd707e5ae3d4b1760e632506ee0e1bc1d76e09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173760
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
presubmit_diff.py is going to be used to compute the changes to be
formatted, and -U helps minimize the number of irrelevant lines
from formatting.
Bug: 379902295
Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
The modified lines are corresponding to the following codes in
clang-format-diff.py
: https://source.chromium.org/chromium/chromium/src/+/main:third_party/clang-format/script/clang-format-diff.py;l=124-135
This CL fixes the following two issues.
1) if lines are simply removed w/o replacements in the original text,
_ComputeFormatDiffLineRanges() returns values that result in
--line $start:$start, which formats the start line number of the secion
in the new text, whcih is not the removed line.
If lines are simply removed, no formatting is necessary in the new text.
2) incorrect line counts in the next text.
The line count includes the starting line. Therefore, if the hunk has
12:1, it corresponds to the single, 12th line. However, the existing logic
translates it as 12th and 13th lines.
In most cases, the above issues won't make visible changes. Even if
they do, engineers wouldn't notice, as it would just format one additional
line below the changes that they made.
However, this CL is to match the same behaviour implmented in
clang-format-diff.py
Change-Id: Ifd2a19c8801c836f8e0799410b372a0f258fd476
Bug: 379902295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172780
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
This makes the allowlist files easier to read. It also prevents accidental changes when adding new entries.
Note that this CL does not modify the actual entries. A duplicate of ISC was removed.
Change-Id: Id64e64dbc934af1b412fce0e0c7c34a8d7b4c5f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168290
Commit-Queue: Jordan Brown <rop@google.com>
Reviewed-by: Rachael Newitt <renewitt@google.com>
Auto-Submit: Jordan Brown <rop@google.com>
Reciprocal licenses can only be used in open source projects.
This change updates the presubmit validation checks to accept an
optional flag `allow_reciprocal_licenses`. When True, the allowlist is
extended to include reciprocal licenses.
Bug: 385020146
Change-Id: I0374658207bc87ffd74e033762ee4973c6e83b3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6107863
Reviewed-by: Jordan Brown <rop@google.com>
Auto-Submit: Jordan Brown <rop@google.com>
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Rachael Newitt <renewitt@google.com>
I frequently find myself running `git cl split` just to see how the
files are going to be split up, without actually intending to submit the
resulting CLs immediately. Doing so requires creating a file, putting a
dummy description in it, and passing that to the command line, which is
unnecessary work. This CL simply allows dry runs to use a dummy
description if none is provided, to make checking the tool's output
easier.
Bug: None
Change-Id: I47e06c6e6da26701e07dcae81ab605edac2e2ca6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6163904
Reviewed-by: Andy Perelson <ajp@google.com>
Commit-Queue: Devon Loehr <dloehr@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
As we shift CrOS to 3.11 entirely, we'll stop testing 3.8, so start
pushing people to upgrade to 3.11. This way when we eventually
require 3.11, people won't be surprised.
Bug: 318532035
Change-Id: I3be6b4cce56321984ff4aad4f6998660be29550c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6165449
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
gclient normally runs hooks in a pseudo terminal which has no
sense of the terminal size. If we want hooks to be able to change
what they output based on the terminal size, we have to explicitly
propagate the terminal size info down through the subprocess
environment.
Change-Id: I08f7c48ef78ea4eb9f5b791abb2a7e5ef8870050
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6161596
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Running a gclient sync will touch the gclient_args.gni even if unchanged,
especially on Windows resulting in an unnecessarily large rebuild of
around 20k items. This skips writing the file if the contents are identical
to what we're about to write.
R=jojwang@google.com, sokcevic@chromium.org
Change-Id: Iccf3fc8eeeb114fdf29bf944a8204e47489bc0a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6157476
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
This is a list of licenses classified as 'reciprocal'. Due to the requirements of licenses of this type we can only allow their use in open source projects. This change introduces the variable 'OPEN_SOURCE_SPDX_LICENSES' with an initial set of reciprocal licenses currently used in chromium.
Change-Id: I376a7623e3685d67edd63ceb3088ca68c9d2fb7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6107860
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Jordan Brown <rop@google.com>
Add support for validating licenses that aren't in the official SPDX license list but are commonly used in our codebase. These are the values output by the license classifier. This introduces a new EXTENDED_LICENSE_CLASSIFIERS set that contains these custom license identifiers, organized by restrictiveness level similar to ALLOWED_SPDX_LICENSES.
Bug: 379977497
Change-Id: I18e0b38572ee4df783573ea338b55ac237d8134d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6107859
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Jordan Brown <rop@google.com>