mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-08 23:18:10 -05:00
Run rubocop 1.76.0 on tree (#11998)
This commit is contained in:
committed by
GitHub
parent
3b9bffbe1d
commit
75bc603418
@@ -3,7 +3,7 @@
|
|||||||
# These pre-commit hooks mirror the Github CI, so running them locally will catch errors earlier.
|
# These pre-commit hooks mirror the Github CI, so running them locally will catch errors earlier.
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/rubocop/rubocop
|
- repo: https://github.com/rubocop/rubocop
|
||||||
rev: v1.74.0
|
rev: v1.76.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: rubocop
|
- id: rubocop
|
||||||
- repo: https://github.com/syntaqx/git-hooks
|
- repo: https://github.com/syntaqx/git-hooks
|
||||||
|
|||||||
15
.rubocop.yml
15
.rubocop.yml
@@ -108,14 +108,19 @@ Naming/ClassAndModuleCamelCase:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'packages/*'
|
- 'packages/*'
|
||||||
|
|
||||||
|
# If there is meaningful information to convey about the contents of a heredoc, a comment is the best way to do it.
|
||||||
|
# Forcing unique names for all heredoc delimiters does not improve documentation in the vast majority of cases.
|
||||||
|
Naming/HeredocDelimiterNaming:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Many predicate methods (methods returning either true or false) are made more readable by having an ? at the end, but not all.
|
||||||
|
# A manual inspection should suffice to determine which is which.
|
||||||
|
Naming/PredicateMethod:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# We allow all caps variables to mirror our constants, so things like @ARCH_LDFLAGS are allowed.
|
# We allow all caps variables to mirror our constants, so things like @ARCH_LDFLAGS are allowed.
|
||||||
Naming/VariableName:
|
Naming/VariableName:
|
||||||
EnforcedStyle: snake_case
|
EnforcedStyle: snake_case
|
||||||
# Allow variable names which are in all caps (with optional numbers and underscores)
|
# Allow variable names which are in all caps (with optional numbers and underscores)
|
||||||
AllowedPatterns:
|
AllowedPatterns:
|
||||||
- '^@?[A-Z0-9_]+$'
|
- '^@?[A-Z0-9_]+$'
|
||||||
|
|
||||||
# If there is meaningful information to convey about the contents of a heredoc, a comment is the best way to do it.
|
|
||||||
# Forcing unique names for all heredoc delimiters does not improve documentation in the vast majority of cases.
|
|
||||||
Naming/HeredocDelimiterNaming:
|
|
||||||
Enabled: false
|
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ class Command
|
|||||||
system "rubocop -c #{File.join(CREW_LOCAL_REPO_ROOT, '.rubocop.yml')} -A #{local_package}", exception: true
|
system "rubocop -c #{File.join(CREW_LOCAL_REPO_ROOT, '.rubocop.yml')} -A #{local_package}", exception: true
|
||||||
else
|
else
|
||||||
puts 'The configuration file for rubocop in .rubocop.yml, from the rubocop-chromebrew gem, was not found.'.lightred
|
puts 'The configuration file for rubocop in .rubocop.yml, from the rubocop-chromebrew gem, was not found.'.lightred
|
||||||
puts 'To install rubocop-chromebrew, run the following command: '.lightred + "crew #{PackageUtils.installed?('ruby_rubocop_chromebrew') ? 're' : ''}install ruby_rubocop_chromebrew".lightblue
|
puts 'To install rubocop-chromebrew, run the following command: '.lightred + "crew #{'re' if PackageUtils.installed?('ruby_rubocop_chromebrew')}install ruby_rubocop_chromebrew".lightblue
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
puts "Rubocop is not installed, and thus will not be used to sanitize #{local_package}".lightred
|
puts "Rubocop is not installed, and thus will not be used to sanitize #{local_package}".lightred
|
||||||
puts 'To install Rubocop, run the following command: '.lightred + "crew #{PackageUtils.installed?('ruby_rubocop') ? 're' : ''}install ruby_rubocop".lightblue
|
puts 'To install Rubocop, run the following command: '.lightred + "crew #{'re' if PackageUtils.installed?('ruby_rubocop')}install ruby_rubocop".lightblue
|
||||||
end
|
end
|
||||||
|
|
||||||
to_copy = force
|
to_copy = force
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class Pip < Package
|
|||||||
@py_pkg_deps.each do |pip_dep|
|
@py_pkg_deps.each do |pip_dep|
|
||||||
@cleaned_py_dep = pip_dep[/[^;]+/]
|
@cleaned_py_dep = pip_dep[/[^;]+/]
|
||||||
puts "——Installing: #{@cleaned_py_dep}".gray
|
puts "——Installing: #{@cleaned_py_dep}".gray
|
||||||
system "PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python3 -s -m pip install #{@pip_resume_retries} #{prerelease? ? '--pre' : ''} --ignore-installed -U \"#{@cleaned_py_dep}\" | grep -v 'Requirement already satisfied'", exception: false
|
system "PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python3 -s -m pip install #{@pip_resume_retries} #{'--pre' if prerelease?} --ignore-installed -U \"#{@cleaned_py_dep}\" | grep -v 'Requirement already satisfied'", exception: false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts "Installing #{@py_pkg} python module. This may take a while...".lightblue
|
puts "Installing #{@py_pkg} python module. This may take a while...".lightblue
|
||||||
@@ -81,7 +81,7 @@ class Pip < Package
|
|||||||
|
|
||||||
# Build wheel if pip install fails, since that implies a wheel isn't available.
|
# Build wheel if pip install fails, since that implies a wheel isn't available.
|
||||||
puts "Trying to install #{@py_pkg}==#{@py_pkg_chromebrew_version}" if CREW_DEBUG
|
puts "Trying to install #{@py_pkg}==#{@py_pkg_chromebrew_version}" if CREW_DEBUG
|
||||||
Kernel.system "PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 MAKEFLAGS=-j#{CREW_NPROC} #{@pip_pre_configure_options} python3 -s -m pip install #{@pip_resume_retries} --no-warn-conflicts --force-reinstall #{prerelease? ? '--pre' : ''} --no-deps --ignore-installed -U --only-binary :all: #{@py_pkg}==#{@py_pkg_chromebrew_version}"
|
Kernel.system "PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 MAKEFLAGS=-j#{CREW_NPROC} #{@pip_pre_configure_options} python3 -s -m pip install #{@pip_resume_retries} --no-warn-conflicts --force-reinstall #{'--pre' if prerelease?} --no-deps --ignore-installed -U --only-binary :all: #{@py_pkg}==#{@py_pkg_chromebrew_version}"
|
||||||
get_pip_info(@py_pkg)
|
get_pip_info(@py_pkg)
|
||||||
pip_hard_reinstall unless @py_pkg_chromebrew_version == @pip_pkg_version
|
pip_hard_reinstall unless @py_pkg_chromebrew_version == @pip_pkg_version
|
||||||
if CREW_DEBUG
|
if CREW_DEBUG
|
||||||
@@ -92,16 +92,16 @@ class Pip < Package
|
|||||||
puts "A wheel for #{@py_pkg}==#{@py_pkg_chromebrew_version} was found!".lightblue
|
puts "A wheel for #{@py_pkg}==#{@py_pkg_chromebrew_version} was found!".lightblue
|
||||||
else
|
else
|
||||||
puts "A wheel for #{@py_pkg}==#{@py_pkg_chromebrew_version} was unavailable, so we will build a wheel.".orange
|
puts "A wheel for #{@py_pkg}==#{@py_pkg_chromebrew_version} was unavailable, so we will build a wheel.".orange
|
||||||
system "PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python3 -m pip install #{@pip_resume_retries} #{prerelease? ? '--pre' : ''} --force-reinstall --upgrade '#{@py_pkg}==#{@py_pkg_chromebrew_version}'" unless prerelease?
|
system "PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python3 -m pip install #{@pip_resume_retries} #{'--pre' if prerelease?} --force-reinstall --upgrade '#{@py_pkg}==#{@py_pkg_chromebrew_version}'" unless prerelease?
|
||||||
# Assume all pip non-SKIP sources are git.
|
# Assume all pip non-SKIP sources are git.
|
||||||
@pip_wheel = if @source_url == 'SKIP'
|
@pip_wheel = if @source_url == 'SKIP'
|
||||||
`PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 MAKEFLAGS=-j#{CREW_NPROC} #{@pip_pre_configure_options} python3 -m pip wheel #{prerelease? ? '--pre' : ''} -w #{@pip_cache_dir} #{@py_pkg}==#{@py_pkg_version}`[/(?<=filename=)(.*)*?(\S+)/, 0]
|
`PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 MAKEFLAGS=-j#{CREW_NPROC} #{@pip_pre_configure_options} python3 -m pip wheel #{'--pre' if prerelease?} -w #{@pip_cache_dir} #{@py_pkg}==#{@py_pkg_version}`[/(?<=filename=)(.*)*?(\S+)/, 0]
|
||||||
else
|
else
|
||||||
`PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 MAKEFLAGS=-j#{CREW_NPROC} #{@pip_pre_configure_options} python3 -m pip wheel #{prerelease? ? '--pre' : ''} -w #{@pip_cache_dir} git+#{source_url}`[/(?<=filename=)(.*)*?(\S+)/, 0]
|
`PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 MAKEFLAGS=-j#{CREW_NPROC} #{@pip_pre_configure_options} python3 -m pip wheel #{'--pre' if prerelease?} -w #{@pip_cache_dir} git+#{source_url}`[/(?<=filename=)(.*)*?(\S+)/, 0]
|
||||||
end
|
end
|
||||||
puts "@pip_wheel is #{@pip_wheel}" if CREW_DEBUG
|
puts "@pip_wheel is #{@pip_wheel}" if CREW_DEBUG
|
||||||
FileUtils.install File.join(@pip_cache_dir, @pip_wheel), @pip_cache_dest_dir
|
FileUtils.install File.join(@pip_cache_dir, @pip_wheel), @pip_cache_dest_dir
|
||||||
Kernel.system "python3 -m pip install #{prerelease? ? '--pre' : ''} --force-reinstall --upgrade #{File.join(@pip_cache_dir, @pip_wheel)}"
|
Kernel.system "python3 -m pip install #{'--pre' if prerelease?} --force-reinstall --upgrade #{File.join(@pip_cache_dir, @pip_wheel)}"
|
||||||
# Check the just-installed package...
|
# Check the just-installed package...
|
||||||
if get_pip_info(@py_pkg)
|
if get_pip_info(@py_pkg)
|
||||||
puts "Note that #{@py_pkg}==#{@pip_pkg_version} is installed, which is different from the #{@py_pkg_chromebrew_version}. Please update the package file.".lightpurple if @py_pkg_chromebrew_version != @pip_pkg_version
|
puts "Note that #{@py_pkg}==#{@pip_pkg_version} is installed, which is different from the #{@py_pkg_chromebrew_version}. Please update the package file.".lightpurple if @py_pkg_chromebrew_version != @pip_pkg_version
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Qmake < Package
|
|||||||
extend ReportBuildsystemMethods
|
extend ReportBuildsystemMethods
|
||||||
print_buildsystem_methods
|
print_buildsystem_methods
|
||||||
|
|
||||||
system "QMAKE_CXX='g++ #{ARCH == 'x86_64' && Gem::Version.new(LIBC_VERSION.to_s) >= Gem::Version.new('2.35') ? File.join(CREW_LIB_PREFIX, 'libC.so.6').to_s : ''}' qmake"
|
system "QMAKE_CXX='g++ #{File.join(CREW_LIB_PREFIX, 'libC.so.6').to_s if ARCH == 'x86_64' && Gem::Version.new(LIBC_VERSION.to_s) >= Gem::Version.new('2.35')}' qmake"
|
||||||
system 'make'
|
system 'make'
|
||||||
@qmake_build_extras&.call
|
@qmake_build_extras&.call
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ def downloader(url, sha256sum, filename = File.basename(url), verbose: false)
|
|||||||
FileUtils.rm_f filename
|
FileUtils.rm_f filename
|
||||||
|
|
||||||
warn 'Checksum mismatch :/ Try again?'.lightred, <<~EOT
|
warn 'Checksum mismatch :/ Try again?'.lightred, <<~EOT
|
||||||
#{''}
|
|
||||||
Filename: #{filename.lightblue}
|
Filename: #{filename.lightblue}
|
||||||
Expected checksum (SHA256): #{sha256sum.green}
|
Expected checksum (SHA256): #{sha256sum.green}
|
||||||
Calculated checksum (SHA256): #{calc_sha256sum.red}
|
Calculated checksum (SHA256): #{calc_sha256sum.red}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class MiscFunctions
|
|||||||
else
|
else
|
||||||
"#{time_minutes} min, "
|
"#{time_minutes} min, "
|
||||||
end
|
end
|
||||||
time_seconds_string = "#{time_seconds} second#{time_seconds == 1 ? '' : 's'}"
|
time_seconds_string = "#{time_seconds} second#{'s' unless time_seconds == 1}"
|
||||||
return time_hour_string + time_minutes_string + time_seconds_string
|
return time_hour_string + time_minutes_string + time_seconds_string
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class Binutils < Package
|
|||||||
--enable-shared \
|
--enable-shared \
|
||||||
--enable-threads \
|
--enable-threads \
|
||||||
--enable-vtable-verify \
|
--enable-vtable-verify \
|
||||||
#{ARCH == 'i686' || ARCH == 'x86_64' ? '--disable-gprofng' : ''} \
|
#{'--disable-gprofng' if ARCH == 'i686' || ARCH == 'x86_64'} \
|
||||||
--with-bugurl=https://github.com/chromebrew/chromebrew/issues/new \
|
--with-bugurl=https://github.com/chromebrew/chromebrew/issues/new \
|
||||||
--with-lib-path=#{CREW_LIB_PREFIX} \
|
--with-lib-path=#{CREW_LIB_PREFIX} \
|
||||||
--with-pic \
|
--with-pic \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Elfutils < Autotools
|
|||||||
|
|
||||||
# -D_FORTIFY_SOURCE=0 needed due to -O3 optimization.
|
# -D_FORTIFY_SOURCE=0 needed due to -O3 optimization.
|
||||||
autotools_pre_configure_options "CFLAGS+=' -Wno-error -D_FORTIFY_SOURCE=0' CXXFLAGS+=' -Wno-error -D_FORTIFY_SOURCE=0'"
|
autotools_pre_configure_options "CFLAGS+=' -Wno-error -D_FORTIFY_SOURCE=0' CXXFLAGS+=' -Wno-error -D_FORTIFY_SOURCE=0'"
|
||||||
autotools_configure_options "#{ARCH == 'i686' ? '--disable-libdebuginfod --disable-debuginfod' : ''} --enable-maintainer-mode --program-prefix='eu-'"
|
autotools_configure_options "#{'--disable-libdebuginfod --disable-debuginfod' if ARCH == 'i686'} --enable-maintainer-mode --program-prefix='eu-'"
|
||||||
|
|
||||||
def self.patch
|
def self.patch
|
||||||
downloader 'https://raw.githubusercontent.com/openwrt/openwrt/refs/heads/main/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch', 'bd81d483ed5474fd7e87a27e4c961bf8670f76c45f5fe9a273cb2f11d8f44ffc'
|
downloader 'https://raw.githubusercontent.com/openwrt/openwrt/refs/heads/main/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch', 'bd81d483ed5474fd7e87a27e4c961bf8670f76c45f5fe9a273cb2f11d8f44ffc'
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class Gdb < Autotools
|
|||||||
--with-system-gdbinit=#{CREW_PREFIX}/etc/gdb/gdbinit \
|
--with-system-gdbinit=#{CREW_PREFIX}/etc/gdb/gdbinit \
|
||||||
--with-system-readline \
|
--with-system-readline \
|
||||||
--with-system-zlib \
|
--with-system-zlib \
|
||||||
#{ARCH == 'i686' ? '' : '--with-x'}"
|
#{'--with-x' unless ARCH == 'i686'}"
|
||||||
|
|
||||||
def self.install
|
def self.install
|
||||||
system "make -C gdb DESTDIR=#{CREW_DEST_DIR} install"
|
system "make -C gdb DESTDIR=#{CREW_DEST_DIR} install"
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class Graphicsmagick < Package
|
|||||||
--enable-static=no \
|
--enable-static=no \
|
||||||
--with-modules \
|
--with-modules \
|
||||||
--with-perl \
|
--with-perl \
|
||||||
#{%w[x86_64 aarch64 armv7l].include?(ARCH) ? '--with-x' : ''} \
|
#{'--with-x' if %w[x86_64 aarch64 armv7l].include?(ARCH)} \
|
||||||
--with-xml"
|
--with-xml"
|
||||||
system 'make'
|
system 'make'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Libdovi < Package
|
|||||||
|
|
||||||
def self.build
|
def self.build
|
||||||
Dir.chdir('dolby_vision') do
|
Dir.chdir('dolby_vision') do
|
||||||
system "#{ARCH == 'x86_64' ? 'RUSTFLAGS="-C target-cpu=x86-64-v3"' : ''} cargo build --release"
|
system "#{'RUSTFLAGS="-C target-cpu=x86-64-v3"' if ARCH == 'x86_64'} cargo build --release"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Ruby < Package
|
|||||||
LD=mold \
|
LD=mold \
|
||||||
./configure #{CREW_CONFIGURE_OPTIONS} \
|
./configure #{CREW_CONFIGURE_OPTIONS} \
|
||||||
--enable-shared \
|
--enable-shared \
|
||||||
#{ARCH == 'x86_64' ? '--enable-yjit' : ''} \
|
#{'--enable-yjit' if ARCH == 'x86_64'} \
|
||||||
--disable-fortify-source"
|
--disable-fortify-source"
|
||||||
system "MAKEFLAGS='--jobs #{CREW_NPROC}' make"
|
system "MAKEFLAGS='--jobs #{CREW_NPROC}' make"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user