mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
Lzma Cleanup & replacement with newer xzutils, Add pixz support (#5726)
* replace lzma with current xz-utils * add po4a build dep to xzutils * Add xzutils, pixz * is_fake doesn't need source_url * add pixz tpxz format support to crew * Add xzutils to pixz deps * Add pixz if not installed. * change pixz logic * pixz changes * xzutils is a runtime dep for pixz * grammar fix * remove pixz warning
This commit is contained in:
37
bin/crew
37
bin/crew
@@ -234,9 +234,13 @@ def generate_compatible
|
||||
Dir[CREW_PACKAGES_PATH + '*.rb'].each do |filename|
|
||||
pkgName = File.basename filename, '.rb'
|
||||
set_package pkgName, filename
|
||||
puts "Checking #{pkgName} for compatibility.".orange if @opt_verbose
|
||||
if @pkg.compatibility.include? 'all' or @pkg.compatibility.include? ARCH
|
||||
#add to compatible packages
|
||||
puts "Adding #{pkgName} to compatible packages.".lightgreen if @opt_verbose
|
||||
@device[:compatible_packages].push(name: @pkg.name)
|
||||
else
|
||||
puts "#{pkgName} is not a compatible package.".lightred if @opt_verbose
|
||||
end
|
||||
end
|
||||
File.open(CREW_CONFIG_PATH + 'device.json', 'w') do |file|
|
||||
@@ -488,7 +492,7 @@ def update
|
||||
#update compatible packages
|
||||
puts 'Generating compatible packages...'
|
||||
generate_compatible
|
||||
|
||||
puts 'Generating compatible packages done.'.orange if @opt_verbose
|
||||
#check for outdated installed packages
|
||||
puts 'Checking for package updates...'
|
||||
|
||||
@@ -595,7 +599,7 @@ def download
|
||||
|
||||
case File.basename(filename)
|
||||
# Sources that download with curl
|
||||
when /\.zip$/i, /\.(tar(\.(gz|bz2|xz|lz))?|tgz|tbz|txz)$/i, /\.deb$/i, /\.AppImage$/i
|
||||
when /\.zip$/i, /\.(tar(\.(gz|bz2|xz|lz))?|tgz|tbz|tpxz|txz)$/i, /\.deb$/i, /\.AppImage$/i
|
||||
# Recall file from cache if requested
|
||||
if CREW_CACHE_ENABLED
|
||||
puts "Looking for archive in cache".orange if @opt_verbose
|
||||
@@ -725,6 +729,12 @@ def unpack (meta)
|
||||
Dir.chdir @extract_dir do
|
||||
system "../#{meta[:filename]} --appimage-extract", exception: true
|
||||
end
|
||||
when /\.tpxz$/i
|
||||
unless File.exist?("#{CREW_PREFIX}/bin/pixz")
|
||||
abort 'Pixz is needed for this install. Please install it with \'crew install pixz\''.lightred
|
||||
end
|
||||
puts "Unpacking 'tpxz' archive using 'tar', this may take a while..."
|
||||
system "tar -Ipixz -x#{@verbose}f #{meta[:filename]} -C #{@extract_dir}", exception: true
|
||||
end
|
||||
if meta[:source] == true
|
||||
# Check the number of directories in the archive
|
||||
@@ -809,6 +819,12 @@ def prepare_package (destdir)
|
||||
# than install-info.
|
||||
# https://www.debian.org/doc/debian-policy/ch-docs.html#info-documents
|
||||
FileUtils.rm "#{CREW_DEST_PREFIX}/share/info/dir" if File.exist?("#{CREW_DEST_PREFIX}/share/info/dir")
|
||||
|
||||
# Remove all perl module files which will conflict
|
||||
if @pkg.name.include? 'perl_'
|
||||
puts "Removing .packlist and perllocal.pod files to avoid conflicts with other perl packages.".orange
|
||||
system "find #{CREW_DEST_DIR} -type f \\( -name '.packlist' -o -name perllocal.pod \\) -delete"
|
||||
end
|
||||
|
||||
# compress manual files
|
||||
compress_doc "#{CREW_DEST_PREFIX}/man"
|
||||
@@ -871,7 +887,7 @@ def strip_dir (dir)
|
||||
|
||||
# Strip binaries but not compressed archives
|
||||
puts "Stripping binaries..."
|
||||
extensions = [ 'bz2', 'gz', 'lha', 'lz', 'lzh', 'rar', 'tar', 'tbz', 'tgz', 'txz', 'xz', 'Z', 'zip' ]
|
||||
extensions = [ 'bz2', 'gz', 'lha', 'lz', 'lzh', 'rar', 'tar', 'tbz', 'tgz', 'tpxz', 'txz', 'xz', 'Z', 'zip' ]
|
||||
inames = extensions.join(' ! -iname *\.')
|
||||
strip_find_files "find . -type f ! -iname *\.#{inames} -perm /111 -print | sed -e '/lib.*\.a$/d' -e '/lib.*\.so/d'"
|
||||
end
|
||||
@@ -1122,9 +1138,18 @@ def build_package (pwd)
|
||||
end
|
||||
|
||||
def archive_package (pwd)
|
||||
pkg_name = "#{@pkg.name}-#{@pkg.version}-chromeos-#{@device[:architecture]}.tar.xz"
|
||||
Dir.chdir CREW_DEST_DIR do
|
||||
system "tar c#{@verbose}Jf #{pwd}/#{pkg_name} *"
|
||||
unless ENV['CREW_USE_PIXZ'] == '1'
|
||||
pkg_name = "#{@pkg.name}-#{@pkg.version}-chromeos-#{@device[:architecture]}.tar.xz"
|
||||
Dir.chdir CREW_DEST_DIR do
|
||||
system "tar c#{@verbose}Jf #{pwd}/#{pkg_name} *"
|
||||
end
|
||||
else
|
||||
puts "Using pixz to compress archive."
|
||||
pkg_name = "#{@pkg.name}-#{@pkg.version}-chromeos-#{@device[:architecture]}.tpxz"
|
||||
Dir.chdir CREW_DEST_DIR do
|
||||
# Use smaller blocks with "-f0.25" to make random access faster.
|
||||
system "tar c#{@verbose} * | pixz -f0.25 -9 > #{pwd}/#{pkg_name}"
|
||||
end
|
||||
end
|
||||
system "sha256sum #{pwd}/#{pkg_name} > #{pwd}/#{pkg_name}.sha256"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user