mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 15:37:56 -05:00
More python cleanups (#10452)
* Add unit tests for conflicting package properties * Fix the reported issues
This commit is contained in:
committed by
GitHub
parent
1fc45a2322
commit
7325468db2
@@ -9,12 +9,29 @@ $LOAD_PATH.unshift File.join(CREW_LIB_PATH, 'lib')
|
||||
|
||||
def check_properties(name)
|
||||
puts "Checking #{name} package ...".yellow
|
||||
puts "#{name} is missing a description.".lightred if @pkg.description.to_s.empty?
|
||||
puts "#{name} is missing a homepage.".lightred if @pkg.homepage.to_s.empty?
|
||||
puts "#{name} is missing a version.".lightred if @pkg.version.to_s.empty?
|
||||
puts "#{name} is missing a license.".lightred if @pkg.license.to_s.empty?
|
||||
puts "#{name} is missing a compatibility.".lightred if @pkg.compatibility.to_s.empty?
|
||||
if @pkg.description.to_s.empty? || @pkg.homepage.to_s.empty? || @pkg.version.to_s.empty? || @pkg.license.to_s.empty? || @pkg.compatibility.to_s.empty?
|
||||
# List out all the possible failure states
|
||||
empty_description = @pkg.description.to_s.empty?
|
||||
empty_homepage = @pkg.homepage.to_s.empty?
|
||||
empty_version = @pkg.version.to_s.empty?
|
||||
empty_license = @pkg.license.to_s.empty?
|
||||
empty_compatibility = @pkg.compatibility.to_s.empty?
|
||||
# Certain fake packages set up to act as aliases (we should probably move on from these) do not have source_url values.
|
||||
empty_source_url = @pkg.source_url.to_s.empty? && !@pkg.is_fake?
|
||||
both_binary_compression_and_no_compile_needed = @pkg.no_compile_needed? && !@pkg.binary_compression.to_s.empty?
|
||||
non_skip_source_url_and_no_source_build = @pkg.no_source_build? && !@pkg.source_url.eql?('SKIP')
|
||||
|
||||
# Tell the user what specific test fiailed.
|
||||
puts "#{name} is missing a description.".lightred if empty_description
|
||||
puts "#{name} is missing a homepage.".lightred if empty_homepage
|
||||
puts "#{name} is missing a version.".lightred if empty_version
|
||||
puts "#{name} is missing a license.".lightred if empty_license
|
||||
puts "#{name} is missing a compatibility.".lightred if empty_compatibility
|
||||
puts "#{name} is missing a source_url.".lightred if empty_source_url
|
||||
puts "#{name} has a binary_compression value and a no_compile_needed value." if both_binary_compression_and_no_compile_needed
|
||||
puts "#{name} has a non-SKIP source_url and a no_source_build value." if non_skip_source_url_and_no_source_build
|
||||
|
||||
# Check that if the tests passed.
|
||||
if empty_description || empty_homepage || empty_version || empty_license || empty_compatibility || empty_source_url || both_binary_compression_and_no_compile_needed || non_skip_source_url_and_no_source_build
|
||||
puts "Property tests for #{name} failed.".lightred
|
||||
@tofail += 1
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user