Cleanup glibc packages, rebuild glibc 2.32, fix broken git repo clone in installs, rebuild OpenSSL to fix pkgconfig breakage in 3.3.1 (#10328)

* Cleanup glibc packages, rebuild glibc 2.32.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fixup adjustments to allow it to run standalone.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust const.rb to ignore git errors.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Make initial branch error go away like in install.sh.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Make fix of chromebrew git checkout appropriately verbose.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust for reinstalling installed packages during testing.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust unit test messages.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fix typo.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuild OpenSSL to use ARCH_LIB for --libdir to fix pkgconfig libdir regression in OpenSSL 3.3.1.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* More glibc compaction, remove executable bit from lib/fixup.rb.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Removeruby shebang from fixup.rb.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Suggested changes to glibc version comparisons.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Move git commands to heredoc.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Use Gem::Version.new in glibc packages.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Move most other git commands to heredoc.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add more fixup commenting.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fix typo...

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-08-21 15:36:15 -04:00
committed by GitHub
parent 5ca3064507
commit f2c6237d49
20 changed files with 2554 additions and 2089 deletions

View File

@@ -249,14 +249,37 @@ end
def update
abort "'crew update' is used to update crew itself. Use 'crew upgrade <package1> [<package2> ...]' to update specific packages.".orange if @pkg_name
# update package lists
# update crew from git.
Dir.chdir(CREW_LIB_PATH) do
# Set sparse-checkout folders.
system "git sparse-checkout set packages manifest/#{ARCH} lib commands bin crew tests tools"
system 'git sparse-checkout reapply'
# Fix git checkout if .git is missing.
unless Dir.exist?(File.join(CREW_LIB_PATH, '.git'))
puts 'Fixing Chromebrew system git repo clone...'.orange
# Run git setup commands from install.sh
system(<<~GIT_REPAIR_COMMANDS, %i[out err] => File::NULL)
cd #{CREW_LIB_PATH}
# Make the git default branch error messages go away.
git config --global init.defaultBranch main
# Setup the dir with git information.
git init --ref-format=reftable
git remote add origin #{CREW_REPO}
# Help handle situations where GitHub is down.
git config --local http.lowSpeedLimit 1000
git config --local http.lowSpeedTime 5
# Checkout, overwriting local files.
git fetch --all
git checkout -f master
git reset --hard origin/#{CREW_BRANCH}
GIT_REPAIR_COMMANDS
end
system "git fetch #{CREW_REPO} #{CREW_BRANCH}", exception: true
system 'git reset --hard FETCH_HEAD', exception: true
system(<<~GIT_UPDATE_COMMANDS, exception: true)
cd #{CREW_LIB_PATH}
# Set sparse-checkout folders.
git sparse-checkout set packages manifest/#{ARCH} lib commands bin crew tests tools
git sparse-checkout reapply
git fetch #{CREW_REPO} #{CREW_BRANCH}
git reset --hard FETCH_HEAD
GIT_UPDATE_COMMANDS
system 'git-restore-mtime -sq 2>/dev/null', exception: true if File.file?("#{CREW_PREFIX}/bin/git-restore-mtime")
end

View File

@@ -2,7 +2,7 @@
# Defines common constants used in different parts of crew
require 'etc'
CREW_VERSION = '1.50.6'
CREW_VERSION = '1.50.7'
# Kernel architecture.
KERN_ARCH = Etc.uname[:machine]
@@ -79,7 +79,7 @@ CREW_LOCAL_BUILD_DIR = "#{CREW_LOCAL_REPO_ROOT}/release/#{ARCH}"
# The following is used in fixup.rb to determine if crew update needs to
# be run again.
CREW_CONST_GIT_COMMIT = `git -C #{CREW_LIB_PATH} log -n1 --oneline #{__FILE__}`.split.first
CREW_CONST_GIT_COMMIT = `git -C #{CREW_LIB_PATH} log -n1 --oneline #{__FILE__} 2> /dev/null`.split.first
# Put musl build dir under CREW_PREFIX/share/musl to avoid FHS incompatibility
CREW_MUSL_PREFIX = File.join(CREW_PREFIX, '/share/musl/')

View File

@@ -1,5 +1,11 @@
# lib/fixup.rb
# Add fixups to be run during crew update here.
require 'etc'
require 'json'
require_relative 'color'
require_relative 'package'
require_relative 'package_utils'
def require_gem(gem_name_and_require = nil, require_override = nil)
# Allow only loading gems when needed.
return if gem_name_and_require.nil?
@@ -21,8 +27,28 @@ def require_gem(gem_name_and_require = nil, require_override = nil)
end
require_gem('highline/import')
# All needed constants & variables should be defined here in case they
# have not yet been loaded or fixup is being run standalone.
CREW_VERBOSE = ARGV.intersect?(%w[-v --verbose]) unless defined?(CREW_VERBOSE)
HOME = '/home/chronos/user' unless defined?(HOME)
CREW_PREFIX = '/usr/local' unless defined?(CREW_PREFIX)
CREW_LIB_PATH = File.join(CREW_PREFIX, 'lib/crew') unless defined?(CREW_LIB_PATH)
CREW_CONFIG_PATH = File.join(CREW_PREFIX, 'etc/crew') unless defined?(CREW_CONFIG_PATH)
CREW_META_PATH = File.join(CREW_CONFIG_PATH, 'meta') unless defined?(CREW_CONFIG_PATH)
# via git log --reverse --oneline lib/const.rb | head -n 1
CREW_CONST_GIT_COMMIT = '72d807aac' unless defined?(CREW_CONST_GIT_COMMIT)
CREW_REPO = 'https://github.com/chromebrew/chromebrew.git' unless defined?(CREW_REPO)
CREW_BRANCH = 'master' unless defined?(CREW_BRANCH)
unless defined?(ARCH)
KERN_ARCH = Etc.uname[:machine] unless defined? KERN_ARCH
ARCH = %w[aarch64 armv8l].include?(KERN_ARCH) ? 'armv7l' : KERN_ARCH
end
LIBC_VERSION = Etc.confstr(Etc::CS_GNU_LIBC_VERSION).split.last unless defined?(LIBC_VERSION)
CREW_PACKAGES_PATH = File.join(CREW_LIB_PATH, 'packages') unless defined?(CREW_PACKAGES_PATH)
@device = PackageUtils.load_json unless defined? @device
# remove deprecated directory
FileUtils.rm_rf "#{HOME}/.cache/crewcache/manifest"
@@ -156,8 +182,7 @@ pkg_update_arr.each do |pkg|
next x
end
File.write "#{CREW_CONFIG_PATH}/device.json.new", JSON.pretty_generate(JSON.parse(@device.to_json))
@device = JSON.load_file("#{CREW_CONFIG_PATH}/device.json.new", symbolize_names: true)
@device.transform_values! { |val| val.is_a?(String) ? val.to_sym : val }
@device = JSON.load_file(File.join(CREW_CONFIG_PATH, 'device.json.new'), symbolize_names: true).transform_values! { |val| val.is_a?(String) ? val.to_sym : val }
raise StandardError, 'Failed to replace pkg name...'.lightred unless @device[:installed_packages].any? { |elem| elem[:name] == pkg[:pkg_rename] }
# Ok to write working device.json
File.write "#{CREW_CONFIG_PATH}/device.json", JSON.pretty_generate(JSON.parse(@device.to_json))
@@ -169,8 +194,7 @@ pkg_update_arr.each do |pkg|
FileUtils.cp "#{CREW_CONFIG_PATH}/device.json.bak", "#{CREW_CONFIG_PATH}/device.json"
end
# Reload json file.
@device = JSON.load_file("#{CREW_CONFIG_PATH}/device.json", symbolize_names: true)
@device.transform_values! { |val| val.is_a?(String) ? val.to_sym : val }
@device = JSON.load_file(File.join(CREW_CONFIG_PATH, 'device.json'), symbolize_names: true).transform_values! { |val| val.is_a?(String) ? val.to_sym : val }
# Ok to remove backup and temporary json files.
FileUtils.rm_f "#{CREW_CONFIG_PATH}/device.json.bak"
FileUtils.rm_f "#{CREW_CONFIG_PATH}/device.json.new"
@@ -198,14 +222,7 @@ end
# is different from the git commit of the potentially updated const.rb
# loaded here after a git pull.
# Handle case of const.rb not yet defining CREW_CONST_GIT_COMMIT.
CREW_CONST_GIT_COMMIT = '0000' unless defined?(CREW_CONST_GIT_COMMIT)
Dir.chdir CREW_LIB_PATH do
@new_const_git_commit = `git log -n1 --oneline #{CREW_LIB_PATH}/lib/const.rb`.chomp.split.first
end
unless @new_const_git_commit == CREW_CONST_GIT_COMMIT
unless `git -C #{CREW_LIB_PATH} log -n1 --oneline #{CREW_LIB_PATH}/lib/const.rb`.split.first == CREW_CONST_GIT_COMMIT
puts 'Restarting crew update since there is an updated crew version.'.lightcyan
puts "CREW_REPO=#{CREW_REPO} CREW_BRANCH=#{CREW_BRANCH} crew update".orange if CREW_VERBOSE
exec "CREW_REPO=#{CREW_REPO} CREW_BRANCH=#{CREW_BRANCH} crew update"
@@ -215,11 +232,15 @@ end
FileUtils.rm "#{CREW_PACKAGES_PATH}/pagerenv" if File.file?("#{CREW_PACKAGES_PATH}/pagerenv")
# Handle broken system glibc affecting gcc_lib on newer x86_64 ChromeOS milestones.
if (ARCH == 'x86_64') && (LIBC_VERSION.to_f >= 2.36)
abort("patchelf is needed. Please run: 'crew install patchelf && crew update'") unless File.file?(File.join(CREW_PREFIX, 'bin/patchelf'))
if (ARCH == 'x86_64') && (Gem::Version.new(LIBC_VERSION.to_s) >= Gem::Version.new('2.36'))
abort("patchelf is needed. Please run: 'crew update && crew install patchelf && crew update'") unless File.file?(File.join(CREW_PREFIX, 'bin/patchelf'))
# Link the system libc.so.6 to also require our renamed libC.so.6
# which provides the float128 functions strtof128, strfromf128,
# and __strtof128_nan.
# This creates tons of the following warnings when g++ is invoked with
# g++ #{File.join(CREW_LIB_PREFIX, 'libC.so.6')}, but I'm not sure how
# to get around that.
# /usr/local/lib64/libC.so.6: linker input file unused because linking not done errors
libc_patch_libraries = %w[libstdc++.so.6]
libc_patch_libraries.delete_if { |lib| !File.file?(File.join(CREW_LIB_PREFIX, lib)) }
libc_patch_libraries.delete_if { |lib| Kernel.system "patchelf --print-needed #{File.join(CREW_LIB_PREFIX, lib)} | grep -q libC.so.6" }

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@
/usr/local/lib/python3.12/site-packages/cfgv-3.4.0.dist-info/LICENSE
/usr/local/lib/python3.12/site-packages/cfgv-3.4.0.dist-info/METADATA
/usr/local/lib/python3.12/site-packages/cfgv-3.4.0.dist-info/RECORD
/usr/local/lib/python3.12/site-packages/cfgv-3.4.0.dist-info/REQUESTED
/usr/local/lib/python3.12/site-packages/cfgv-3.4.0.dist-info/WHEEL
/usr/local/lib/python3.12/site-packages/cfgv-3.4.0.dist-info/top_level.txt
/usr/local/lib/python3.12/site-packages/cfgv.py

View File

@@ -2,6 +2,7 @@
/usr/local/lib/python3.12/site-packages/distlib-0.3.8.dist-info/LICENSE.txt
/usr/local/lib/python3.12/site-packages/distlib-0.3.8.dist-info/METADATA
/usr/local/lib/python3.12/site-packages/distlib-0.3.8.dist-info/RECORD
/usr/local/lib/python3.12/site-packages/distlib-0.3.8.dist-info/REQUESTED
/usr/local/lib/python3.12/site-packages/distlib-0.3.8.dist-info/WHEEL
/usr/local/lib/python3.12/site-packages/distlib-0.3.8.dist-info/top_level.txt
/usr/local/lib/python3.12/site-packages/distlib/__init__.py

View File

@@ -3,6 +3,7 @@
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/LICENSE
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/METADATA
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/RECORD
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/REQUESTED
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/WHEEL
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/entry_points.txt
/usr/local/lib/python3.12/site-packages/identify-2.6.0.dist-info/top_level.txt

View File

@@ -5,6 +5,7 @@
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/LICENSE
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/METADATA
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/RECORD
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/REQUESTED
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/WHEEL
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/entry_points.txt
/usr/local/lib/python3.12/site-packages/nodeenv-1.9.1.dist-info/top_level.txt

View File

@@ -2,6 +2,7 @@
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/INSTALLER
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/METADATA
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/RECORD
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/REQUESTED
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/WHEEL
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/entry_points.txt
/usr/local/lib/python3.12/site-packages/virtualenv-20.26.3.dist-info/licenses/LICENSE

File diff suppressed because it is too large Load Diff

View File

@@ -254,13 +254,11 @@ class Glibc_build223 < Package
Dir.chdir 'glibc_build' do
system 'touch', "#{CREW_DEST_PREFIX}/etc/ld.so.conf"
case ARCH
when 'aarch64', 'armv7l'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install || true" # "sln elf/symlink.list" fails on armv7l
when 'i686', 'x86_64'
when 'i686'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install"
end
case @libc_version
when '2.23', '2.27'
when '2.23'
Dir.chdir 'localedata' do
system "mkdir -pv #{CREW_DEST_LIB_PREFIX}/locale"
puts 'Install minimum set of locales'.lightblue
@@ -297,45 +295,26 @@ class Glibc_build223 < Package
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
@crew_libc_version = @libc_version
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
when 'x86_64'
FileUtils.ln_sf "/lib64/ld-#{@crew_libc_version}.so", 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux.so.2'), 'ld-linux.so.2'
end
@libraries = %w[ld libBrokenLocale libSegFault libanl libc libcrypt
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
libnss_dns libnss_files libnss_hesiod libpcprofile libpthread
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_DEST_LIB_PREFIX, File.basename(k))
end
end
end
end
# Only save libnsl.so.2, since libnsl.so.1 is provided by perl
# For this to work, build on a M107 or newer container.
FileUtils.cp File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.ln_sf File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"
@@ -363,6 +342,7 @@ class Glibc_build223 < Package
def self.postinstall
if File.exist?("#{CREW_LIB_PREFIX}/libc.so.6")
FileUtils.chmod 'u=wrx', "#{CREW_LIB_PREFIX}/libc.so.6"
@crew_libcvertokens = `#{CREW_LIB_PREFIX}/libc.so.6`.lines.first.chomp.split(/\s/)
@crew_libc_version = @crew_libcvertokens[@crew_libcvertokens.find_index('version') + 1].sub!(/[[:punct:]]?$/, '')
puts "Package glibc version is #{@crew_libc_version}.".lightblue
@@ -377,34 +357,15 @@ class Glibc_build223 < Package
puts "System glibc version is #{@crew_libc_version}.".lightblue
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf '/lib/ld-linux-armhf.so.3', 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
when 'x86_64'
FileUtils.ln_sf '/lib64/ld-linux-x86-64.so.2', 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux.so.2'), 'ld-linux.so.2'
end
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_LIB_PREFIX, File.basename(k))
end
end
end

