dev-cmd/update-license-data: fail if not changed rather than on change

This commit is contained in:
Bo Anderson 2020-07-17 14:14:12 +01:00
parent 4765814b1d
commit 19f9fecb33
3 changed files with 7 additions and 7 deletions

View File

@ -16,8 +16,8 @@ module Homebrew
Update SPDX license data in the Homebrew repository. Update SPDX license data in the Homebrew repository.
EOS EOS
switch "--fail-if-changed", switch "--fail-if-not-changed",
description: "Return a failing status code if current license data's version is different from " \ description: "Return a failing status code if current license data's version is the same as " \
"the upstream. This can be used to notify CI when the SPDX license data is out of date." "the upstream. This can be used to notify CI when the SPDX license data is out of date."
switch "--commit", switch "--commit",
description: "Commit changes to the SPDX license data." description: "Commit changes to the SPDX license data."
@ -33,7 +33,7 @@ module Homebrew
data_url = "https://raw.githubusercontent.com/spdx/license-list-data/#{latest_tag}/json/licenses.json" data_url = "https://raw.githubusercontent.com/spdx/license-list-data/#{latest_tag}/json/licenses.json"
curl_download(data_url, to: SPDX_PATH, partial: false) curl_download(data_url, to: SPDX_PATH, partial: false)
Homebrew.failed = !system("git", "diff", "--stat", "--exit-code", SPDX_PATH) if args.fail_if_changed? Homebrew.failed = system("git", "diff", "--stat", "--exit-code", SPDX_PATH) if args.fail_if_not_changed?
return unless args.commit? return unless args.commit?

View File

@ -1052,8 +1052,8 @@ directory.
Update SPDX license data in the Homebrew repository. Update SPDX license data in the Homebrew repository.
* `--fail-if-changed`: * `--fail-if-not-changed`:
Return a failing status code if current license data's version is different from the upstream. This can be used to notify CI when the SPDX license data is out of date. Return a failing status code if current license data's version is the same as the upstream. This can be used to notify CI when the SPDX license data is out of date.
* `--commit`: * `--commit`:
Commit changes to the SPDX license data. Commit changes to the SPDX license data.

View File

@ -1361,8 +1361,8 @@ Initialise a Git repository in the unpacked source\. This is useful for creating
Update SPDX license data in the Homebrew repository\. Update SPDX license data in the Homebrew repository\.
. .
.TP .TP
\fB\-\-fail\-if\-changed\fR \fB\-\-fail\-if\-not\-changed\fR
Return a failing status code if current license data\'s version is different from the upstream\. This can be used to notify CI when the SPDX license data is out of date\. Return a failing status code if current license data\'s version is the same as the upstream\. This can be used to notify CI when the SPDX license data is out of date\.
. .
.TP .TP
\fB\-\-commit\fR \fB\-\-commit\fR