Files
chromebrew/lib/deb_utils.rb
github-actions[bot] e85da25bf9 Post GLIBC upgrade updates WIP (#11807)
* build gcc 15.1 RC

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

* Add rust build dep to gcc.

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

* back out rust

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

* Add conflicts_ok.

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

* Add built packages for linux/386 to gcc15

* Add built packages for linux/amd64 to gcc15

* Add built packages for linux/arm/v7 to gcc15

* remove gcc_lib dep from gcc_build.

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

* Add back rust.

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

* Add more binaries

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

* cleanup

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

* update hashes

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

* add no_shrink to llvm20_build

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

* alphabetize

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

* Testing changes

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

* more gcc build adjustments

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

* rust adjustments

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

* binutils, gcc_build adjustments

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

* add binaries

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

* add binaries

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

* Adjust crew to handle adding hashes for remote binaries

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

* Add binaries

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

* Add binaries, adjust getrealdeps

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

* Revert BASH_ENV changes

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

* Add some gdb builds

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

* Add more arm binaries

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

* Add arm binaries for gdb

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

* Adjust rustflags.

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

* update rust package, add rust buildsystem, add zellij

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

* Update packages/gcc_dev.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_dev.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_lib.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_lib.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/libssp.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/libssp.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/libssp.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/libssp.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add CREW_GCC_VER case binaries for binutils.

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

* Move valid buildsystems list into const.rb

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

* Add zellij to packages.yaml.

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

* Add gcc14 build hashes for gdb

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

* Add glibc 2.37 compat

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

* Update gcc 15.1 RC version to 15.1.0-RC-20250423.

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

* Add update gcc_build builds

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

* Update binaries

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

* Update uutils_coreutils build to use rust buildsystem

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

* Update uutils package

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

* rust fixes...

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

* Add built packages for linux/386 to gcc15

* Add built packages for linux/amd64 to gcc15

* Add built packages for linux/arm/v7 to gcc15

* Add final gcc15.1 version

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

* Add gcc 15.1 binaries.

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

* Update packages/gcc_build.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_build.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/libssp.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/libssp.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_lib.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_lib.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_dev.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update packages/gcc_dev.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update crew

* Update rust for new glibc.

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

* Remove glibc versioning from gcc builds, adjust crew to add CREW_GLIBC_PREFIX to existing rpaths during installs.

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

* Update bin/crew

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix crew lint garbage.

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

* rejigger gcc build

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

* Adjust gcc build args.

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

* sync with master

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

* Add WIP gcc_build package.

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

* iterate on gcc_build

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

* Adjust gcc_build...

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

* Rationalize env variable names.

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

* lint

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

* More gcc_build adjustments.

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

* Adjust fixup to not break existing rpaths.

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

* Update gcc_build.rb for new Chromebrew glibc.

* Sync  gcc_build.rb with master.

* Sync binutils.rb with master.

* remove core

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

* Add shell replacement to filefix.

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

* update rubygems

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

* Update crew_profile_base to 0.0.27

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

* Update crew_profile_base again.

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

* Always run filefix in autotools buildsystem.

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

* Add packages, make adjustments.

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

* cleanup binutils

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

* Adjust fixup and gcc_build

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

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: satmandu <satmandu@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ed Reel <edreel@gmail.com>
2025-05-21 18:00:34 +00:00

61 lines
2.5 KiB
Ruby

module DebUtils
def self.extract_deb(file, target)
# extract_deb: unarchive .deb files
# Usage: extract_deb(<file>, <target (optional)>)
# file: a .deb archive file
# target: (optional) a specified file to extract from archive, should be passed in regex or string
#
# Example:
# extract_deb('example.deb', 'test.txt') # extract `test.txt` from example.deb
# extract_deb('example.deb', /data\..*/) # extract files from example.deb with filenames matching the /data\..*/ regex
# extract_deb('example.deb', /*/) # extract all files from example.deb
#
file_found = false
src_file_io = File.open(file, 'rb')
file_size = src_file_io.size
# get first line of the given file, should be a signature string (`!<arch>\n`) if it is a valid deb file
signature = src_file_io.gets
abort 'Malformed archive :/'.lightred unless signature == "!<arch>\n"
# process each file in archive
while (line = src_file_io.gets)
if line.chomp.empty? && (file_size == src_file_io.tell)
# early return if trailing newline is detected
break
elsif line.chomp.empty?
warn "Unexpected newline in offset #{src_file_io.tell}, ignoring...".yellow
next
end
# read file meta
name, _modtime, _uid, _gid, mode, size, end_char =
line.scan(/(.{16})(.{12})(.{6})(.{6})(.{8})(.{10})(.{1})/).flatten.map(&:strip)
# remove slash suffix from filename (if any)
# (a `.deb` ar archive does not support any directories, so we can confirm that all entries are normal files)
name&.sub!(%r{/$}, '')
# check ending byte
abort 'Malformed archive :/'.lightred unless end_char == '`'
# capture file in archive with given offset bytes (file size)
file_content = src_file_io.read(size.to_i)
# filter filename if a target file is specified
if target.is_a?(String) && (name == target)
# if target is passed as string, write matched file to filesyetem and exit function
# write to filesystem
return File.binwrite(name, file_content, perm: mode.to_i(8))
elsif target.is_a?(Regexp) && name =~ target
# if target is passed as regex, write matched file to filesyetem and continue
# searching for another matched file until EOF
# write to filesystem
File.binwrite(name, file_content, perm: mode.to_i(8))
file_found = true
end
end
abort "Target #{target.inspect} not found in archive. :/".lightred unless file_found
end
end