Merge pull request #8680 from nandahkrishna/livecheck-head
Add `head_only?` to Formula, replace `head?` in livecheck
This commit is contained in:
commit
a74565f909
@ -38,6 +38,7 @@ class AbstractDownloadStrategy
|
|||||||
@version = version
|
@version = version
|
||||||
@cache = meta.fetch(:cache, HOMEBREW_CACHE)
|
@cache = meta.fetch(:cache, HOMEBREW_CACHE)
|
||||||
@meta = meta
|
@meta = meta
|
||||||
|
@quiet = false
|
||||||
extend Pourable if meta[:bottle]
|
extend Pourable if meta[:bottle]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,6 +56,10 @@ class AbstractDownloadStrategy
|
|||||||
@quiet = true
|
@quiet = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def quiet?
|
||||||
|
Context.current.quiet? || @quiet
|
||||||
|
end
|
||||||
|
|
||||||
# Unpack {#cached_location} into the current working directory, and possibly
|
# Unpack {#cached_location} into the current working directory, and possibly
|
||||||
# chdir into the newly-unpacked directory.
|
# chdir into the newly-unpacked directory.
|
||||||
# Unlike {Resource#stage}, this does not take a block.
|
# Unlike {Resource#stage}, this does not take a block.
|
||||||
|
|||||||
@ -333,6 +333,12 @@ class Formula
|
|||||||
active_spec == head
|
active_spec == head
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Is this formula HEAD-only?
|
||||||
|
# @private
|
||||||
|
def head_only?
|
||||||
|
head && !stable
|
||||||
|
end
|
||||||
|
|
||||||
delegate [ # rubocop:disable Layout/HashAlignment
|
delegate [ # rubocop:disable Layout/HashAlignment
|
||||||
:bottle_unneeded?,
|
:bottle_unneeded?,
|
||||||
:bottle_disabled?,
|
:bottle_disabled?,
|
||||||
|
|||||||
@ -102,17 +102,21 @@ module Homebrew
|
|||||||
|
|
||||||
formula.head&.downloader&.shutup!
|
formula.head&.downloader&.shutup!
|
||||||
|
|
||||||
current = if formula.head?
|
# Use the `stable` version for comparison except for installed
|
||||||
|
# head-only formulae. A formula with `stable` and `head` that's
|
||||||
|
# installed using `--head` will still use the `stable` version for
|
||||||
|
# comparison.
|
||||||
|
current = if formula.head_only?
|
||||||
formula.any_installed_version.version.commit
|
formula.any_installed_version.version.commit
|
||||||
else
|
else
|
||||||
formula.version
|
formula.stable.version
|
||||||
end
|
end
|
||||||
|
|
||||||
latest = if formula.stable?
|
latest = if formula.head_only?
|
||||||
|
formula.head.downloader.fetch_last_commit
|
||||||
|
else
|
||||||
version_info = latest_version(formula, args: args)
|
version_info = latest_version(formula, args: args)
|
||||||
version_info[:latest] if version_info.present?
|
version_info[:latest] if version_info.present?
|
||||||
else
|
|
||||||
formula.head.downloader.fetch_last_commit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if latest.blank?
|
if latest.blank?
|
||||||
@ -128,7 +132,7 @@ module Homebrew
|
|||||||
latest = Version.new(m[1])
|
latest = Version.new(m[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
is_outdated = if formula.head?
|
is_outdated = if formula.head_only?
|
||||||
# A HEAD-only formula is considered outdated if the latest upstream
|
# A HEAD-only formula is considered outdated if the latest upstream
|
||||||
# commit hash is different than the installed version's commit hash
|
# commit hash is different than the installed version's commit hash
|
||||||
(current != latest)
|
(current != latest)
|
||||||
@ -150,7 +154,7 @@ module Homebrew
|
|||||||
livecheckable: formula.livecheckable?,
|
livecheckable: formula.livecheckable?,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
info[:meta][:head_only] = true if formula.head?
|
info[:meta][:head_only] = true if formula.head_only?
|
||||||
info[:meta].merge!(version_info[:meta]) if version_info.present? && version_info.key?(:meta)
|
info[:meta].merge!(version_info[:meta]) if version_info.present? && version_info.key?(:meta)
|
||||||
|
|
||||||
next if args.newer_only? && !info[:version][:outdated]
|
next if args.newer_only? && !info[:version][:outdated]
|
||||||
@ -211,7 +215,7 @@ module Homebrew
|
|||||||
status_hash[:meta] = {
|
status_hash[:meta] = {
|
||||||
livecheckable: formula.livecheckable?,
|
livecheckable: formula.livecheckable?,
|
||||||
}
|
}
|
||||||
status_hash[:meta][:head_only] = true if formula.head?
|
status_hash[:meta][:head_only] = true if formula.head_only?
|
||||||
end
|
end
|
||||||
|
|
||||||
status_hash
|
status_hash
|
||||||
@ -235,7 +239,7 @@ module Homebrew
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if formula.head? && !formula.any_version_installed?
|
if formula.head_only? && !formula.any_version_installed?
|
||||||
head_only_msg = "HEAD only formula must be installed to be livecheckable"
|
head_only_msg = "HEAD only formula must be installed to be livecheckable"
|
||||||
return status_hash(formula, "error", [head_only_msg], args: args) if args.json?
|
return status_hash(formula, "error", [head_only_msg], args: args) if args.json?
|
||||||
|
|
||||||
@ -346,7 +350,7 @@ module Homebrew
|
|||||||
if args.debug?
|
if args.debug?
|
||||||
puts
|
puts
|
||||||
puts "Formula: #{formula_name(formula, args: args)}"
|
puts "Formula: #{formula_name(formula, args: args)}"
|
||||||
puts "Head only?: true" if formula.head?
|
puts "Head only?: true" if formula.head_only?
|
||||||
puts "Livecheckable?: #{has_livecheckable ? "Yes" : "No"}"
|
puts "Livecheckable?: #{has_livecheckable ? "Yes" : "No"}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user