make env variables used by crew mostly booleans (#6634)

This commit is contained in:
Satadru Pramanik
2022-01-19 16:24:02 -05:00
committed by GitHub
parent d301642da1
commit 22aea2a1f3
8 changed files with 23 additions and 30 deletions

View File

@@ -952,7 +952,7 @@ def prepare_package(destdir)
Dir.foreach(CREW_DEST_PREFIX) do |filename|
next if filename == '.' or filename == '..'
unless @fhs_compliant_prefix.include?(filename)
if CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY == '1'
if CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY
puts "Warning: #{CREW_PREFIX}/#{filename} in #{@pkg.name} is not FHS3 compliant.".orange
else
puts "Error: #{CREW_PREFIX}/#{filename} in #{@pkg.name} is not FHS3 compliant.".lightred
@@ -968,7 +968,7 @@ def prepare_package(destdir)
conflicts << conflictscmd.gsub(/(\.filelist|#{CREW_META_PATH})/, '').split("\n")
conflicts.reject!(&:empty?)
unless conflicts.empty?
if CREW_CONFLICTS_ONLY_ADVISORY == '1'
if CREW_CONFLICTS_ONLY_ADVISORY
puts "Warning: There is a conflict with the same file in another package.".orange
else
puts "Error: There is a conflict with the same file in another package.".lightred
@@ -1021,7 +1021,7 @@ def strip_dir(dir)
end
def shrink_dir(dir)
unless CREW_SHRINK_ARCHIVE == '0'
unless CREW_NOT_SHRINK_ARCHIVE
Dir.chdir dir do
if File.exist?("#{CREW_PREFIX}/bin/rdfind")
puts "Using rdfind to convert duplicate files to hard links."
@@ -1413,7 +1413,7 @@ def build_package(pwd)
end
def archive_package(pwd)
unless CREW_USE_PIXZ == '0' || !File.exist?("#{CREW_PREFIX}/bin/pixz")
unless CREW_NOT_USE_PIXZ || !File.exist?("#{CREW_PREFIX}/bin/pixz")
puts "Using pixz to compress archive."
pkg_name = "#{@pkg.name}-#{@pkg.version}-chromeos-#{@device[:architecture]}.tpxz"
Dir.chdir CREW_DEST_DIR do

View File

@@ -1,6 +1,6 @@
# Defines common constants used in different parts of crew
CREW_VERSION = '1.21.3'
CREW_VERSION = '1.21.4'
ARCH_ACTUAL = `uname -m`.chomp
# This helps with virtualized builds on aarch64 machines
@@ -51,24 +51,19 @@ end
FileUtils.mkdir_p CREW_CACHE_DIR unless Dir.exist?(CREW_CACHE_DIR)
CREW_CACHE_ENABLED = ENV['CREW_CACHE_ENABLED']
CREW_CONFLICTS_ONLY_ADVISORY = ENV['CREW_CONFLICTS_ONLY_ADVISORY']
CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY = ENV['CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY']
# Set CREW_NPROC from environment variable or `nproc`
CREW_NPROC = ( ENV['CREW_NPROC'].to_s.empty? ) ? `nproc`.chomp : ENV['CREW_NPROC']
# Set CREW_NOT_COMPRESS from environment variable
CREW_NOT_COMPRESS = ENV['CREW_NOT_COMPRESS']
# Set CREW_NOT_STRIP from environment variable
CREW_NOT_STRIP = ENV['CREW_NOT_STRIP']
CREW_SHRINK_ARCHIVE = ENV['CREW_SHRINK_ARCHIVE']
CREW_LA_RENAME_ENABLED = ENV['CREW_LA_RENAME_ENABLED']
# Set following as boolean if environment variables exist.
CREW_CACHE_ENABLED = ENV['CREW_CACHE_ENABLED'] == 'true'
CREW_CONFLICTS_ONLY_ADVISORY = ENV['CREW_CONFLICTS_ONLY_ADVISORY'] == 'true'
CREW_DISABLE_ENV_OPTIONS = ENV['CREW_DISABLE_ENV_OPTIONS'] == 'true'
CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY = ENV['CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY'] == 'true'
CREW_LA_RENAME_ENABLED = ENV['CREW_LA_RENAME_ENABLED'] == 'true'
CREW_NOT_COMPRESS = ENV['CREW_NOT_COMPRESS'] == 'true'
CREW_NOT_STRIP = ENV['CREW_NOT_STRIP'] == 'true'
CREW_NOT_SHRINK_ARCHIVE = ENV['CREW_SHRINK_ARCHIVE'] == 'true'
CREW_NOT_USE_PIXZ = ENV['CREW_USE_PIXZ'] == 'true'
# Set testing constants from environment variables
CREW_TESTING_BRANCH = ENV['CREW_TESTING_BRANCH']
@@ -76,7 +71,6 @@ CREW_TESTING_REPO = ENV['CREW_TESTING_REPO']
CREW_TESTING = ( CREW_TESTING_BRANCH.to_s.empty? or CREW_TESTING_REPO.to_s.empty? ) ? '0' : ENV['CREW_TESTING']
CREW_USE_PIXZ = ENV['CREW_USE_PIXZ']
USER = `whoami`.chomp
@@ -127,7 +121,6 @@ CREW_COMMON_FNO_LTO_FLAGS = '-O2 -pipe -fno-lto -fPIC -fuse-ld=gold'
CREW_LDFLAGS = '-flto'
CREW_FNO_LTO_LDFLAGS = '-fno-lto'
CREW_DISABLE_ENV_OPTIONS = ENV['CREW_DISABLE_ENV_OPTIONS']
unless CREW_DISABLE_ENV_OPTIONS
CREW_ENV_OPTIONS_HASH = {
'CFLAGS' => CREW_COMMON_FLAGS,

View File

@@ -15,7 +15,7 @@ class Brave < Package
depends_on 'sommelier' # The hardware acceleration with Wayland is broken, so use x11
def self.install
ENV['CREW_SHRINK_ARCHIVE'] = '0'
ENV['CREW_NOT_SHRINK_ARCHIVE'] = '1'
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/brave"
FileUtils.cp_r '.', "#{CREW_DEST_PREFIX}/share/brave"

View File

@@ -45,7 +45,7 @@ class Codium < Package
depends_on 'sommelier'
def self.install
ENV['CREW_SHRINK_ARCHIVE'] = '0'
ENV['CREW_NOT_SHRINK_ARCHIVE'] = '1'
ENV['CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY'] = '1'
warn_level = $VERBOSE
$VERBOSE = nil

View File

@@ -29,7 +29,7 @@ class Gcloud < Package
end
def self.install
ENV['CREW_SHRINK_ARCHIVE'] = '0'
ENV['CREW_NOT_SHRINK_ARCHIVE'] = '1'
warn_level = $VERBOSE
$VERBOSE = nil
load "#{CREW_LIB_PATH}lib/const.rb"

View File

@@ -35,7 +35,7 @@ class Musl_native_toolchain < Package
def self.install
ENV['CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY'] = '1'
ENV['CREW_NOT_STRIP'] = '1'
ENV['CREW_SHRINK_ARCHIVE'] = '0'
ENV['CREW_NOT_SHRINK_ARCHIVE'] = '1'
warn_level = $VERBOSE
$VERBOSE = nil
load "#{CREW_LIB_PATH}lib/const.rb"

View File

@@ -21,9 +21,9 @@ class Natron < Package
depends_on 'sommelier'
@strip = ENV['CREW_NOT_STRIP']
@shrink = ENV['CREW_SHRINK_ARCHIVE']
@shrink = ENV['CREW_NOT_SHRINK_ARCHIVE']
ENV['CREW_NOT_STRIP'] = '1'
ENV['CREW_SHRINK_ARCHIVE'] = '0'
ENV['CREW_NOT_SHRINK_ARCHIVE'] = '1'
def self.install
# IMPORTANT BUILD/INSTALL FROM SOURCE INSTRUCTIONS BELOW:
@@ -52,6 +52,6 @@ class Natron < Package
end
end
ENV['CREW_SHRINK_ARCHIVE'] = @shrink
ENV['CREW_NOT_SHRINK_ARCHIVE'] = @shrink
ENV['CREW_NOT_STRIP'] = @strip
end

View File

@@ -25,7 +25,7 @@ class Teams < Package
end
def self.install
ENV['CREW_SHRINK_ARCHIVE'] = '0'
ENV['CREW_NOT_SHRINK_ARCHIVE'] = '1'
warn_level = $VERBOSE
$VERBOSE = nil
load "#{CREW_LIB_PATH}lib/const.rb"