-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add appimage support for linux #20334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # typed: strict | ||
| # frozen_string_literal: true | ||
|
|
||
| require "cask/artifact/symlinked" | ||
|
|
||
| module Cask | ||
| module Artifact | ||
| class AppImage < Symlinked | ||
| sig { params(target: T.any(String, Pathname)).returns(Pathname) } | ||
| def resolve_target(target) | ||
| config.appimagedir/target | ||
| end | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -127,33 +127,61 @@ def run | |||||||
|
|
||||||||
| sig { params(cask: Cask::Cask).returns(T::Hash[T::Hash[Symbol, T.any(Symbol, String)], Float]) } | ||||||||
| def filter_runners(cask) | ||||||||
| filtered_macos_runners = RUNNERS.select do |runner, _| | ||||||||
| runner[:symbol] != :linux && | ||||||||
| filtered_runners = if cask.supports_macos? | ||||||||
| filtered_macos_runners = MACOS_RUNNERS.select do |runner, _| | ||||||||
| cask.depends_on.macos.present? && | ||||||||
| cask.depends_on.macos.allows?(MacOSVersion.from_symbol(T.must(runner[:symbol]).to_sym)) | ||||||||
| end | ||||||||
| cask.depends_on.macos.allows?(MacOSVersion.from_symbol(T.must(runner[:symbol]).to_sym)) | ||||||||
| end | ||||||||
|
|
||||||||
| return MACOS_RUNNERS.dup if filtered_macos_runners.none? | ||||||||
|
|
||||||||
| filtered_runners = if filtered_macos_runners.any? | ||||||||
| filtered_macos_runners | ||||||||
| else | ||||||||
| RUNNERS.dup | ||||||||
| end | ||||||||
|
|
||||||||
| filtered_runners = filtered_runners.merge(LINUX_RUNNERS) if cask.supports_linux? | ||||||||
|
|
||||||||
| archs = architectures(cask:) | ||||||||
| odebug "Architectures macOS: #{archs}" if archs.any? | ||||||||
| filtered_runners.select! do |runner, _| | ||||||||
| archs.include?(runner.fetch(:arch)) | ||||||||
| end | ||||||||
|
|
||||||||
| odebug "Filtered runners: #{filtered_runners.keys.map { |r| r[:name] }}" if filtered_runners.any? | ||||||||
| if cask.supports_linux? | ||||||||
| filtered_linux_runners = LINUX_RUNNERS.dup | ||||||||
|
|
||||||||
| archs = architectures(cask:, os: :linux, arch: :intel) | ||||||||
| filtered_linux_runners.select! do |runner, _| | ||||||||
| archs.include?(runner.fetch(:arch)) | ||||||||
| end | ||||||||
|
|
||||||||
| filtered_runners.merge!(filtered_linux_runners) | ||||||||
| end | ||||||||
|
|
||||||||
| odebug "Architectures linux: #{archs}" if archs.any? | ||||||||
| odebug "Filtered runners: #{filtered_runners.keys.map { |r| r[:name] }}" if filtered_runners.any? | ||||||||
|
|
||||||||
| filtered_runners | ||||||||
| end | ||||||||
|
|
||||||||
| sig { params(cask: Cask::Cask).returns(T::Array[Symbol]) } | ||||||||
| def architectures(cask:) | ||||||||
| return RUNNERS.keys.map { |r| r.fetch(:arch).to_sym }.uniq.sort if cask.depends_on.arch.blank? | ||||||||
| sig { params(cask: Cask::Cask, os: Symbol, arch: Symbol).returns(T::Array[Symbol]) } | ||||||||
| def architectures(cask:, os: :macos, arch: :arm) | ||||||||
| architectures = [] | ||||||||
| begin | ||||||||
| tag = Utils::Bottles::Tag.new(system: os, arch: arch) | ||||||||
| Homebrew::SimulateSystem.with_tag(tag) do | ||||||||
| cask.refresh | ||||||||
|
|
||||||||
| if cask.depends_on.arch.blank? | ||||||||
| architectures = RUNNERS.keys.map { |r| r.fetch(:arch).to_sym }.uniq.sort | ||||||||
| next | ||||||||
| end | ||||||||
|
|
||||||||
| architectures = cask.depends_on.arch.map { |arch| arch[:type] } | ||||||||
| end | ||||||||
| rescue ::Cask::CaskInvalidError | ||||||||
| # Can't read cask for this system-arch combination. | ||||||||
| end | ||||||||
|
|
||||||||
| cask.depends_on.arch.map { |arch| arch[:type] }.uniq.sort | ||||||||
| architectures | ||||||||
| end | ||||||||
|
|
||||||||
| sig { | ||||||||
|
|
@@ -255,7 +283,7 @@ def generate_matrix(tap, labels: [], cask_names: [], skip_install: false, new_ca | |||||||
| native_runner_arch = arch == runner.fetch(:arch) | ||||||||
| # we don't need to run simulated archs on Linux | ||||||||
| next if runner.fetch(:symbol) == :linux && !native_runner_arch | ||||||||
| # we don't need to run simulated archs on macOS | ||||||||
| # we don't need to run simulated archs on macOS Sequoia | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because an intel runner exists for it, in contrary to all the other macOS versions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I add the same to the Linux block above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if that's the reason: yup! |
||||||||
| next if runner.fetch(:symbol) == :sequoia && !native_runner_arch | ||||||||
|
|
||||||||
| # If it's just a single OS test then we can just use the two real arch runners. | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # typed: strict | ||
| # frozen_string_literal: true | ||
|
|
||
| module OS | ||
| module Mac | ||
| module Cask | ||
| module Installer | ||
| extend T::Helpers | ||
|
|
||
| requires_ancestor { ::Cask::Installer } | ||
|
|
||
| sig { void } | ||
| def check_stanza_os_requirements | ||
| return unless @cask.supports_macos? | ||
|
|
||
| raise ::Cask::CaskError, "Linux is required for this software." | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| Cask::Installer.prepend(OS::Mac::Cask::Installer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this block is nearly identical in the macOS and Linux cases: it'd be nicer to have a shared helper method in this class that both cases call.