Update the instructions for updating licenses. (flutter/engine#51297)

* Adds markdown formatting to better highlight the important bits.
* Removes the bit about patch files not being valid because they are
copied from the GitHub UI (we use LUCI now).
* Add a shortcut for Mac to apply the patch from your pasteboard.
This commit is contained in:
Chinmay Garde
2024-03-08 15:18:01 -08:00
committed by GitHub
parent 4c86674a0f
commit 4f8e474738

View File

@@ -1,20 +1,42 @@
# Update License Files
## Apply patch generated by CI
If you're not working on a Linux box then you can't auto-generate license files. A workaround is provided via CI.
If you're not working on a Linux box then you can't auto-generate license
files. A workaround is provided via CI.
Your build will fail one or more CI checks if your license files are not correct. Open the failing CI check. In the CI output you will find a patch diff that represents the changes that need to be made to your license files.
Your build will fail one or more CI checks if your license files are not
correct. Open the failing CI check. In the CI output you will find a
patch diff that represents the changes that need to be made to your
license files.
IF (and only if!) the diff does not change _which_ licenses are being included, but only affects the `FILE:` metadata and so forth in the golden files, then you can click `Download full logs` (Github removes lines with only whitespaces, which invalidates the diff), copy this patch to a temporary patch file wherever you'd like, and then apply the patch to your repo:
> [!WARNING]
> Do this only if the diff does not change _which_ licenses are being
> included, but affects just the `FILE:` metadata and so forth in the
> golden files. If the actual content of the licenses has changed, you
> will need to rerun the script from a Linux box to update the actual
> LICENSE file, as described below.
```
```sh
cd flutter/ci/licenses_golden
```
If the file is to `my/patch/file` locally. The `-p2` strips two path
components from the file paths in the diff. Adjust as necessary.
```sh
patch -p2 < my/patch/file
```
HOWEVER, if the actual content of the licenses changed then you will need to rerun the script from a Linux box to update the actual LICENSE file, as described below.
If the patch file is copied in your clipboard. On Mac, you may apply the patch from there.
## Check for license changes (Only works on Linux)
```sh
pbpaste | patch -p2
```
## Check for license changes
> [!WARNING]
> Only works on Linux.
This script has two sets of output files: "goldens", which describe
the current license state of the repository, and the actual real
@@ -46,11 +68,12 @@ cp ../../../out/licenses/* ../../ci/licenses_golden
git diff
```
If the only changes are to what files are included, then you're good
to go. However, if any of the _licenses_ changed, whether new licenses
are added, old ones removed, or any have their content changed in
_any_ way (including, e.g., whitespace changes), or if the affected
libraries change, **you must update the actual license file**.
> [!IMPORTANT]
> If the only changes are to what files are included, then you're good
> to go. However, if any of the _licenses_ changed, whether new licenses
> are added, old ones removed, or any have their content changed in
> _any_ way (including, e.g., whitespace changes), or if the affected
> libraries change, **you must update the actual license file**.
The `sky/packages/sky_engine/LICENSE` file is the one actually
included in product releases and the one that should be updated any