Files
chromebrew/packages/crew_profile_base.rb
Satadru Pramanik, DO, MPH, MEng 172ca528a1 Python => 3.12.6 (#10436)
* remove @_ver from py3 packages, change to use pip, and rename where appropriate

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

* Update py3_package versions.

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

* bump version of update_ruby...

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

* Attempt to fix i686 install.

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

* Update core_packages.txt.

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

* Python => 3.12.6

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

* Remove binaries...

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

* Remove binaries from py3_ packages.

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

* lint/fixup

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

* move py3_wheel to pip

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

* Move pytimeparse to pip.

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

* Add ruby_debug gem to buildessential since it is needed for irb.

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

* move py3_text_unidecode to pip

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

* lint

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

* convert more packages to pip

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

* replace appdirs with platformdirs

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

* fixup

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

* fixup

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

* Pip should unconditionally install...

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

* Adjust pip install...

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

* Adjust py3_python_ package deps

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

* Add error message for which package file was not found.

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

* cleanup py3_typing_extensions

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

* Update python packages...

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

* Add some binaries.

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

* Adjust py3_setuptools...

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

* fixup py3_setuptools_rust

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

* ruby adjustments

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

* Add setuptools binaries

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

* Remove ruby_debug from fixup deprecation list.

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

* Update py3_magic to py3_python_magic.

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

* Update python packages, adjust update_python script and buildsystems/pip

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

* Fix missing version in py3_parsedatetime.

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

* Update update scripts to use parallel.

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

* Add py3_patchelf and py3_libxml2 binaries

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

* Add unless defined check for USER in const.rb.

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

* Change CREW_CONST_GIT_COMMIT from being a constant.

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

* Add binaries for py3_pyopenssl.

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

* Have remove use pip if possible.

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

* fixup

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

* add more debug code to fixup.

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

* Prepare pip packages for build...

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

* fixup py3_pyyaml

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

* update py3_pyyaml

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

* fix py3_unsupported_python

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

* fix py3_unsupported_python

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

* remove some debug code

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

* more pip updates

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

* Add more binaries.

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

* Add binaries for py3_pyopenssl.

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

* Add py3_oci binaries.

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

* Add binaries

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

* Update py3_twine.

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

* update py3_oci_cli binaries

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

* cleanup buildsystems/pip

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

* add binaries for sphinx

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

* Update more packages.

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

* add binary_compression to pip files

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

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-09-10 10:55:11 -05:00

96 lines
3.2 KiB
Ruby

require 'package'
class Crew_profile_base < Package
description 'Crew-profile-base sets up Chromebrew\'s environment capabilities.'
homepage 'https://github.com/chromebrew/crew-profile-base'
version '0.0.23'
license 'GPL-3+'
compatibility 'all'
source_url "https://github.com/chromebrew/crew-profile-base/archive/refs/tags/#{version}.tar.gz"
source_sha256 'e063af6611d7a622c3dfc11bb3bbeb3db4b2c5335731610aa0799880f5afc0aa'
no_compile_needed
print_source_bashrc
def self.install
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/env.d"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/profile.d"
# Don't overwrite custom changes
%w[01-locale 02-editor 03-pager 99-custom].each do |custom_files|
FileUtils.rm "./src/env.d/#{custom_files}" if File.exist?("#{CREW_PREFIX}/etc/env.d/#{custom_files}")
end
FileUtils.cp_r Dir['./src/*'], "#{CREW_DEST_PREFIX}/etc/"
end
def self.postinstall
# Write our rc files
crew_rc_source_line = "source #{CREW_PREFIX}/etc/profile"
crew_rcfile = <<~CREW_PROFILE_EOF
# DO NOT DELETE THIS LINE
# See #{CREW_PREFIX}/etc/profile for further details
#{crew_rc_source_line}
# Put your stuff under this comment
CREW_PROFILE_EOF
# append our #{crew_rcfile} to shell rc files (if exist)
['.bashrc', '.zshrc'].each do |rc|
rc_path = File.join(HOME, rc)
FileUtils.touch rc_path
# next unless File.exist?(rc_path)
rc_file = File.readlines(rc_path, chomp: true)
# remove duplicated `source` lines (if any)
if rc_file.count(crew_rc_source_line) > 1
puts "Removing duplicated `source` lines in #{rc_path}...".yellow
first_source_line_index = rc_file.find_index(crew_rc_source_line)
# delete all `source` lines
rc_file.delete(crew_rc_source_line)
# re-add the first `source` line
rc_file.insert(first_source_line_index, crew_rc_source_line)
end
# append our rc string to the beginning of the rc file (if not exist)
if rc_file.none? { |line| line == "source #{CREW_PREFIX}/etc/profile" }
puts "Appending `#{crew_rc_source_line}` to the beginning of #{rc_path}...".yellow
rc_file.unshift(crew_rcfile.lines(chomp: true))
end
# save changes
File.write rc_path, rc_file.join("\n")
end
puts 'Choose your default pager:'.yellow
@pager_options = [
{ value: 'most', description: 'Most Pager' },
{ value: 'more', description: 'More Pager' },
{ value: 'less', description: 'Less Pager' }
]
@pager_default = Selector.new(@pager_options).show_prompt
Dir.chdir CREW_DEST_DIR do
File.write 'pagerenv', <<~PAGER_ENV_EOF
# The user's preferred pager is set here by the crew_profile_base
# postinstall.
# PAGER from container PAGER variable is passed through into the
# CONTAINER_PAGER variable.
if [ -z "$CONTAINER_PAGER" ]; then
PAGER="#{@pager_default}"
else
PAGER="$CONTAINER_PAGER"
fi
PAGER_ENV_EOF
FileUtils.install 'pagerenv', "#{CREW_PREFIX}/etc/env.d/03-pager", mode: 0o644
end
puts "The default PAGER has been set to #{@pager_default}.".lightblue
end
end