mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
formula_auditor: reject more SPDX licenses
Also require licenses on non-disabled formulae
This commit is contained in:
parent
1f9bd2de89
commit
24a5aed485
@ -199,14 +199,30 @@ module Homebrew
|
|||||||
"LGPL-3.0" => ["LGPL-3.0-only", "LGPL-3.0-or-later"],
|
"LGPL-3.0" => ["LGPL-3.0-only", "LGPL-3.0-or-later"],
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
# The following licenses are non-free/open based on multiple sources (e.g. Debian, Fedora, FSF, OSI, ...)
|
||||||
|
INCOMPATIBLE_LICENSES = [
|
||||||
|
"JSON", # https://wiki.debian.org/DFSGLicenses#JSON_evil_license
|
||||||
|
"OPL-1.0", # https://wiki.debian.org/DFSGLicenses#Open_Publication_License_.28OPL.29_v1.0
|
||||||
|
].freeze
|
||||||
|
INCOMPATIBLE_LICENSE_PREFIXES = [
|
||||||
|
"BUSL", # https://spdx.org/licenses/BUSL-1.1.html#notes
|
||||||
|
"CC-BY-NC", # https://people.debian.org/~bap/dfsg-faq.html#no_commercial
|
||||||
|
"Elastic", # https://www.elastic.co/licensing/elastic-license#Limitations
|
||||||
|
"SSPL", # https://fedoraproject.org/wiki/Licensing/SSPL#License_Notes
|
||||||
|
].freeze
|
||||||
|
|
||||||
def audit_license
|
def audit_license
|
||||||
if formula.license.present?
|
if formula.license.present?
|
||||||
licenses, exceptions = SPDX.parse_license_expression formula.license
|
licenses, exceptions = SPDX.parse_license_expression formula.license
|
||||||
|
|
||||||
sspl_licensed = licenses.any? { |license| license.to_s.start_with?("SSPL") }
|
incompatible_licenses = licenses.select do |license|
|
||||||
if sspl_licensed && @core_tap
|
license.to_s.start_with?(*INCOMPATIBLE_LICENSE_PREFIXES) || INCOMPATIBLE_LICENSES.include?(license.to_s)
|
||||||
|
end
|
||||||
|
if incompatible_licenses.present? && @core_tap
|
||||||
problem <<~EOS
|
problem <<~EOS
|
||||||
Formula #{formula.name} is SSPL-licensed. Software under the SSPL must not be packaged in homebrew/core.
|
Formula #{formula.name} contains incompatible licenses: #{incompatible_licenses}.
|
||||||
|
Formulae in homebrew/core must either use a Debian Free Software Guidelines license
|
||||||
|
or be released into the public domain. See https://docs.brew.sh/License-Guidelines
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -255,7 +271,7 @@ module Homebrew
|
|||||||
|
|
||||||
problem "Formula license #{licenses} does not match GitHub license #{Array(github_license)}."
|
problem "Formula license #{licenses} does not match GitHub license #{Array(github_license)}."
|
||||||
|
|
||||||
elsif @new_formula && @core_tap
|
elsif @core_tap && !formula.disabled?
|
||||||
problem "Formulae in homebrew/core must specify a license."
|
problem "Formulae in homebrew/core must specify a license."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user