diff --git a/Library/Homebrew/cask/doc/cask_language_reference/all_stanzas.md b/Library/Homebrew/cask/doc/cask_language_reference/all_stanzas.md index 63930b8bfb..b25f864e60 100644 --- a/Library/Homebrew/cask/doc/cask_language_reference/all_stanzas.md +++ b/Library/Homebrew/cask/doc/cask_language_reference/all_stanzas.md @@ -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.
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.
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 diff --git a/Library/Homebrew/cask/doc/cask_language_reference/readme.md b/Library/Homebrew/cask/doc/cask_language_reference/readme.md index 1fcff78537..e83539cd4c 100644 --- a/Library/Homebrew/cask/doc/cask_language_reference/readme.md +++ b/Library/Homebrew/cask/doc/cask_language_reference/readme.md @@ -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 diff --git a/Library/Homebrew/cask/doc/cask_language_reference/stanzas/license.md b/Library/Homebrew/cask/doc/cask_language_reference/stanzas/license.md deleted file mode 100644 index 9739c3bdce..0000000000 --- a/Library/Homebrew/cask/doc/cask_language_reference/stanzas/license.md +++ /dev/null @@ -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 | -| `:commercial` | `:closed` | not free to use | -| `:freemium` | `:closed` | free-to-use, payment required for full or additional functionality | -| `:affero` | `:oss` | Affero General Public License | -| `:apache` | `:oss` | Apache Public License | -| `:arphic` | `:oss` | Arphic Public License | -| `:artistic` | `:oss` | Artistic License | -| `:bsd` | `:oss` | BSD License | -| `:cc` | `:oss` | Creative Commons License | -| `:eclipse` | `:oss` | Eclipse Public License | -| `:gpl` | `:oss` | GNU Public License | -| `:isc` | `:oss` | Internet Systems Consortium License | -| `:lppl` | `:oss` | LaTeX Project Public License | -| `:ncsa` | `:oss` | University of Illinois/NCSA Open Source License | -| `:mit` | `:oss` | MIT License | -| `:mpl` | `:oss` | Mozilla Public License | -| `:ofl` | `:oss` | SIL Open Font License | -| `:public_domain` | `:oss` | not copyrighted | -| `:ubuntu_font` | `:oss` | Ubuntu Font License | -| `:x11` | `:oss` | X Consortium License | diff --git a/Library/Homebrew/cask/doc/development/adding_a_cask.md b/Library/Homebrew/cask/doc/development/adding_a_cask.md index d69966a2a3..f4e29415ab 100644 --- a/Library/Homebrew/cask/doc/development/adding_a_cask.md +++ b/Library/Homebrew/cask/doc/development/adding_a_cask.md @@ -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.
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.
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: diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb index 476f2aec05..533ede70d9 100644 --- a/Library/Homebrew/cask/lib/hbc/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/audit.rb @@ -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 diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 1e2056efc7..b66f16a8ef 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -102,7 +102,6 @@ module Hbc :url, :appcast, :version, - :license, :sha256, :artifacts, :caveats, diff --git a/Library/Homebrew/cask/lib/hbc/cli/create.rb b/Library/Homebrew/cask/lib/hbc/cli/create.rb index 14860942f7..84537cdc13 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/create.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/create.rb @@ -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 diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 8e0a7715af..db6739f4bb 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -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 diff --git a/Library/Homebrew/cask/lib/hbc/dsl/license.rb b/Library/Homebrew/cask/lib/hbc/dsl/license.rb deleted file mode 100644 index affbc08f51..0000000000 --- a/Library/Homebrew/cask/lib/hbc/dsl/license.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/cask/spec/cask/audit_spec.rb b/Library/Homebrew/cask/spec/cask/audit_spec.rb index 87758a1af8..7094ea3a89 100644 --- a/Library/Homebrew/cask/spec/cask/audit_spec.rb +++ b/Library/Homebrew/cask/spec/cask/audit_spec.rb @@ -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}) } diff --git a/Library/Homebrew/cask/spec/support/Casks/missing-license.rb b/Library/Homebrew/cask/spec/support/Casks/missing-license.rb deleted file mode 100644 index 30f3791c77..0000000000 --- a/Library/Homebrew/cask/spec/support/Casks/missing-license.rb +++ /dev/null @@ -1,5 +0,0 @@ -test_cask 'missing-license' do - version '1.2.3' - - url 'http://localhost/something.dmg' -end diff --git a/Library/Homebrew/cask/test/cask/cli/create_test.rb b/Library/Homebrew/cask/test/cask/cli/create_test.rb index efca1a5064..06c2d203c5 100644 --- a/Library/Homebrew/cask/test/cask/cli/create_test.rb +++ b/Library/Homebrew/cask/test/cask/cli/create_test.rb @@ -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 diff --git a/Library/Homebrew/cask/test/cask/dsl_test.rb b/Library/Homebrew/cask/test/cask/dsl_test.rb index 053eae1e1d..d3361080b1 100644 --- a/Library/Homebrew/cask/test/cask/dsl_test.rb +++ b/Library/Homebrew/cask/test/cask/dsl_test.rb @@ -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") diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb deleted file mode 100644 index 706b9490b9..0000000000 --- a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb deleted file mode 100644 index dbc36e5810..0000000000 --- a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/cask/test/support/Casks/with-license.rb b/Library/Homebrew/cask/test/support/Casks/with-license.rb deleted file mode 100644 index 6a85c8e319..0000000000 --- a/Library/Homebrew/cask/test/support/Casks/with-license.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/cask/test/support/Casks/with-suite.rb b/Library/Homebrew/cask/test/support/Casks/with-suite.rb index dbaaaea679..e92b224253 100644 --- a/Library/Homebrew/cask/test/support/Casks/with-suite.rb +++ b/Library/Homebrew/cask/test/support/Casks/with-suite.rb @@ -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 diff --git a/Library/Homebrew/test/helper/integration_command_test_case.rb b/Library/Homebrew/test/helper/integration_command_test_case.rb index 2a677e8026..e894583bbc 100644 --- a/Library/Homebrew/test/helper/integration_command_test_case.rb +++ b/Library/Homebrew/test/helper/integration_command_test_case.rb @@ -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", diff --git a/Library/Homebrew/test/test_cask.rb b/Library/Homebrew/test/test_cask.rb index 6f4f4601a9..6cae6d54ba 100644 --- a/Library/Homebrew/test/test_cask.rb +++ b/Library/Homebrew/test/test_cask.rb @@ -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