Merge pull request #1235 from abookyun/deprecate-license
Deprecate license
This commit is contained in:
commit
415e5f1f78
@ -11,7 +11,6 @@ Each of the following stanzas is required for every Cask.
|
||||
| `url` | no | URL to the `.dmg`/`.zip`/`.tgz`/`.tbz2` file that contains the application.<br />A [comment](stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment) should be added if the hostnames in the `url` and `homepage` stanzas differ. Block syntax should be used for URLs that change on every visit.<br />See [URL Stanza Details](stanzas/url.md) for more information.
|
||||
| `name` | yes | a string providing the full and proper name defined by the vendor (see also [Name Stanza Details](stanzas/name.md))
|
||||
| `homepage` | no | application homepage; used for the `brew cask home` command
|
||||
| `license` | no | a symbol identifying the license category for the application (see also [License Stanza Details](stanzas/license.md))
|
||||
|
||||
## At Least One Artifact Stanza Is Also Required
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@ cask 'alfred' do
|
||||
url "https://cachefly.alfredapp.com/Alfred_#{version}.zip"
|
||||
name 'Alfred'
|
||||
homepage 'https://www.alfredapp.com/'
|
||||
license :freemium
|
||||
|
||||
app 'Alfred 2.app'
|
||||
app 'Alfred 2.app/Contents/Preferences/Alfred Preferences.app'
|
||||
@ -88,7 +87,6 @@ cask 'myapp' do
|
||||
name 'MyApp'
|
||||
version '1.0'
|
||||
sha256 'a32565cdb1673f4071593d4cc9e1c26bc884218b62fef8abc450daa47ba8fa92'
|
||||
license :unknown
|
||||
|
||||
url "https://#{Utils.arbitrary_method}"
|
||||
homepage 'https://www.example.com/'
|
||||
@ -129,7 +127,6 @@ appcast,
|
||||
checkpoint: # shown here as it is required with `appcast`
|
||||
name
|
||||
homepage
|
||||
license
|
||||
gpg, key_id: # on same line, since first part is typically small
|
||||
|
||||
auto_updates
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
# license
|
||||
|
||||
The `license` stanza is not free-form. A single value must be chosen from a list of valid symbols.
|
||||
|
||||
The values for `license` are categories, rather than fully-specified licenses. For example, `:gpl` is a category; we do not distinguish between versions of the GPL. Similarly, `:cc` and `:bsd` comprise many variants. They must always pertain to the license of the software itself, not the vendor’s business model (a free app to access a paid service is still `:gratis`, not `:freemium`).
|
||||
|
||||
The `license` stanza is intended as an aid to search/filtering of Casks. For full and complete information, the user must always rely on the vendor’s homepage.
|
||||
|
||||
Note that `brew cask search` and `brew cask list` are not yet capable of using the information stored in the `license` stanza.
|
||||
|
||||
## Generic Category Licenses
|
||||
|
||||
Cask authors should use the most specific license category which is also correct. Generic categories are provided for difficult cases. `:unknown` is also perfectly fine if you are unsure.
|
||||
|
||||
Example: [Chromium](https://www.chromium.org/chromium-os/licenses) includes code with multiple licenses, all of which are open source. Chromium licensing is described by the generic category [`:oss`](https://github.com/caskroom/homebrew-cask/blob/54a79f7dcceea9a922a5b608ac99466b9d10a191/Casks/chromium.rb#L7).
|
||||
|
||||
| symbol | meaning |
|
||||
| ----------- | ----------- |
|
||||
| `:oss` | open-source software
|
||||
| `:closed` | closed-source software
|
||||
| `:unknown` | license unknown
|
||||
| `:other` | license is known, but fits no category
|
||||
|
||||
## Valid Licenses
|
||||
|
||||
| symbol | generic category | meaning | URL |
|
||||
| ---------------- | ---------------- | ------------------------------------------------------------------ | ----------- |
|
||||
| `:gratis` | `:closed` | free-to-use, closed source | <none>
|
||||
| `:commercial` | `:closed` | not free to use | <none>
|
||||
| `:freemium` | `:closed` | free-to-use, payment required for full or additional functionality | <https://en.wikipedia.org/wiki/Freemium>
|
||||
| `:affero` | `:oss` | Affero General Public License | <https://gnu.org/licenses/agpl.html>
|
||||
| `:apache` | `:oss` | Apache Public License | <https://www.apache.org/licenses/>
|
||||
| `:arphic` | `:oss` | Arphic Public License | <http://www.arphic.com/tw/download/public_license.rar>
|
||||
| `:artistic` | `:oss` | Artistic License | <https://dev.perl.org/licenses/artistic.html>
|
||||
| `:bsd` | `:oss` | BSD License | <http://www.linfo.org/bsdlicense.html>
|
||||
| `:cc` | `:oss` | Creative Commons License | <https://creativecommons.org/licenses/>
|
||||
| `:eclipse` | `:oss` | Eclipse Public License | <https://www.eclipse.org/legal/eplfaq.php>
|
||||
| `:gpl` | `:oss` | GNU Public License | <https://www.gnu.org/copyleft/gpl.html>
|
||||
| `:isc` | `:oss` | Internet Systems Consortium License | <https://www.isc.org/downloads/software-support-policy/isc-license/>
|
||||
| `:lppl` | `:oss` | LaTeX Project Public License | <https://latex-project.org/lppl/>
|
||||
| `:ncsa` | `:oss` | University of Illinois/NCSA Open Source License | <http://otm.illinois.edu/uiuc_openSource>
|
||||
| `:mit` | `:oss` | MIT License | <https://opensource.org/licenses/MIT>
|
||||
| `:mpl` | `:oss` | Mozilla Public License | <https://www.mozilla.org/MPL/>
|
||||
| `:ofl` | `:oss` | SIL Open Font License | <https://scripts.sil.org/OFL>
|
||||
| `:public_domain` | `:oss` | not copyrighted | <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
|
||||
| `:ubuntu_font` | `:oss` | Ubuntu Font License | <http://font.ubuntu.com/licence/>
|
||||
| `:x11` | `:oss` | X Consortium License | <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
|
||||
@ -17,7 +17,6 @@ cask 'shuttle' do
|
||||
checkpoint: 'c3dea2ed479b3ebba7c56ace6040901795f6dc6be92f9ffc30cc808d31723f17'
|
||||
name 'Shuttle'
|
||||
homepage 'https://fitztrev.github.io/shuttle/'
|
||||
license :mit
|
||||
|
||||
app 'Shuttle.app'
|
||||
|
||||
@ -36,7 +35,6 @@ cask 'airstream' do
|
||||
url 'https://s3-us-west-2.amazonaws.com/airstream-clients/mac/airstream-mac.dmg'
|
||||
name 'AirStream'
|
||||
homepage 'http://airstream.io/download/'
|
||||
license :gratis
|
||||
|
||||
app 'AirStream.app'
|
||||
|
||||
@ -58,7 +56,6 @@ cask 'airdisplay' do
|
||||
checkpoint: '938bdb9fbee793dce92818366cb2c19ba84c5b0cd6853fd893897d4a40689bc2'
|
||||
name 'Air Display'
|
||||
homepage 'https://avatron.com/apps/air-display/'
|
||||
license :commercial
|
||||
|
||||
pkg 'Air Display Installer.pkg'
|
||||
|
||||
@ -102,7 +99,6 @@ cask 'my-new-cask' do
|
||||
url ''
|
||||
name ''
|
||||
homepage ''
|
||||
license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
|
||||
|
||||
app ''
|
||||
end
|
||||
@ -119,7 +115,6 @@ Fill in the following stanzas for your Cask:
|
||||
| `url` | URL to the `.dmg`/`.zip`/`.tgz`/`.tbz2` file that contains the application.<br />A [comment](../cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment) should be added if the hostnames in the `url` and `homepage` stanzas differ. Block syntax should be used for URLs that change on every visit.<br />See [URL Stanza Details](../cask_language_reference/stanzas/url.md) for more information.
|
||||
| `name` | the full and proper name defined by the vendor, and any useful alternate names (see [Name Stanza Details](../cask_language_reference/stanzas/name.md))
|
||||
| `homepage` | application homepage; used for the `brew cask home` command
|
||||
| `license` | a symbol identifying the license for the application. Valid category licenses include `:oss`, `:closed`, and `:unknown`. It is OK to leave as `:unknown`. (see [License Stanza Details](../cask_language_reference/stanzas/license.md))
|
||||
| `app` | relative path to an `.app` bundle that should be moved into the `/Applications` folder on installation (see [App Stanza Details](../cask_language_reference/stanzas/app.md))
|
||||
|
||||
Other commonly-used stanzas are:
|
||||
|
||||
@ -50,7 +50,6 @@ module Hbc
|
||||
%i{version sha256 url homepage}.each do |sym|
|
||||
add_error "a #{sym} stanza is required" unless cask.send(sym)
|
||||
end
|
||||
add_error "a license stanza is required (:unknown is OK)" unless cask.license
|
||||
add_error "at least one name stanza is required" if cask.name.empty?
|
||||
# TODO: specific DSL knowledge should not be spread around in various files like this
|
||||
# TODO: nested_container should not still be a pseudo-artifact at this point
|
||||
|
||||
@ -102,7 +102,6 @@ module Hbc
|
||||
:url,
|
||||
:appcast,
|
||||
:version,
|
||||
:license,
|
||||
:sha256,
|
||||
:artifacts,
|
||||
:caveats,
|
||||
|
||||
@ -26,7 +26,6 @@ module Hbc
|
||||
url 'https://'
|
||||
name ''
|
||||
homepage ''
|
||||
license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
|
||||
|
||||
app ''
|
||||
end
|
||||
|
||||
@ -9,7 +9,6 @@ require "hbc/dsl/container"
|
||||
require "hbc/dsl/depends_on"
|
||||
require "hbc/dsl/gpg"
|
||||
require "hbc/dsl/installer"
|
||||
require "hbc/dsl/license"
|
||||
require "hbc/dsl/postflight"
|
||||
require "hbc/dsl/preflight"
|
||||
require "hbc/dsl/stanza_proxy"
|
||||
@ -66,7 +65,6 @@ module Hbc
|
||||
:gpg,
|
||||
:homepage,
|
||||
:language,
|
||||
:license,
|
||||
:name,
|
||||
:sha256,
|
||||
:staged_path,
|
||||
@ -206,14 +204,8 @@ module Hbc
|
||||
@sha256 ||= arg
|
||||
end
|
||||
|
||||
def license(arg = nil)
|
||||
return @license if arg.nil?
|
||||
assert_only_one_stanza_allowed :license, !arg.nil?
|
||||
@license ||= begin
|
||||
DSL::License.new(arg) unless arg.nil?
|
||||
rescue StandardError => e
|
||||
raise CaskInvalidError.new(token, e)
|
||||
end
|
||||
def license(*)
|
||||
odeprecated "Hbc::DSL#license"
|
||||
end
|
||||
|
||||
# depends_on uses a load method so that multiple stanzas can be merged
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
module Hbc
|
||||
class DSL
|
||||
class License
|
||||
# a generic category can always be given as a license, so
|
||||
# category names should be given as both key and value
|
||||
VALID_LICENSES = {
|
||||
# license category
|
||||
unknown: :unknown,
|
||||
|
||||
other: :other,
|
||||
|
||||
closed: :closed,
|
||||
commercial: :closed,
|
||||
gratis: :closed,
|
||||
freemium: :closed,
|
||||
|
||||
oss: :oss,
|
||||
affero: :oss,
|
||||
apache: :oss,
|
||||
arphic: :oss,
|
||||
artistic: :oss,
|
||||
bsd: :oss,
|
||||
cc: :oss,
|
||||
eclipse: :oss,
|
||||
gpl: :oss,
|
||||
isc: :oss,
|
||||
lppl: :oss,
|
||||
ncsa: :oss,
|
||||
mit: :oss,
|
||||
mpl: :oss,
|
||||
ofl: :oss,
|
||||
public_domain: :oss,
|
||||
ubuntu_font: :oss,
|
||||
x11: :oss,
|
||||
}.freeze
|
||||
|
||||
DEFAULT_LICENSE = :unknown
|
||||
DEFAULT_CATEGORY = VALID_LICENSES[DEFAULT_LICENSE]
|
||||
|
||||
attr_reader :value
|
||||
|
||||
def self.check_constants
|
||||
categories = Set.new(VALID_LICENSES.values)
|
||||
categories.each do |cat|
|
||||
next if VALID_LICENSES.key?(cat)
|
||||
raise "license category is not a value: '#{@cat.inspect}'"
|
||||
end
|
||||
end
|
||||
|
||||
def self.category(license)
|
||||
VALID_LICENSES.fetch(license, DEFAULT_CATEGORY)
|
||||
end
|
||||
|
||||
def initialize(arg)
|
||||
@value = arg
|
||||
@value = DEFAULT_LICENSE if @value.nil?
|
||||
return if VALID_LICENSES.key?(@value)
|
||||
raise "invalid license value: '#{@value.inspect}'"
|
||||
end
|
||||
|
||||
def category
|
||||
self.class.category(@value)
|
||||
end
|
||||
|
||||
def to_s
|
||||
@value.inspect
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -52,7 +52,7 @@ describe Hbc::Audit do
|
||||
subject { audit.run! }
|
||||
|
||||
describe "required stanzas" do
|
||||
%w[version sha256 url name homepage license].each do |stanza|
|
||||
%w[version sha256 url name homepage].each do |stanza|
|
||||
context "when missing #{stanza}" do
|
||||
let(:cask_token) { "missing-#{stanza}" }
|
||||
it { is_expected.to fail_with(%r{#{stanza} stanza is required}) }
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
test_cask 'missing-license' do
|
||||
version '1.2.3'
|
||||
|
||||
url 'http://localhost/something.dmg'
|
||||
end
|
||||
@ -49,7 +49,6 @@ describe Hbc::CLI::Create do
|
||||
url 'https://'
|
||||
name ''
|
||||
homepage ''
|
||||
license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
|
||||
|
||||
app ''
|
||||
end
|
||||
|
||||
@ -406,31 +406,6 @@ describe Hbc::DSL do
|
||||
end
|
||||
end
|
||||
|
||||
describe "license stanza" do
|
||||
it "allows the license to be specified" do
|
||||
cask = Hbc.load("with-license")
|
||||
cask.license.value.must_equal :gpl
|
||||
end
|
||||
|
||||
it "the license has a category" do
|
||||
cask = Hbc.load("with-license")
|
||||
cask.license.category.must_equal :oss
|
||||
end
|
||||
|
||||
it "prevents defining multiple license stanzas" do
|
||||
err = lambda {
|
||||
Hbc.load("invalid/invalid-license-multiple")
|
||||
}.must_raise(Hbc::CaskInvalidError)
|
||||
err.message.must_include "'license' stanza may only appear once"
|
||||
end
|
||||
|
||||
it "refuses to load on invalid license value" do
|
||||
lambda {
|
||||
Hbc.load("invalid/invalid-license-value")
|
||||
}.must_raise(Hbc::CaskInvalidError)
|
||||
end
|
||||
end
|
||||
|
||||
describe "installer stanza" do
|
||||
it "allows installer script to be specified" do
|
||||
cask = Hbc.load("with-installer-script")
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
test_cask 'invalid-license-multiple' do
|
||||
version '2.61'
|
||||
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
|
||||
|
||||
url TestHelper.local_binary_url('transmission-2.61.dmg')
|
||||
homepage 'http://example.com/invalid-license-multiple'
|
||||
license :gpl
|
||||
license :gpl
|
||||
|
||||
app 'Transmission.app'
|
||||
end
|
||||
@ -1,10 +0,0 @@
|
||||
test_cask 'invalid-license-value' do
|
||||
version '2.61'
|
||||
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
|
||||
|
||||
url TestHelper.local_binary_url('transmission-2.61.dmg')
|
||||
homepage 'http://example.com/invalid-license-value'
|
||||
license :no_such_license
|
||||
|
||||
app 'Transmission.app'
|
||||
end
|
||||
@ -1,10 +0,0 @@
|
||||
test_cask 'with-license' do
|
||||
version '2.61'
|
||||
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
|
||||
|
||||
url TestHelper.local_binary_url('transmission-2.61.dmg')
|
||||
homepage 'http://example.com/with-license'
|
||||
license :gpl
|
||||
|
||||
app 'Transmission.app'
|
||||
end
|
||||
@ -5,7 +5,6 @@ test_cask 'with-suite' do
|
||||
url TestHelper.local_binary_url('caffeine-suite.zip')
|
||||
name 'Caffeine'
|
||||
homepage 'http://example.com/with-suite'
|
||||
license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
|
||||
|
||||
suite 'Caffeine'
|
||||
end
|
||||
|
||||
@ -24,6 +24,7 @@ class IntegrationCommandTestCase < Homebrew::TestCase
|
||||
HOMEBREW_PREFIX/"bin",
|
||||
HOMEBREW_PREFIX/"share",
|
||||
HOMEBREW_PREFIX/"opt",
|
||||
HOMEBREW_PREFIX/"Caskroom",
|
||||
HOMEBREW_LIBRARY/"Taps/caskroom",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bundle",
|
||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo",
|
||||
|
||||
@ -5,6 +5,6 @@ class IntegrationCommandTestCask < IntegrationCommandTestCase
|
||||
needs_test_cmd_taps
|
||||
needs_macos
|
||||
setup_remote_tap("caskroom/cask")
|
||||
cmd("cask", "list")
|
||||
cmd("cask", "list", "--caskroom=#{HOMEBREW_PREFIX}/Caskroom")
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user