deprecate SHA1
This commit is contained in:
parent
93cbab0021
commit
bd7e8543b3
@ -2,7 +2,7 @@ class Checksum
|
|||||||
attr_reader :hash_type, :hexdigest
|
attr_reader :hash_type, :hexdigest
|
||||||
alias_method :to_s, :hexdigest
|
alias_method :to_s, :hexdigest
|
||||||
|
|
||||||
TYPES = [:sha1, :sha256]
|
TYPES = [:sha256]
|
||||||
|
|
||||||
def initialize(hash_type, hexdigest)
|
def initialize(hash_type, hexdigest)
|
||||||
@hash_type = hash_type
|
@hash_type = hash_type
|
||||||
|
@ -5,6 +5,7 @@ require "compat/formula_specialties"
|
|||||||
require "compat/hardware"
|
require "compat/hardware"
|
||||||
require "compat/macos"
|
require "compat/macos"
|
||||||
require "compat/md5"
|
require "compat/md5"
|
||||||
|
require "compat/sha1"
|
||||||
require "compat/requirements"
|
require "compat/requirements"
|
||||||
require "compat/version"
|
require "compat/version"
|
||||||
require "compat/download_strategy"
|
require "compat/download_strategy"
|
||||||
|
35
Library/Homebrew/compat/sha1.rb
Normal file
35
Library/Homebrew/compat/sha1.rb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
class Formula
|
||||||
|
def self.sha1(val)
|
||||||
|
stable.sha1(val)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class SoftwareSpec
|
||||||
|
def sha1(val)
|
||||||
|
@resource.sha1(val)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Resource
|
||||||
|
def sha1(val)
|
||||||
|
@checksum = Checksum.new(:sha1, val)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class BottleSpecification
|
||||||
|
def sha1(val)
|
||||||
|
digest, tag = val.shift
|
||||||
|
collector[tag] = Checksum.new(:sha1, digest)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Pathname
|
||||||
|
def sha1
|
||||||
|
require "digest/sha1"
|
||||||
|
opoo <<-EOS.undent
|
||||||
|
SHA1 support is deprecated and will be removed in a future version.
|
||||||
|
Please switch this formula to SHA256.
|
||||||
|
EOS
|
||||||
|
incremental_hash(Digest::SHA1)
|
||||||
|
end
|
||||||
|
end
|
@ -300,12 +300,6 @@ class Pathname
|
|||||||
digest.hexdigest
|
digest.hexdigest
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
|
||||||
def sha1
|
|
||||||
require "digest/sha1"
|
|
||||||
incremental_hash(Digest::SHA1)
|
|
||||||
end
|
|
||||||
|
|
||||||
def sha256
|
def sha256
|
||||||
require "digest/sha2"
|
require "digest/sha2"
|
||||||
incremental_hash(Digest::SHA2)
|
incremental_hash(Digest::SHA2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user