View File

@@ -327,11 +327,9 @@ class Glibc_build227 < Package
@crew_libc_version = @libc_version
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf "/lib64/ld-#{@crew_libc_version}.so", 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries = %w[ld libBrokenLocale libSegFault libanl libc libcrypt
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
@@ -339,32 +337,17 @@ class Glibc_build227 < Package
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_DEST_LIB_PREFIX, File.basename(k))
end
end
end
# Only save libnsl.so.2, since libnsl.so.1 is provided by perl
# For this to work, build on a M107 or newer container.
FileUtils.cp File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.ln_sf File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"
@@ -380,6 +363,7 @@ class Glibc_build227 < Package
def self.postinstall
if File.exist?("#{CREW_LIB_PREFIX}/libc.so.6")
FileUtils.chmod 'u=wrx', "#{CREW_LIB_PREFIX}/libc.so.6"
@crew_libcvertokens = `#{CREW_LIB_PREFIX}/libc.so.6`.lines.first.chomp.split(/\s/)
@crew_libc_version = @crew_libcvertokens[@crew_libcvertokens.find_index('version') + 1].sub!(/[[:punct:]]?$/, '')
puts "Package glibc version is #{@crew_libc_version}.".lightblue
@@ -390,39 +374,22 @@ class Glibc_build227 < Package
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
libnss_dns libnss_files libnss_hesiod libpcprofile libpthread
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries -= ['libpthread'] if Gem::Version.new(@libc_version.to_s) >= Gem::Version.new('2.35')
Dir.chdir CREW_LIB_PREFIX do
puts "System glibc version is #{@crew_libc_version}.".lightblue
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf '/lib/ld-linux-armhf.so.3', 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf '/lib64/ld-linux-x86-64.so.2', 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_LIB_PREFIX, File.basename(k))
end
end
end

