mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-06 22:24:12 -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.
|
||||
repos:
|
||||
- repo: https://github.com/rubocop/rubocop
|
||||
rev: v1.74.0
|
||||
rev: v1.76.0
|
||||
hooks:
|
||||
- id: rubocop
|
||||
- repo: https://github.com/syntaqx/git-hooks
|
||||
|
||||
15
.rubocop.yml
15
.rubocop.yml
@@ -108,14 +108,19 @@ Naming/ClassAndModuleCamelCase:
|
||||
Exclude:
|
||||
- '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.
|
||||
Naming/VariableName:
|
||||
EnforcedStyle: snake_case
|
||||
# Allow variable names which are in all caps (with optional numbers and underscores)
|
||||
AllowedPatterns:
|
||||
- '^@?[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
|
||||
else
|
||||
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
|
||||
else
|
||||
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
|
||||
|
||||
to_copy = force
|
||||
|
||||
@@ -73,7 +73,7 @@ class Pip < Package
|
||||
@py_pkg_deps.each do |pip_dep|
|
||||
@cleaned_py_dep = pip_dep[/[^;]+/]
|
||||
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
|
||||
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.
|
||||
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)
|
||||
pip_hard_reinstall unless @py_pkg_chromebrew_version == @pip_pkg_version
|
||||
if CREW_DEBUG
|
||||
@@ -92,16 +92,16 @@ class Pip < Package
|
||||
puts "A wheel for #{@py_pkg}==#{@py_pkg_chromebrew_version} was found!".lightblue
|
||||
else
|
||||
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.
|
||||
@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
|
||||
`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
|
||||
puts "@pip_wheel is #{@pip_wheel}" if CREW_DEBUG
|
||||
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...
|
||||
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
|
||||
|
||||
@@ -9,7 +9,7 @@ class Qmake < Package
|
||||
extend ReportBuildsystemMethods
|
||||
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'
|
||||
@qmake_build_extras&.call
|
||||
end
|
||||
|
||||
@@ -74,10 +74,10 @@ def downloader(url, sha256sum, filename = File.basename(url), verbose: false)
|
||||
FileUtils.rm_f filename
|
||||
|
||||
warn 'Checksum mismatch :/ Try again?'.lightred, <<~EOT
|
||||
#{''}
|
||||
Filename: #{filename.lightblue}
|
||||
Expected checksum (SHA256): #{sha256sum.green}
|
||||
Calculated checksum (SHA256): #{calc_sha256sum.red}
|
||||
|
||||
Filename: #{filename.lightblue}
|
||||
Expected checksum (SHA256): #{sha256sum.green}
|
||||
Calculated checksum (SHA256): #{calc_sha256sum.red}
|
||||
EOT
|
||||
|
||||
exit 2
|
||||
|
||||
@@ -70,7 +70,7 @@ class MiscFunctions
|
||||
else
|
||||
"#{time_minutes} min, "
|
||||
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
|
||||
end
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class Binutils < Package
|
||||
--enable-shared \
|
||||
--enable-threads \
|
||||
--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-lib-path=#{CREW_LIB_PREFIX} \
|
||||
--with-pic \
|
||||
|
||||
@@ -30,7 +30,7 @@ class Elfutils < Autotools
|
||||
|
||||
# -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_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
|
||||
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-readline \
|
||||
--with-system-zlib \
|
||||
#{ARCH == 'i686' ? '' : '--with-x'}"
|
||||
#{'--with-x' unless ARCH == 'i686'}"
|
||||
|
||||
def self.install
|
||||
system "make -C gdb DESTDIR=#{CREW_DEST_DIR} install"
|
||||
|
||||
@@ -130,7 +130,7 @@ class Graphicsmagick < Package
|
||||
--enable-static=no \
|
||||
--with-modules \
|
||||
--with-perl \
|
||||
#{%w[x86_64 aarch64 armv7l].include?(ARCH) ? '--with-x' : ''} \
|
||||
#{'--with-x' if %w[x86_64 aarch64 armv7l].include?(ARCH)} \
|
||||
--with-xml"
|
||||
system 'make'
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class Libdovi < Package
|
||||
|
||||
def self.build
|
||||
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
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class Ruby < Package
|
||||
LD=mold \
|
||||
./configure #{CREW_CONFIGURE_OPTIONS} \
|
||||
--enable-shared \
|
||||
#{ARCH == 'x86_64' ? '--enable-yjit' : ''} \
|
||||
#{'--enable-yjit' if ARCH == 'x86_64'} \
|
||||
--disable-fortify-source"
|
||||
system "MAKEFLAGS='--jobs #{CREW_NPROC}' make"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user