audit: whitelist unstable versions already in core

also allow higher stable versions with the same version prefix
This commit is contained in:
ilovezfs 2017-01-13 16:26:59 -08:00
parent 1442a0aa7f
commit 9dca10f9dc

View File

@ -678,11 +678,47 @@ class FormulaAuditor
end end
end end
unstable_whitelist = %w[
aalib 1.4rc5
automysqlbackup 3.0-rc6
aview 1.3.0rc1
distcc 3.2rc1
elm-format 0.5.2-alpha
ftgl 2.1.3-rc5
hidapi 0.8.0-rc1
libcaca 0.99b19
premake 4.4-beta5
pwnat 0.3-beta
pxz 4.999.9
recode 3.7-beta2
speexdsp 1.2rc3
sqoop 1.4.6
tcptraceroute 1.5beta7
testssl 2.8rc3
tiny-fugue 5.0b8
vbindiff 3.0_beta4
].each_slice(2).to_a.map do |formula, version|
[formula, version.sub(/\d+$/, "")]
end
gnome_devel_whitelist = %w[
gtk-doc 1.25
libart 2.3.21
pygtkglext 1.1.0
].each_slice(2).to_a.map do |formula, version|
[formula, version.split(".")[0..1].join(".")]
end
stable = formula.stable stable = formula.stable
case stable && stable.url case stable && stable.url
when /[\d\._-](alpha|beta|rc\d)/ when /[\d\._-](alpha|beta|rc\d)/
problem "Stable version URLs should not contain #{$1}" matched = $1
version_prefix = stable.version.to_s.sub(/\d+$/, "")
return if unstable_whitelist.include?([formula.name, version_prefix])
problem "Stable version URLs should not contain #{matched}"
when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i when %r{download\.gnome\.org/sources}, %r{ftp\.gnome\.org/pub/GNOME/sources}i
version_prefix = stable.version.to_s.split(".")[0..1].join(".")
return if gnome_devel_whitelist.include?([formula.name, version_prefix])
version = Version.parse(stable.url) version = Version.parse(stable.url)
if version >= Version.create("1.0") if version >= Version.create("1.0")
minor_version = version.to_s.split(".", 3)[1].to_i minor_version = version.to_s.split(".", 3)[1].to_i