Merge pull request #8208 from MikeMcQuaid/public_domain_license
license: handle "Public Domain".
This commit is contained in:
commit
590669c568
@ -211,7 +211,13 @@ module Homebrew
|
|||||||
|
|
||||||
puts "From: #{Formatter.url(github_info(f))}"
|
puts "From: #{Formatter.url(github_info(f))}"
|
||||||
|
|
||||||
puts "License: #{f.license.join(", ")}" if f.license
|
if f.license.present?
|
||||||
|
licenses = f.license
|
||||||
|
.map(&:to_s)
|
||||||
|
.join(", ")
|
||||||
|
.sub("public_domain", "Public Domain")
|
||||||
|
puts "License: #{licenses}"
|
||||||
|
end
|
||||||
|
|
||||||
unless f.deps.empty?
|
unless f.deps.empty?
|
||||||
ohai "Dependencies"
|
ohai "Dependencies"
|
||||||
|
|||||||
@ -337,12 +337,12 @@ module Homebrew
|
|||||||
|
|
||||||
def audit_license
|
def audit_license
|
||||||
if formula.license.present?
|
if formula.license.present?
|
||||||
non_standard_licenses = []
|
non_standard_licenses = formula.license.map do |license|
|
||||||
formula.license.each do |license|
|
next if license == :public_domain
|
||||||
next if @spdx_data["licenses"].any? { |spdx| spdx["licenseId"] == license }
|
next if @spdx_data["licenses"].any? { |spdx| spdx["licenseId"] == license }
|
||||||
|
|
||||||
non_standard_licenses << license
|
license
|
||||||
end
|
end.compact
|
||||||
|
|
||||||
if non_standard_licenses.present?
|
if non_standard_licenses.present?
|
||||||
problem "Formula #{formula.name} contains non-standard SPDX licenses: #{non_standard_licenses}."
|
problem "Formula #{formula.name} contains non-standard SPDX licenses: #{non_standard_licenses}."
|
||||||
|
|||||||
@ -2221,6 +2221,8 @@ class Formula
|
|||||||
# Multiple licenses means that the software is licensed under multiple licenses.
|
# Multiple licenses means that the software is licensed under multiple licenses.
|
||||||
# Do not use multiple licenses if e.g. different parts are under different licenses.
|
# Do not use multiple licenses if e.g. different parts are under different licenses.
|
||||||
# <pre>license "BSD-2-Clause"</pre>
|
# <pre>license "BSD-2-Clause"</pre>
|
||||||
|
# <pre>license ["MIT", "GPL-2.0"]</pre>
|
||||||
|
# <pre>license :public_domain</pre>
|
||||||
def license(args = nil)
|
def license(args = nil)
|
||||||
if args.nil?
|
if args.nil?
|
||||||
@licenses
|
@licenses
|
||||||
|
|||||||
@ -1129,14 +1129,17 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def forbidden_license_check
|
def forbidden_license_check
|
||||||
forbidden_licenses = Homebrew::EnvConfig.forbidden_licenses.to_s.split(" ")
|
forbidden_licenses = Homebrew::EnvConfig.forbidden_licenses
|
||||||
|
.to_s
|
||||||
|
.sub("Public Domain", "public_domain")
|
||||||
|
.split(" ")
|
||||||
return if forbidden_licenses.blank?
|
return if forbidden_licenses.blank?
|
||||||
|
|
||||||
compute_dependencies.each do |dep, _|
|
compute_dependencies.each do |dep, _|
|
||||||
next if @ignore_deps
|
next if @ignore_deps
|
||||||
|
|
||||||
dep_f = dep.to_formula
|
dep_f = dep.to_formula
|
||||||
next unless dep_f.license.all? { |license| forbidden_licenses.include? license }
|
next unless dep_f.license.all? { |license| forbidden_licenses.include?(license.to_s) }
|
||||||
|
|
||||||
raise CannotInstallFormulaError, <<~EOS
|
raise CannotInstallFormulaError, <<~EOS
|
||||||
The installation of #{formula.name} has a dependency on #{dep.name} where all its licenses are forbidden: #{dep_f.license}.
|
The installation of #{formula.name} has a dependency on #{dep.name} where all its licenses are forbidden: #{dep_f.license}.
|
||||||
@ -1144,7 +1147,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
return if @only_deps
|
return if @only_deps
|
||||||
|
|
||||||
return unless formula.license.all? { |license| forbidden_licenses.include? license }
|
return unless formula.license.all? { |license| forbidden_licenses.include?(license.to_s) }
|
||||||
|
|
||||||
raise CannotInstallFormulaError, <<~EOS
|
raise CannotInstallFormulaError, <<~EOS
|
||||||
#{formula.name}'s licenses are all forbidden: #{formula.license}.
|
#{formula.name}'s licenses are all forbidden: #{formula.license}.
|
||||||
|
|||||||
@ -91,7 +91,9 @@ Try to summarise from the [`homepage`](https://rubydoc.brew.sh/Formula#homepage%
|
|||||||
|
|
||||||
**We don’t accept new formulae into Homebrew/homebrew-core without a [`license`](https://rubydoc.brew.sh/Formula#license-class_method)!**
|
**We don’t accept new formulae into Homebrew/homebrew-core without a [`license`](https://rubydoc.brew.sh/Formula#license-class_method)!**
|
||||||
|
|
||||||
Find the license identifier from the [SPDX License List](https://spdx.org/licenses/). We only accept licenses from this list that are a [Debian Free Software Guidelines license](https://wiki.debian.org/DFSGLicenses).
|
We only accept formulae that use a [Debian Free Software Guidelines license](https://wiki.debian.org/DFSGLicenses) or are released into the public domain following [DFSG Guidelines on Public Domain software](https://wiki.debian.org/DFSGLicenses#Public_Domain).
|
||||||
|
|
||||||
|
Use the license identifier from the [SPDX License List](https://spdx.org/licenses/) e.g. `license "BSD-2-Clause"`, or use `license :public_domain` for public domain software.
|
||||||
|
|
||||||
If the software is available under multiple licenses, you should list them all in an array:
|
If the software is available under multiple licenses, you should list them all in an array:
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user