View File

@@ -3,7 +3,7 @@ require 'package'
class Glibc_build232 < Package
description 'The GNU C Library project provides the core libraries for GNU/Linux systems.'
homepage 'https://www.gnu.org/software/libc/'
version '2.32-3'
version '2.32-4'
license 'LGPL-2.1+, BSD, HPND, ISC, inner-net, rc, and PCRE'
@libc_version = LIBC_VERSION
compatibility 'x86_64 aarch64 armv7l'
@@ -14,9 +14,9 @@ class Glibc_build232 < Package
binary_compression 'tar.zst'
binary_sha256({
aarch64: '3fd6ddb5c4a5e6c53b08562a6aeb24e36a664b58c6bfd0742918a873e19f0c9d',
armv7l: '3fd6ddb5c4a5e6c53b08562a6aeb24e36a664b58c6bfd0742918a873e19f0c9d',
x86_64: '815e075b94cfd66723222f7cbadfbb5c09e1c8fd40fff01b5970bf32d759908a'
aarch64: '2ab295e7c338288bf5fa6cb7b76c0039e452c7dab379744342a7bac1d26a300b',
armv7l: '2ab295e7c338288bf5fa6cb7b76c0039e452c7dab379744342a7bac1d26a300b',
x86_64: '37870ec860096ce1081b87b8155e4ad38ff5979d2baf4e367d8087aa4e1ce603'
})
depends_on 'gawk' => :build
@@ -24,6 +24,7 @@ class Glibc_build232 < Package
depends_on 'libidn2' => :build
depends_on 'texinfo' => :build
depends_on 'hashpipe' => :build
# depends_on 'libtirpc' # R
conflicts_ok
no_env_options
@@ -159,7 +160,7 @@ class Glibc_build232 < Package
"
end
system "make PARALLELMFLAGS='-j #{CREW_NPROC}' || make || make PARALLELMFLAGS='-j 1'"
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) >= Gem::Version.new('2.32')
system "gcc -Os -g -static -o build-locale-archive ../fedora/build-locale-archive.c \
../glibc_build/locale/locarchive.o \
../glibc_build/locale/md5.o \
@@ -180,24 +181,18 @@ class Glibc_build232 < Package
case ARCH
when 'aarch64', 'armv7l'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install || true" # "sln elf/symlink.list" fails on armv7l
when 'i686', 'x86_64'
when 'x86_64'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install"
end
if @libc_version.to_f >= 2.32
system "install -Dt #{CREW_DEST_PREFIX}/bin -m755 build-locale-archive"
system "make -j1 DESTDIR=#{CREW_DEST_DIR} localedata/install-locales"
end
Dir.chdir CREW_DEST_LIB_PREFIX do
puts "System glibc version is #{LIBC_VERSION}.".lightblue
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
@crew_libc_version = @libc_version
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf "/lib64/ld-#{@crew_libc_version}.so", 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries = %w[ld libBrokenLocale libSegFault libanl libc libcrypt
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
@@ -205,33 +200,17 @@ class Glibc_build232 < Package
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_DEST_LIB_PREFIX, File.basename(k))
end
end
end
end
# Only save libnsl.so.2, since libnsl.so.1 is provided by perl
# For this to work, build on a M107 or newer container.
FileUtils.cp File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.ln_sf File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"
@@ -247,6 +226,7 @@ class Glibc_build232 < Package
def self.postinstall
if File.exist?("#{CREW_LIB_PREFIX}/libc.so.6")
FileUtils.chmod 'u=wrx', "#{CREW_LIB_PREFIX}/libc.so.6"
@crew_libcvertokens = `#{CREW_LIB_PREFIX}/libc.so.6`.lines.first.chomp.split(/\s/)
@crew_libc_version = @crew_libcvertokens[@crew_libcvertokens.find_index('version') + 1].sub!(/[[:punct:]]?$/, '')
puts "Package glibc version is #{@crew_libc_version}.".lightblue
@@ -257,81 +237,24 @@ class Glibc_build232 < Package
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
libnss_dns libnss_files libnss_hesiod libpcprofile libpthread
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries -= ['libpthread'] if Gem::Version.new(@libc_version.to_s) >= Gem::Version.new('2.35')
Dir.chdir CREW_LIB_PREFIX do
puts "System glibc version is #{@crew_libc_version}.".lightblue
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf '/lib/ld-linux-armhf.so.3', 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf '/lib64/ld-linux-x86-64.so.2', 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_LIB_PREFIX, File.basename(k))
end
end
end
return unless @libc_version.to_f >= 2.32 && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
puts 'Paring locales to a minimal set.'.lightblue
system 'localedef --list-archive | grep -v -i -e ^en -e ^cs -e ^de -e ^es -e ^fa -e ^fe -e ^it -e ^ja -e ^ru -e ^tr -e ^zh -e ^C| xargs localedef --delete-from-archive',
exception: false
FileUtils.mv "#{CREW_LIB_PREFIX}/locale/locale-archive", "#{CREW_LIB_PREFIX}/locale/locale-archive.tmpl"
unless File.file?('')
downloader "https://raw.githubusercontent.com/bminor/glibc/release/#{@crew_libc_version}/master/intl/locale.alias",
'SKIP', "#{CREW_PREFIX}/share/locale/locale.alias"
end
if @opt_verbose
system 'build-locale-archive'
else
system 'build-locale-archive', %i[out err] => File::NULL
end
FileUtils.rm "#{CREW_LIB_PREFIX}/locale/locale-archive.tmpl"
# minimum set of locales -> #{CREW_LIB_PREFIX}/locale/locale-archive
# We just whitelist certain locales and delete everything else like other distributions do, e.g.
# for dir in locale i18n; do
# find #{CREW_PREFIX}/usr/share/${dir} -mindepth 1 -maxdepth 1 -type d -not \( -name "${KEEPLANG}" -o -name POSIX \) -exec rm -rf {} +
# done
# This is the array of locales to save:
@locales = %w[C cs_CZ de_DE en es_MX fa_IR fr_FR it_IT ja_JP ru_RU tr_TR zh]
@localedirs = %W[#{CREW_PREFIX}/share/locale #{CREW_PREFIX}/share/i18n/locales]
@filelist = File.readlines("#{CREW_META_PATH}/glibc_build232.filelist")
@localedirs.each do |localedir|
Dir.chdir localedir do
Dir['*'].each do |f|
next if @locales.any? { |s| File.basename(f).include?(s) }
FileUtils.rm_f f
@fpath = "#{localedir}/#{f}"
@filelist.reject! { |e| e.include?(@fpath) }
end
end
end
puts 'Updating glibc package filelist...'.lightblue
File.open("#{CREW_META_PATH}/glibc_build232.filelist", 'w+') do |f|
f.puts(@filelist)
end
end
end

View File

@@ -158,7 +158,7 @@ class Glibc_build233 < Package
"
end
system "make PARALLELMFLAGS='-j #{CREW_NPROC}' || make || make PARALLELMFLAGS='-j 1'"
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32')
system "gcc -Os -g -static -o build-locale-archive ../fedora/build-locale-archive.c \
../glibc_build/locale/locarchive.o \
../glibc_build/locale/md5.o \
@@ -179,10 +179,10 @@ class Glibc_build233 < Package
case ARCH
when 'aarch64', 'armv7l'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install || true" # "sln elf/symlink.list" fails on armv7l
when 'i686', 'x86_64'
when 'x86_64'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install"
end
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32')
system "install -Dt #{CREW_DEST_PREFIX}/bin -m755 build-locale-archive"
system "make -j1 DESTDIR=#{CREW_DEST_DIR} localedata/install-locales"
end
@@ -192,11 +192,9 @@ class Glibc_build233 < Package
@crew_libc_version = @libc_version
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf "/lib64/ld-#{@crew_libc_version}.so", 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries = %w[ld libBrokenLocale libSegFault libanl libc libcrypt
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
@@ -204,33 +202,18 @@ class Glibc_build233 < Package
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_DEST_LIB_PREFIX, File.basename(k))
end
end
end
end
# Only save libnsl.so.2, since libnsl.so.1 is provided by perl
# For this to work, build on a M107 or newer container.
FileUtils.cp File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.ln_sf File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"
@@ -246,6 +229,7 @@ class Glibc_build233 < Package
def self.postinstall
if File.exist?("#{CREW_LIB_PREFIX}/libc.so.6")
FileUtils.chmod 'u=wrx', "#{CREW_LIB_PREFIX}/libc.so.6"
@crew_libcvertokens = `#{CREW_LIB_PREFIX}/libc.so.6`.lines.first.chomp.split(/\s/)
@crew_libc_version = @crew_libcvertokens[@crew_libcvertokens.find_index('version') + 1].sub!(/[[:punct:]]?$/, '')
puts "Package glibc version is #{@crew_libc_version}.".lightblue
@@ -262,37 +246,20 @@ class Glibc_build233 < Package
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf '/lib/ld-linux-armhf.so.3', 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf '/lib64/ld-linux-x86-64.so.2', 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_LIB_PREFIX, File.basename(k))
end
end
end
return unless @libc_version.to_f >= 2.32 && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
return unless Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32') && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
puts 'Paring locales to a minimal set.'.lightblue
system 'localedef --list-archive | grep -v -i -e ^en -e ^cs -e ^de -e ^es -e ^fa -e ^fe -e ^it -e ^ja -e ^ru -e ^tr -e ^zh -e ^C| xargs localedef --delete-from-archive',

