Commit 003b8772 authored by satmandu's avatar satmandu Committed by GitHub

Automatically generate constants list for crew const (#5796)

* Automatically generate constants list for crew const

* Document code
parent 6622da08
...@@ -402,45 +402,44 @@ def const(var) ...@@ -402,45 +402,44 @@ def const(var)
value = eval(var) value = eval(var)
puts "#{var}=#{value}" puts "#{var}=#{value}"
else else
vars = [ @ruby_default_constants = %w[
'ARCH', ARGF
'ARCH_LIB', ARGV
'CHROMEOS_RELEASE', CROSS_COMPILING
'CURL', DOC
'CREW_BREW_DIR', ENV
'CREW_BUILD', GC
'CREW_CMAKE_LIBSUFFIX_OPTIONS', IO
'CREW_CMAKE_OPTIONS', JSON
'CREW_CONFIG_PATH', OpenSSL
'CREW_DEST_DIR', Q
'CREW_DEST_HOME', R
'CREW_DEST_LIB_PREFIX', RUBY_COPYRIGHT
'CREW_DEST_MAN_PREFIX', RUBY_DESCRIPTION
'CREW_DEST_PREFIX', RUBY_ENGINE
'CREW_LIB_PATH', RUBY_ENGINE_VERSION
'CREW_LIB_PREFIX', RUBYGEMS_ACTIVATION_MONITOR
'CREW_LIB_SUFFIX', RUBY_PATCHLEVEL
'CREW_MAN_PREFIX', RUBY_PLATFORM
'CREW_COMMON_FLAGS', RUBY_RELEASE_DATE
'CREW_COMMON_FNO_LTO_FLAGS', RUBY_REVISION
'CREW_ENV_OPTIONS', RUBY_VERSION
'CREW_MESON_FNO_LTO_OPTIONS', RubyVM
'CREW_MESON_OPTIONS', S
'CREW_META_PATH', STDERR
'CREW_NOT_COMPRESS', STDIN
'CREW_NOT_STRIP', STDOUT
'CREW_NPROC', StringIO
'CREW_OPTIONS', TOPLEVEL_BINDING
'CREW_PACKAGES_PATH', URI
'CREW_PREFIX',
'CREW_TGT',
'CREW_VERSION',
'HOME',
'LIBC_VERSION',
'USER'
] ]
vars.each { |var| # Get all constants
value = eval(var) @constants = Module.constants.select {|e| e =~ /[[:upper:]]$/}
# Reject all constants which match the default list
@constants = @constants.map(&:to_s).reject{ |e| @ruby_default_constants.find{ |f| /\A#{e}\z/ =~ f }}
# Print a sorted list of the remaining constants used by crew.
@constants.sort.each { |var|
value = eval(var.to_s)
puts "#{var}=#{value}" puts "#{var}=#{value}"
} }
end end
......
# Defines common constants used in different parts of crew # Defines common constants used in different parts of crew
CREW_VERSION = '1.10.3' CREW_VERSION = '1.10.4'
ARCH_ACTUAL = `uname -m`.strip ARCH_ACTUAL = `uname -m`.strip
# This helps with virtualized builds on aarch64 machines # This helps with virtualized builds on aarch64 machines
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment