mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 15:37:56 -05:00
crew: Fix verbose mode (#4982)
* Add files via upload * Fix 'I don't understand' in install.sh * Update crew * Update const.rb Co-authored-by: supechicken666 <68530202+supechicken666@users.noreply.github.com>
This commit is contained in:
57
crew
57
crew
@@ -80,11 +80,13 @@ end
|
||||
@opt_verbose = args["--verbose"]
|
||||
|
||||
if @opt_verbose then
|
||||
@fileutils_verbose = ', verbose: true'
|
||||
@verbose = '-v'
|
||||
@fileutils_verbose = true
|
||||
@verbose = 'v'
|
||||
@mv_verbose = '-v'
|
||||
else
|
||||
@fileutils_verbose = ''
|
||||
@fileutils_verbose = false
|
||||
@verbose = ''
|
||||
@mv_verbose = ''
|
||||
end
|
||||
|
||||
@opt_src = args["--build-from-source"]
|
||||
@@ -510,11 +512,11 @@ def download
|
||||
end
|
||||
Dir.chdir CREW_BREW_DIR do
|
||||
if ENV['CREW_CACHE_OPT']
|
||||
FileUtils.mkdir_p CREW_CACHE_DIR
|
||||
FileUtils.mkdir_p CREW_CACHE_DIR, verbose: @fileutils_verbose
|
||||
cachefile = CREW_CACHE_DIR + filename
|
||||
if File.file?(cachefile)
|
||||
if Digest::SHA256.hexdigest( File.read(cachefile) ) == sha256sum then
|
||||
FileUtils.cp cachefile, CREW_BREW_DIR
|
||||
FileUtils.cp cachefile, CREW_BREW_DIR, verbose: @fileutils_verbose
|
||||
puts "Archive found in cache".lightgreen
|
||||
return {source: source, filename: filename}
|
||||
else
|
||||
@@ -523,7 +525,7 @@ def download
|
||||
end
|
||||
end
|
||||
|
||||
system "curl #{@verbose} --retry 3 --progress-bar -C - --insecure -L #{url} '-o' #{filename}"
|
||||
system "curl --retry 3 -#{@verbose}#LC - --insecure \'#{url}\' --output #{filename}"
|
||||
|
||||
abort 'Checksum mismatch. :/ Try again.'.lightred unless
|
||||
Digest::SHA256.hexdigest( File.read(filename) ) == sha256sum
|
||||
@@ -531,7 +533,7 @@ def download
|
||||
|
||||
if ENV['CREW_CACHE_OPT']
|
||||
puts 'Caching downloaded archive'.lightgreen
|
||||
FileUtils.cp filename, CREW_CACHE_DIR
|
||||
FileUtils.cp filename, CREW_CACHE_DIR, verbose: @fileutils_verbose
|
||||
end
|
||||
end
|
||||
return {source: source, filename: filename}
|
||||
@@ -541,7 +543,7 @@ def unpack (meta)
|
||||
extract_dir = meta[:filename] + '.dir'
|
||||
target_dir = nil
|
||||
Dir.chdir CREW_BREW_DIR do
|
||||
FileUtils.mkdir_p extract_dir
|
||||
FileUtils.mkdir_p extract_dir, verbose: @fileutils_verbose
|
||||
case File.basename meta[:filename]
|
||||
when /\.zip$/i
|
||||
puts "Unpacking archive using 'unzip', this may take a while..."
|
||||
@@ -549,9 +551,9 @@ def unpack (meta)
|
||||
system 'unzip', _verbopt, '-d', extract_dir, meta[:filename]
|
||||
when /\.(tar(\.(gz|bz2|xz|lz))?|tgz|tbz|txz)$/i
|
||||
puts "Unpacking archive using 'tar', this may take a while..."
|
||||
_verbopt = @opt_verbose ? 'v' : ''
|
||||
system 'tar', "x#{_verbopt}f", meta[:filename], '-C', extract_dir
|
||||
end
|
||||
FileUtils.mkdir extract_dir unless Dir.exist?(extract_dir)
|
||||
system "tar x#{@verbose}f #{meta[:filename]} -C #{extract_dir}"
|
||||
end
|
||||
if meta[:source] == true
|
||||
# Check the number of directories in the archive
|
||||
entries = Dir["#{extract_dir}/*"]
|
||||
@@ -582,7 +584,8 @@ def build_and_preconfigure (target_dir)
|
||||
# See https://gnunet.org/faq-la-files and
|
||||
# https://stackoverflow.com/questions/42963653/libquadmath-la-is-not-a-valid-libtool-archive-when-configuring-openmpi-with-g
|
||||
puts 'Rename all *.la files to *.la_tmp'.lightblue
|
||||
system "find #{CREW_LIB_PREFIX} -type f -name *.la -print0 | xargs --null -I{} mv #{@verbose} {} {}_tmp"
|
||||
|
||||
system "find #{CREW_LIB_PREFIX} -type f -name *.la -print0 | xargs --null -I{} mv #{@mv_verbose} {} {}_tmp"
|
||||
|
||||
@pkg.in_build = true
|
||||
@pkg.patch
|
||||
@@ -590,14 +593,14 @@ def build_and_preconfigure (target_dir)
|
||||
@pkg.build
|
||||
@pkg.in_build = false
|
||||
# wipe crew destdir
|
||||
FileUtils.rm_rf Dir.glob("#{CREW_DEST_DIR}/*")
|
||||
FileUtils.rm_rf Dir.glob("#{CREW_DEST_DIR}/*"), verbose: @fileutils_verbose
|
||||
puts 'Preconfiguring package...'
|
||||
@pkg.install
|
||||
|
||||
# Rename all *.la_tmp back to *.la to avoid
|
||||
# cannot access '*.la': No such file or directory
|
||||
puts 'Rename all *.la_tmp files back to *.la'.lightblue
|
||||
system "find #{CREW_LIB_PREFIX} -type f -name '*.la_tmp' -exec sh -c 'mv #{@verbose} \"$1\" \"${1%.la_tmp}.la\"' _ {} \\;"
|
||||
system "find #{CREW_LIB_PREFIX} -type f -name '*.la_tmp' -exec sh -c 'mv #{@mv_verbose} \"$1\" \"${1%.la_tmp}.la\"' _ {} \\;"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -621,7 +624,7 @@ def compress_doc (dir)
|
||||
|
||||
if Dir.exist? dir
|
||||
system "find #{dir} -type f ! -perm -200 | xargs -r chmod u+w"
|
||||
system "compressdoc #{@verbose} --gzip -9 #{dir}"
|
||||
system "compressdoc --gzip -9#{@verbose} #{dir}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -644,7 +647,7 @@ def prepare_package (destdir)
|
||||
system 'tail -n +2 dlistcut > dlist'
|
||||
|
||||
# remove temporary files
|
||||
"FileUtils.rm_rf ['dlistcut', '../dlist', '../filelist']#{@fileutils_verbose}"
|
||||
FileUtils.rm_rf ['dlistcut', '../dlist', '../filelist'], verbose: @fileutils_verbose
|
||||
end
|
||||
end
|
||||
|
||||
@@ -662,8 +665,8 @@ def install_package (pkgdir)
|
||||
# install filelist, dlist and binary files
|
||||
puts 'Performing install...'
|
||||
|
||||
FileUtils.mv 'dlist', CREW_CONFIG_PATH + "meta/#{@pkg.name}.directorylist"
|
||||
FileUtils.mv 'filelist', CREW_CONFIG_PATH + "meta/#{@pkg.name}.filelist"
|
||||
FileUtils.mv 'dlist', CREW_CONFIG_PATH + "meta/#{@pkg.name}.directorylist", verbose: @fileutils_verbose
|
||||
FileUtils.mv 'filelist', CREW_CONFIG_PATH + "meta/#{@pkg.name}.filelist", verbose: @fileutils_verbose
|
||||
|
||||
# Strip libraries with -S
|
||||
strip_find_files "find . -type f -name 'lib*.a' -print", "-S"
|
||||
@@ -673,9 +676,9 @@ def install_package (pkgdir)
|
||||
strip_find_files "find . -type f ! -iname '*\.bz2' ! -iname '*\.gz' ! -iname '*\.lha' ! -iname '*\.lz' ! -iname '*\.rar' ! -iname '*\.tar' ! -iname '*\.tbz' ! -iname '*\.tgz' ! -iname '\*.txz' ! -iname '*\.xz' ! -iname '*\.zip' -perm /111 -print | sed -e '/lib.*\.a$/d' -e '/lib.*\.so/d'"
|
||||
|
||||
if Dir.exists? "#{pkgdir}/home" then
|
||||
system "tar -cf #{@verbose} - ./usr/* ./home/* | (cd /; tar xp --keep-directory-symlink -f -)"
|
||||
system "tar -c#{@verbose}f - ./usr/* ./home/* | (cd /; tar xp --keep-directory-symlink -f -)"
|
||||
else
|
||||
system "tar -cf #{@verbose} - ./usr/* | (cd /; tar xp --keep-directory-symlink -f -)"
|
||||
system "tar -c#{@verbose}f - ./usr/* | (cd /; tar xp --keep-directory-symlink -f -)"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -757,7 +760,7 @@ def resolve_dependencies
|
||||
case response
|
||||
when 'n'
|
||||
abort 'No changes made.'
|
||||
when '\n', 'y', 'Y'
|
||||
when "\n", "y", "Y"
|
||||
puts 'Proceeding...'
|
||||
proceed = true
|
||||
else
|
||||
@@ -843,8 +846,8 @@ def resolve_dependencies_and_build
|
||||
ensure
|
||||
#cleanup
|
||||
unless @opt_keep
|
||||
FileUtils.rm_rf Dir.glob("#{CREW_BREW_DIR}/*")
|
||||
FileUtils.mkdir_p "#{CREW_BREW_DIR}/dest" #this is a little ugly, feel free to find a better way
|
||||
FileUtils.rm_rf Dir.glob("#{CREW_BREW_DIR}/*"), verbose: @fileutils_verbose
|
||||
FileUtils.mkdir_p CREW_BREW_DIR + '/dest', verbose: @fileutils_verbose #this is a little ugly, feel free to find a better way
|
||||
end
|
||||
end
|
||||
puts "#{@pkg.name} is built!".lightgreen
|
||||
@@ -880,12 +883,8 @@ end
|
||||
|
||||
def archive_package (pwd)
|
||||
pkg_name = "#{@pkg.name}-#{@pkg.version}-chromeos-#{@device[:architecture]}.tar.xz"
|
||||
Dir.chdir CREW_DEST_DIR do
|
||||
system "tar cJf #{pwd}/#{pkg_name} *"
|
||||
end
|
||||
Dir.chdir pwd do
|
||||
system "sha256sum #{pkg_name} > #{pkg_name}.sha256"
|
||||
end
|
||||
system "tar -c#{@verbose}Jf #{CREW_DEST_DIR}/#{pwd}/#{pkg_name} *"
|
||||
system "sha256sum #{pwd}/#{pkg_name} > #{pwd}/#{pkg_name}.sha256"
|
||||
end
|
||||
|
||||
def remove (pkgName)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Defines common constants used in different parts of crew
|
||||
|
||||
CREW_VERSION = '1.5.11'
|
||||
CREW_VERSION = '1.6.0'
|
||||
|
||||
ARCH_ACTUAL = `uname -m`.strip
|
||||
# This helps with virtualized builds on aarch64 machines
|
||||
|
||||
Reference in New Issue
Block a user