mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-07 22:54:11 -05:00
@@ -94,6 +94,7 @@ Where available commands are:
|
||||
| remove | remove package(s) |
|
||||
| search | look for package(s) |
|
||||
| sysinfo | show system information in markdown style |
|
||||
| test | test crew command(s) |
|
||||
| update | update crew itself |
|
||||
| upgrade | update all or specific package(s) |
|
||||
| upload | upload binaries for all or specific package(s) |
|
||||
|
||||
24
Rakefile
24
Rakefile
@@ -1,24 +0,0 @@
|
||||
# The default action tests commands and libraries.
|
||||
task default: %w[command_test lib_test]
|
||||
|
||||
# Command tests
|
||||
task :command_test do
|
||||
ruby 'tests/commands/const.rb'
|
||||
ruby 'tests/commands/help.rb'
|
||||
ruby 'tests/commands/list.rb'
|
||||
ruby 'tests/commands/prop.rb'
|
||||
ruby 'tests/commands/remove.rb'
|
||||
ruby 'tests/commands/whatprovides.rb'
|
||||
end
|
||||
|
||||
# Library tests
|
||||
task :lib_test do
|
||||
ruby 'tests/lib/docopt.rb'
|
||||
ruby 'tests/lib/package_utils.rb'
|
||||
end
|
||||
|
||||
# Package tests
|
||||
task :package_test do
|
||||
ruby 'tests/prop_test'
|
||||
ruby 'tests/buildsystem_test'
|
||||
end
|
||||
24
bin/crew
24
bin/crew
@@ -1756,6 +1756,30 @@ def sysinfo_command(_args)
|
||||
Command.sysinfo(CREW_VERBOSE)
|
||||
end
|
||||
|
||||
def test_command(args)
|
||||
test_commands_path = "#{CREW_LIB_PATH}/tests/commands"
|
||||
if args['<name>'].empty?
|
||||
Dir["#{test_commands_path}/*.rb"].each do |name|
|
||||
basename = File.basename(name, '.rb')
|
||||
puts "Testing #{basename} command ...".yellow
|
||||
system("ruby #{name}")
|
||||
end
|
||||
else
|
||||
args['<name>'].each do |name|
|
||||
basename = File.basename(name, '.rb')
|
||||
name = basename if basename != name
|
||||
if File.file?("#{test_commands_path}/#{name}.rb")
|
||||
Dir.chdir(test_commands_path) do
|
||||
puts "Testing #{name} command ...".yellow
|
||||
system("ruby #{name}.rb")
|
||||
end
|
||||
else
|
||||
puts "The #{name} command or test does not exist. Test skipped.".orange
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_command(args)
|
||||
if args['<compatible>']
|
||||
generate_compatible
|
||||
|
||||
@@ -118,6 +118,14 @@ class Command
|
||||
Usage: crew sysinfo [-v|--verbose]
|
||||
If `-v` or `--verbose` is present, show system information with raw markdown.
|
||||
EOT
|
||||
when 'test'
|
||||
puts <<~EOT
|
||||
Test crew command(s).
|
||||
Usage: crew test [<command1> <command2> ...]
|
||||
The crew command and associated test must exist.
|
||||
If no commands are provided, all commands will be tested.
|
||||
To list all commands, simply type 'crew'.
|
||||
EOT
|
||||
when 'update'
|
||||
puts <<~EOT
|
||||
Update crew.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'etc'
|
||||
|
||||
OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0'
|
||||
CREW_VERSION ||= '1.52.2' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
|
||||
CREW_VERSION ||= '1.52.1' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION
|
||||
|
||||
# Kernel architecture.
|
||||
KERN_ARCH ||= Etc.uname[:machine]
|
||||
@@ -332,6 +332,7 @@ CREW_DOCOPT ||= <<~DOCOPT
|
||||
crew remove [options] [-v|--verbose] <name> ...
|
||||
crew search [options] [-v|--verbose] <name> ...
|
||||
crew sysinfo [options] [-v|--verbose]
|
||||
crew test [options] [-v|--verbose] [<name> ...]
|
||||
crew update [options] [-v|--verbose] [<compatible>]
|
||||
crew upgrade [options] [-k|--keep] [-s|--source] [-v|--verbose] [<name> ...]
|
||||
crew upload [options] [-v|--verbose] [<name> ...]
|
||||
|
||||
@@ -79,7 +79,7 @@ class PackageUtils
|
||||
pkg_version.gsub!(/-perl5\.\d{2}/, '')
|
||||
# Delete -llvm18, futureproofed until llvm 100
|
||||
pkg_version.gsub!(/-llvm\d{2}/, '')
|
||||
# Delete -glibc2.37, or whatever the system glibc is.
|
||||
# Delete -glibc2.39, or whatever the system glibc is.
|
||||
pkg_version.delete_suffix!("-glibc#{LIBC_VERSION}")
|
||||
# Delete git version tags (1.2.4-qnd73k6), avoiding overmatching and hitting things that arent git hashtags.
|
||||
pkg_version.gsub!(/-[\w]{7}$/, '')
|
||||
|
||||
@@ -157,7 +157,7 @@ class PackageUtilsTest < Minitest::Test
|
||||
end
|
||||
|
||||
def test_get_clean_glibc_version
|
||||
assert_equal('9.5.18', PackageUtils.get_clean_version("9.5.18-glibc#{LIBC_VERSION}"))
|
||||
assert_equal('9.5.18', PackageUtils.get_clean_version('9.5.18-glibc2.39'))
|
||||
end
|
||||
|
||||
def test_get_clean_git_version
|
||||
|
||||
@@ -10,7 +10,13 @@ git clone --depth=1 --branch="$CREW_BRANCH" "$CREW_REPO" ~/build_test
|
||||
(cd ~/build_test && yes | CREW_CACHE_ENABLED=1 crew build -vf ~/build_test/packages/hello_world_chromebrew.rb)
|
||||
yes | crew install vim
|
||||
yes | crew remove vim
|
||||
rake -C..
|
||||
ruby ../tests/commands/const.rb
|
||||
ruby ../tests/commands/help.rb
|
||||
ruby ../tests/commands/list.rb
|
||||
ruby ../tests/commands/prop.rb
|
||||
ruby ../tests/commands/remove.rb
|
||||
ruby ../tests/commands/whatprovides.rb
|
||||
ruby ../tests/lib/docopt.rb
|
||||
if [[ -n ${CHANGED_PACKAGES-} ]]; then
|
||||
all_compatible_packages=$(crew list -d compatible)
|
||||
all_installed_packages=$(crew list -d installed)
|
||||
|
||||
Reference in New Issue
Block a user