View File

@@ -59,7 +59,7 @@ class Glibc_build235 < Package
def self.build
FileUtils.mkdir_p 'glibc_build'
Dir.chdir 'glibc_build' do
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) >= Gem::Version.new('2.32')
# Optimization flags from https://github.com/InBetweenNames/gentooLTO
case ARCH
when 'armv7l', 'aarch64'
@@ -153,7 +153,7 @@ class Glibc_build235 < Package
end
end
system "make PARALLELMFLAGS='-j #{CREW_NPROC}' || make || make PARALLELMFLAGS='-j 1'"
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) >= Gem::Version.new('2.32')
system "gcc -Os -g -static -o build-locale-archive ../fedora/build-locale-archive.c \
../glibc_build/locale/locarchive.o \
../glibc_build/locale/md5.o \
@@ -174,10 +174,10 @@ class Glibc_build235 < Package
case ARCH
when 'aarch64', 'armv7l'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install || true" # "sln elf/symlink.list" fails on armv7l
when 'i686', 'x86_64'
when 'x86_64'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install"
end
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32')
system "install -Dt #{CREW_DEST_PREFIX}/bin -m755 build-locale-archive"
system "make -j1 DESTDIR=#{CREW_DEST_DIR} localedata/install-locales"
end
@@ -187,11 +187,9 @@ class Glibc_build235 < Package
@crew_libc_version = @libc_version
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf "/lib64/ld-#{@crew_libc_version}.so", 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries = %w[ld libBrokenLocale libSegFault libanl libc libcrypt
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
@@ -199,33 +197,18 @@ class Glibc_build235 < Package
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_DEST_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_DEST_LIB_PREFIX, File.basename(k))
end
end
end
end
# Only save libnsl.so.2, since libnsl.so.1 is provided by perl
# For this to work, build on a M107 or newer container.
FileUtils.cp File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.ln_sf File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"
@@ -241,6 +224,7 @@ class Glibc_build235 < Package
def self.postinstall
if File.exist?("#{CREW_LIB_PREFIX}/libc.so.6")
FileUtils.chmod 'u=wrx', "#{CREW_LIB_PREFIX}/libc.so.6"
@crew_libcvertokens = `#{CREW_LIB_PREFIX}/libc.so.6`.lines.first.chomp.split(/\s/)
@crew_libc_version = @crew_libcvertokens[@crew_libcvertokens.find_index('version') + 1].sub!(/[[:punct:]]?$/, '')
puts "Package glibc version is #{@crew_libc_version}.".lightblue
@@ -251,43 +235,26 @@ class Glibc_build235 < Package
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
libnss_dns libnss_files libnss_hesiod libpcprofile libpthread
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @crew_libc_version.to_f >= 2.35
@libraries -= ['libpthread'] if Gem::Version.new(@libc_version.to_s) >= Gem::Version.new('2.35')
Dir.chdir CREW_LIB_PREFIX do
puts "System glibc version is #{@crew_libc_version}.".lightblue
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf '/lib/ld-linux-armhf.so.3', 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@crew_libc_version}.so", 'ld-linux-i686.so.2'
FileUtils.ln_sf File.realpath('/lib/ld-linux-armhf.so.3'), 'ld-linux-armhf.so.3'
when 'x86_64'
FileUtils.ln_sf '/lib64/ld-linux-x86-64.so.2', 'ld-linux-x86-64.so.2'
FileUtils.ln_sf File.realpath('/lib64/ld-linux-x86-64.so.2'), 'ld-linux-x86-64.so.2'
end
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
end
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_LIB_PREFIX, File.basename(k))
end
end
end
return unless @libc_version.to_f >= 2.32 && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
return unless Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32') && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
puts 'Paring locales to a minimal set.'.lightblue
system 'localedef --list-archive | grep -v -i -e ^en -e ^cs -e ^de -e ^es -e ^fa -e ^fe -e ^it -e ^ja -e ^ru -e ^tr -e ^zh -e ^C| xargs localedef --delete-from-archive',

View File

@@ -65,7 +65,7 @@ class Glibc_build237 < Package
def self.build
FileUtils.mkdir_p 'glibc_build'
Dir.chdir 'glibc_build' do
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32')
# Optimization flags from https://github.com/InBetweenNames/gentooLTO
case ARCH
when 'armv7l', 'aarch64'
@@ -163,7 +163,7 @@ class Glibc_build237 < Package
end
end
system "make PARALLELMFLAGS='-j #{CREW_NPROC}' || make || make PARALLELMFLAGS='-j 1'"
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32')
system "gcc -Os -g -static -o build-locale-archive ../fedora/build-locale-archive.c \
../glibc_build/locale/locarchive.o \
../glibc_build/locale/md5.o \
@@ -187,7 +187,7 @@ class Glibc_build237 < Package
when 'i686', 'x86_64'
system "make -j1 DESTDIR=#{CREW_DEST_DIR} install || make -j1 DESTDIR=#{CREW_DEST_DIR} install || true"
end
if @libc_version.to_f >= 2.32
if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32')
system "install -Dt #{CREW_DEST_PREFIX}/bin -m755 build-locale-archive"
system "make -j1 DESTDIR=#{CREW_DEST_DIR} localedata/install-locales || make -j1 DESTDIR=#{CREW_DEST_DIR} localedata/install-locales"
end
@@ -213,26 +213,10 @@ class Glibc_build237 < Package
FileUtils.ln_sf "/#{ARCH_LIB}/libc.so.6", 'libc.so.6'
## Also save our copy of libm.so.6 since it has the float128 functions.
# @libraries = %w[ld libBrokenLocale libSegFault libanl libc libcrypt
# libdl libmemusage libmvec libnsl libnss_compat libnss_db
# libnss_dns libnss_files libnss_hesiod libpcprofile libpthread
# libthread_db libresolv librlv librt libthread_db-1.0 libutil]
# @libraries -= ['libpthread'] if @libc_version.to_f >= 2.35
# @libraries.each do |lib|
## Reject entries which aren't libraries ending in .so, and which aren't files.
# Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
# @filetype = `file #{f}`.chomp
# next unless ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
# g = File.basename(f)
# FileUtils.mkdir_p CREW_DEST_LIB_PREFIX
# Dir.chdir(CREW_DEST_LIB_PREFIX) do
# FileUtils.ln_sf f.to_s, g.to_s
# end
# end
## Reject entries which aren't libraries ending in .so, and which aren't files.
## Reject text files such as libc.so because they points to files like
## libc_nonshared.a, which are not provided by ChromeOS
# Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
# Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.reject { |f| File.directory?(f) }.each do |f|
# @filetype = `file #{f}`.chomp
# puts "f: #{@filetype}" if @opt_verbose
# if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
@@ -254,7 +238,7 @@ class Glibc_build237 < Package
end
# Only save libnsl.so.2, since libnsl.so.1 is provided by perl
# For this to work, build on a M107 or newer container.
FileUtils.cp File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2" if LIBC_VERSION.to_f >= 2.35
FileUtils.ln_sf File.realpath("#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"), "#{CREW_DEST_LIB_PREFIX}/libnsl.so.2" if LIBC_VERSION.to_f >= 2.35
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so"
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libnsl.so.1"
@@ -270,7 +254,7 @@ class Glibc_build237 < Package
def self.postinstall
# Handle broken system glibc affecting system glibc and libm.so.6 on newer x86_64 ChromeOS milestones.
if (ARCH == 'x86_64') && (LIBC_VERSION.to_f >= 2.35)
if (ARCH == 'x86_64') && Gem::Version.new(LIBC_VERSION.to_s) >= Gem::Version.new('2.35')
FileUtils.cp "/#{ARCH_LIB}/libc.so.6", File.join(CREW_LIB_PREFIX, 'libc.so.6.system') and FileUtils.mv File.join(CREW_LIB_PREFIX, 'libc.so.6.system'), File.join(CREW_LIB_PREFIX, 'libc.so.6')
puts "patchelf is needed. Please run: 'crew install patchelf ; crew postinstall #{name}'".lightred unless File.file?(File.join(CREW_PREFIX, 'bin/patchelf'))
# Link the system libc.so.6 to also require our renamed libC.so.6
@@ -294,6 +278,7 @@ class Glibc_build237 < Package
unless ARCH == 'x86_64'
if File.exist?("#{CREW_LIB_PREFIX}/libc.so.6")
FileUtils.chmod 'u=wrx', "#{CREW_LIB_PREFIX}/libc.so.6"
@crew_libcvertokens = `#{CREW_LIB_PREFIX}/libc.so.6`.lines.first.chomp.split(/\s/)
@libc_version = @crew_libcvertokens[@crew_libcvertokens.find_index('version') + 1].sub!(/[[:punct:]]?$/, '')
puts "Package glibc version is #{@libc_version}.".lightblue
@@ -304,51 +289,27 @@ class Glibc_build237 < Package
libdl libm libmemusage libmvec libnsl libnss_compat libnss_db
libnss_dns libnss_files libnss_hesiod libpcprofile libpthread
libthread_db libresolv librlv librt libthread_db-1.0 libutil]
@libraries -= ['libpthread'] if @libc_version.to_f >= 2.35
@libraries -= ['libc'] if (@libc_version.to_f >= 2.35) && Kernel.system("patchelf --print-needed #{File.join(CREW_LIB_PREFIX, 'libc.so.6')} | grep -q libC.so.6")
@libraries -= ['libm'] if (@libc_version.to_f >= 2.35) && Kernel.system("patchelf --print-needed #{File.join(CREW_LIB_PREFIX, 'libm.so.6')} | grep -q libC.so.6")
@libraries -= ['libpthread'] if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.35')
@libraries -= ['libc'] if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.35') && Kernel.system("patchelf --print-needed #{File.join(CREW_LIB_PREFIX, 'libc.so.6')} | grep -q libC.so.6")
@libraries -= ['libm'] if Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.35') && Kernel.system("patchelf --print-needed #{File.join(CREW_LIB_PREFIX, 'libm.so.6')} | grep -q libC.so.6")
Dir.chdir CREW_LIB_PREFIX do
puts "System glibc version is #{@libc_version}.".lightblue
puts 'Creating symlinks to system glibc version to prevent breakage.'.lightblue
case ARCH
when 'aarch64', 'armv7l'
FileUtils.ln_sf '/lib/ld-linux-armhf.so.3', 'ld-linux-armhf.so.3'
when 'i686'
FileUtils.ln_sf "/lib/ld-#{@libc_version}.so", 'ld-linux-i686.so.2'
# newer x86_64 ChromeOS glibc lacks strtof128, strfromf128
# and __strtof128_nan
# when 'x86_64'
# FileUtils.ln_sf '/lib64/ld-linux-x86-64.so.2', 'ld-linux-x86-64.so.2'
end
@libraries.each do |lib|
# Reject entries which aren't libraries ending in .so, and which aren't files.
Dir["/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
next unless ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
next if Kernel.system "patchelf --print-needed #{File.join(CREW_LIB_PREFIX, g)} | grep -q libC.so.6"
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
end
# Reject entries which aren't libraries ending in .so, and which aren't files.
# Reject text files such as libc.so because they points to files like
# libc_nonshared.a, which are not provided by ChromeOS
Dir["/usr/#{ARCH_LIB}/#{lib}.so*"].reject { |f| File.directory?(f) }.each do |f|
@filetype = `file #{f}`.chomp
puts "f: #{@filetype}" if @opt_verbose
if ['shared object', 'symbolic link'].any? { |type| @filetype.include?(type) }
g = File.basename(f)
next if Kernel.system "patchelf --print-needed #{File.join(CREW_LIB_PREFIX, g)} | grep -q libC.so.6"
FileUtils.ln_sf f.to_s, "#{CREW_LIB_PREFIX}/#{g}"
elsif @opt_verbose
puts "#{f} excluded because #{@filetype}"
end
Dir["{,/usr}/#{ARCH_LIB}/#{lib}.so*"].compact.select { |i| ['shared object', 'symbolic link'].any? { |j| `file #{i}`.chomp.include? j } }.each do |k|
FileUtils.ln_sf k, File.join(CREW_LIB_PREFIX, File.basename(k))
end
end
end
end
return unless @libc_version.to_f >= 2.32 && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
return unless Gem::Version.new(@libc_version.to_s) > Gem::Version.new('2.32') && Gem::Version.new(CREW_KERNEL_VERSION.to_s) >= Gem::Version.new('5.10')
puts 'Paring locales to a minimal set.'.lightblue
system 'localedef --list-archive | grep -v -i -e ^en -e ^cs -e ^de -e ^es -e ^fa -e ^fe -e ^it -e ^ja -e ^ru -e ^tr -e ^zh -e ^C| xargs localedef --delete-from-archive',

View File

@@ -23,10 +23,6 @@ class Glibc_dev235 < Package
no_upstream_update
def self.preflight
abort 'Glibc_lib requires glibc = 2.35.' unless Gem::Version.new(LIBC_VERSION.to_s) == Gem::Version.new('2.35')
end
def self.install
puts 'Installing Glibc_build to pull files for build...'.lightblue
@filelist_path = File.join(CREW_META_PATH, 'glibc_build235.filelist')

View File

@@ -25,10 +25,6 @@ class Glibc_lib237 < Package
no_source_build
no_upstream_update
def self.preflight
abort 'Glibc_lib requires glibc = 2.37.' unless Gem::Version.new(LIBC_VERSION.to_s) == Gem::Version.new('2.37')
end
def self.install
puts 'Installing Glibc_build237 to pull files for build...'.lightblue
@filelist_path = File.join(CREW_META_PATH, 'glibc_build237.filelist')

View File

@@ -3,18 +3,18 @@ require 'package'
class Openssl < Package
description 'The Open Source toolkit for Secure Sockets Layer and Transport Layer Security'
homepage 'https://www.openssl.org'
version '3.3.1' # Do not use @_ver here, it will break the installer.
version '3.3.2-ed16083' # Do not use @_ver here, it will break the installer.
license 'Apache-2.0'
compatibility 'all'
source_url 'https://www.openssl.org/source/openssl-3.3.1.tar.gz'
source_sha256 '777cd596284c883375a2a7a11bf5d2786fc5413255efab20c50d6ffe6d020b7e'
source_url 'https://github.com/openssl/openssl.git'
git_hashtag 'ed16083728a0ab73b87cef58e23ea5490e6e73cc'
binary_compression 'tar.zst'
binary_sha256({
aarch64: '9ca024bbac19008bca681c90358fc268720c713c980aab9ac51c9ac20891664b',
armv7l: '9ca024bbac19008bca681c90358fc268720c713c980aab9ac51c9ac20891664b',
i686: '139874f4228b62473bef4ec401e789f2fea7135afe1533f4519bd4c56c43e5c0',
x86_64: '01cb6b7f786ab02203ac8ec53b557317c4289e831aaf2e6c494bacec4322be74'
aarch64: '2ccf77f60e73fd60a93838395ae9bc239448a8f155c3f7e2d79928663041db9c',
armv7l: '2ccf77f60e73fd60a93838395ae9bc239448a8f155c3f7e2d79928663041db9c',
i686: '111b9f963d8b23c27f1c1f5be123637f9fbfbe1b7652fdcacf835e532b32efbf',
x86_64: 'b1d2926444a1091e9b41f119f1bfe189b91140743cf9db1c8539450d864978f0'
})
depends_on 'ccache' => :build
@@ -47,7 +47,7 @@ class Openssl < Package
CFLAGS=\"#{@ARCH_C_LTO_FLAGS}\" CXXFLAGS=\"#{@ARCH_CXX_LTO_FLAGS}\" \
LDFLAGS=\"#{@ARCH_LDFLAGS}\" \
mold -run ./Configure --prefix=#{CREW_PREFIX} \
--libdir=#{CREW_LIB_PREFIX} \
--libdir=#{ARCH_LIB} \
--openssldir=#{CREW_PREFIX}/etc/ssl \
#{@openssl_configure_target} #{@no_tests_target}"
system 'make'

View File

@@ -13,12 +13,9 @@ ruby ../tests/commands/prop.rb
ruby ../tests/commands/remove.rb
ruby ../tests/lib/docopt.rb
if [[ -n ${ALL_CHANGED_FILES-} ]]; then
# for file in ${ALL_CHANGED_FILES}; do
# ruby ../tests/prop_test "$file"
# ruby ../tests/buildsystem_test "$file"
# done
if [[ -n ${CHANGED_PACKAGES-} ]]; then
all_compatible_packages=$(crew list -d compatible)
all_installed_packages=$(crew list -d installed)
for pkg in ${CHANGED_PACKAGES}
do
# Only check packages compatible with the architecture
@@ -26,12 +23,19 @@ if [[ -n ${ALL_CHANGED_FILES-} ]]; then
if echo "${all_compatible_packages}" | grep "^${pkg}$"; then
ruby ../tests/prop_test "${pkg}"
ruby ../tests/buildsystem_test "${pkg}"
echo "Testing install/removal of compatible package ${pkg}."
yes | time crew install "${pkg}"
if echo "${all_installed_packages}" | grep "^${pkg}$"; then
echo "Testing reinstall of ${pkg}."
yes | time crew reinstall "${pkg}"
else
echo "Testing install of ${pkg}."
yes | time crew install "${pkg}"
fi
# Removal of essential packages is expected to fail.
if [[ $(crew list -d essential) == *"${pkg}"* ]]; then
echo "Testing removal of essential package ${pkg}."
yes | time crew remove "${pkg}" || true
else
echo "Testing removal of ${pkg}."
yes | time crew remove "${pkg}"
fi
else