Add 'crew prop' command and supporting help. (#7793)

* Add 'crew prop' command and supporting help.

* Update README.md

Co-authored-by: chronos <no-reply@github.com>
This commit is contained in:
Ed Reel
2023-01-02 21:26:03 -06:00
committed by GitHub
parent f04630f3b9
commit adbc2e9863
3 changed files with 144 additions and 108 deletions

160
README.md
View File

@@ -1,97 +1,86 @@
<p align="center"><img src="/images/brew.png" alt="Chromebrew logo" /></p>
<h1 align="center">Chromebrew</h1>
# Chromebrew
<p align="center">Package manager for Chrome OS</p>
![Chromebrew logo](/images/brew.png)
Chat with us!
-------------
<p><em>Discord is not currently syncing messages with Slack</em></p>
The Missing Package Manager For Chrome OS
<p>
<!-- dark/light mode detection, see https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#specifying-the-theme-an-image-is-shown-to -->
<a href="mailto:crewonslack@gmail.com?subject=Slack invitation link request&body=This email is auto-generated by README.md%0D%0A%0D%0A#gh-light-mode-only" target="_blank">
<img src="https://cdn.bfldr.com/5H442O3W/at/pl546j-7le8zk-838dm2/Slack_RGB.png?auto=webp&format=png#gh-light-mode-only" alt="Slack Invite" width="158px" height="40px" align="middle">
</a>
<a href="mailto:crewonslack@gmail.com?subject=Slack invitation link request&body=This email is auto-generated by README.md%0D%0A%0D%0A#gh-dark-mode-only" target="_blank">
<img src="https://cdn.bfldr.com/5H442O3W/at/pljt3c-dcwb20-27ztzl/Slack_RGB_White.png?auto=webp&format=png#gh-dark-mode-only" alt="Slack Invite" width="158px" height="40px" align="middle">
</a>
<img src="about:blank" width="15px"> <!-- acting a space between two images -->
<a href="https://discord.gg/QRrzBXN#gh-light-mode-only" target="_blank">
<img src="https://discord.com/assets/ff41b628a47ef3141164bfedb04fb220.png#gh-light-mode-only" alt="Discord Invite" width="201px" height="55px" align="middle">
</a>
<a href="https://discord.gg/QRrzBXN#gh-dark-mode-only" target="_blank">
<img src="https://discord.com/assets/2f71ab5383293f63985ac8d5c632b3d4.png#gh-dark-mode-only" alt="Discord Invite" width="201px" height="55px" align="middle">
</a>
</p>
## Chat With Us
Overview
--------
_Discord is not currently syncing messages with Slack_
[![Slack Invite](https://cdn.bfldr.com/5H442O3W/at/pl546j-7le8zk-838dm2/Slack_RGB.png?auto=webp&format=png#gh-light-mode-only)](mailto:crewonslack@gmail.com?subject=Slack invitation link request&body=Auto-generated by README.md#gh-light-mode-only)
[![Slack Invite](https://cdn.bfldr.com/5H442O3W/at/pljt3c-dcwb20-27ztzl/Slack_RGB_White.png?auto=webp&format=png#gh-dark-mode-only)](mailto:crewonslack@gmail.com?subject=Slack invitation link request&body=Auto-generated by README.md#gh-dark-mode-only)![](about:blank)
[![Discord Invite](https://discord.com/assets/ff41b628a47ef3141164bfedb04fb220.png#gh-light-mode-only)](https://discord.gg/QRrzBXN#gh-light-mode-only)
[![Discord Invite](https://discord.com/assets/2f71ab5383293f63985ac8d5c632b3d4.png#gh-dark-mode-only)](https://discord.gg/QRrzBXN#gh-dark-mode-only)
## Overview
Chromebooks with Chrome OS run a Linux kernel. The only missing pieces to use them as full-featured Linux distro were gcc and make with their dependencies. Well, these pieces aren't missing anymore. Say hello to Chromebrew!
Prerequisites
-------------
## Prerequisites
You will need a Chromebook with developer mode enabled. To do so, select your device on
[the ChromiumOS Wiki](https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices) and follow the instructions listed there.
You will need a Chromebook with developer mode enabled. To do so, select your device on [the ChromiumOS Wiki](https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices) and follow the instructions listed there. Please be aware of the fact that developer mode is insecure if not properly configured.
Please be aware of the fact that developer mode is insecure if not properly configured. Setting a password as instructed in the VT-2 login screen is recommended. It is also recommended to enable signed boot:
Setting a password as instructed in the VT-2 login screen is recommended. It is also recommended to enable signed boot:
sudo chromeos-setdevpasswd
sudo crossystem dev_boot_signed_only=1
```bash
sudo chromeos-setdevpasswd
sudo crossystem dev_boot_signed_only=1
```
Supported Systems
-----------------
## Supported Systems
| Architecture | Supported? |
|:---:|:---:|
| x86_64 | Yes |
| i686 | Yes<sup>*</sup> |
| i686 | Yes* |
| armv7l | Yes |
| aarch64 | Yes |
<sup>*</sup> <em>We can only provide limited support for i686 since Google has discontinued support. Although we can no longer support GUI apps, we will try to continue to support CLI programs.</em>
\* _We can only provide limited support for i686 since Google has discontinued support. Although we can no longer support GUI apps, we will try to continue to support CLI programs._
Installation
------------
## Installation
The beta, dev, and Canary channels are ***not*** supported and should ***not*** be used with Chromebrew. Failure to take notice of this warning will cause major issues with your Chromebrew installation.
The beta, dev, and Canary channels are ***not*** supported and should ***not*** be used with Chromebrew.
Failure to take notice of this will cause major issues with your Chromebrew installation.
See issue [#2890](https://github.com/chromebrew/chromebrew/issues/2890) and the [FAQ](https://github.com/chromebrew/chromebrew/wiki/FAQ) for more details.
Open the terminal with Ctrl+Alt+T and type `shell`.
If this command returns `ERROR: unknown command: shell`, please have a second look at the prerequisites and make sure your Chromebook is in developer mode.
Open the terminal with Ctrl+Alt+T and type `shell`. If this command returns `ERROR: unknown command: shell`, please have a second look at the prerequisites and make sure your Chromebook is in developer mode.
Then download and run the installation script below:
curl -Ls git.io/vddgY | bash
```bash
curl -Ls git.io/vddgY | bash
```
On a rooted Google OnHub, the command needs to be run with the "chronos" user. In order to make su work, a password is needed for the chronos user.
# passwd chronos
Changing password for chronos.
Enter new UNIX password:
Retype new UNIX password:
# su - chronos
Password:
$ curl -Ls git.io/vddgY | bash
```bash
# passwd chronos
Changing password for chronos.
Enter new UNIX password:
Retype new UNIX password:
# su - chronos
Password:
$ curl -Ls git.io/vddgY | bash
```
Help
----
## Help
Please check out the [wiki](https://github.com/chromebrew/chromebrew/wiki) to find out more information about Chromebrew including helpful tips, resource links and frequently asked questions. Also please check existing [issues](https://github.com/chromebrew/chromebrew/issues) before submitting a new one.
Please check out the [wiki](https://github.com/chromebrew/chromebrew/wiki) to find out more information about Chromebrew including helpful tips, resource links and frequently asked questions.
Usage
-----
Also please check existing [issues](https://github.com/chromebrew/chromebrew/issues) before submitting a new one.
crew <command> [-k|--keep] <package1> [<package2> ...]
## Usage
```bash
crew [-k|--keep] [...]
```
Where available commands are:
| Command | Description |
|:---|:---|
| Command | Description | |:---|:---|
| build | build package(s) from source and store the archive and checksum in the current working directory |
| const | display constant(s) |
| deps | display dependencies of package(s) |
@@ -101,60 +90,25 @@ Where available commands are:
| install | install package(s) along with dependencies after prompting for confirmation |
| list | available, installed, compatible or incompatible packages |
| postinstall | display postinstall messages of package(s) |
| prop | display all package boolean properties |
| reinstall | remove and install package(s) |
| remove | remove package(s) |
| search | look for package(s) |
| sysinfo | show system infomation in Markdown style |
| sysinfo | show system information in markdown style |
| update | update crew itself |
| upgrade | update all or specific package(s) |
| whatprovides | regex search for package(s) that contains file(s) |
Available packages are listed in the [packages directory](https://github.com/chromebrew/chromebrew/tree/master/packages).
Available packages are listed in the [packages directory](https://github.com/chromebrew/chromebrew/tree/master/packages). Chromebrew will wipe its `BREW_DIR` (`/usr/local/tmp/crew` by default) after installation unless you pass `-k` or `--keep` when running `crew install`.
Chromebrew will wipe its `BREW_DIR` (`/usr/local/tmp/crew` by default) after installation unless you pass `-k` or `--keep` when running `crew install`.
```bash
crew install --keep [...]
```
crew install --keep <package1> [<package2> ...]
## License
Recently Upgraded Packages
--------------------------
Copyright 2013-2023 Michal Siwek and [all the awesome contributors](https://github.com/chromebrew/chromebrew/graphs/contributors). This project including all of its source files is released under the terms of [GNU General Public License (version 3 or later)](http://www.gnu.org/licenses/gpl.txt). This project embeds [docopt.rb](https://github.com/docopt/docopt.rb) at lib/docopt.rb. We retain its [MIT license](https://github.com/chromebrew/chromebrew/blob/master/lib/docopt.LICENSE).
| Name | Description | Date Upgraded | Version |
|:---|:---|:---|:---|
| gdb | The GNU Debugger | 2021-09-25 | 11.1 |
| llvm | The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. | 2021-09-24 | 12.0.1 |
| binutils | The GNU Binutils are a collection of binary tools. | 2021-09-24 | 2.37-1 |
| inetutils | The Inetutils package contains programs for basic networking. | 2021-09-24 | 2.2 |
| elfutils | elfutils is a collection of utilities and libraries to read, create and modify ELF binary files | 2021-09-24 | 0.185 |
| neon | neon is an HTTP and WebDAV client library, with a C interface. | 2021-09-24 | 0.32.1 |
| pango | Pango is a library for laying out and rendering of text, with an emphasis on internationalization. | 2021-09-24 | 1.49.1 |
| libadwaita | Library of GNOME-specific UI patterns, replacing libhandy for GTK4 | 2021-09-24 | 1.0.0-alpha.2 |
| gtksourceview_5 | Source code editing widget | 2021-09-24 | 5.2.0 |
| gspell | A flexible API to implement the spell checking in a GTK+ application | 2021-09-24 | 1.9.1-2 |
[![GNU General Public License](https://www.gnu.org/graphics/gplv3-127x51.png)](https://www.gnu.org/licenses/gpl-3.0.en.html)
Latest Packages
---------------
| Name | Description | Date Added |
|:---|:---|:---|
| gnu_time | Utility for monitoring a programs use of system resources | 2021-09-24 |
| gnome_text_editor | GNOME Text Editor (2021) | 2021-09-24 |
| vuze | Vuze (formerly Azureus) is an extremely powerful and configurable BitTorrent client. | 2021-09-21 |
| smallbasic | SmallBASIC is a fast and easy to learn BASIC language interpreter | 2021-09-19 |
| logisim | An educational tool for designing and simulating digital logic circuits | 2021-09-16 |
| cros_adapta | Gtk+ compatible themes for styling UI elements from Crostini to match Chrome OS defaults. | 2021-09-10 |
| chafa | Image-to-text converter supporting a wide range of symbols and palettes, transparency, animations, etc. | 2021-09-04 |
| qtlocation | Qt Location and Positioning | 2021-08-30 |
| qtmultimedia | Qt Multimedia | 2021-08-30 |
| qtscript | Qt Script Tools | 2021-08-30 |
License
-------
Copyright 2013-2022 Michal Siwek and [all the awesome contributors](https://github.com/chromebrew/chromebrew/graphs/contributors).
This project including all of its source files is released under the terms of [GNU General Public License (version 3 or later)](http://www.gnu.org/licenses/gpl.txt).
This project embeds [docopt.rb](https://github.com/docopt/docopt.rb) at lib/docopt.rb. We retain its [MIT license](https://github.com/chromebrew/chromebrew/blob/master/lib/docopt.LICENSE).
<a rel="license-software" href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img alt="GNU General Public License" style="border-width:0" src="https://www.gnu.org/graphics/gplv3-127x51.png" height="31" /></a>
<a rel="license-docopt" href="https://mit-license.org/"><img alt="MIT License" style="border-width:0" src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" height="31" /></a>
[![MIT License](https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg)](https://mit-license.org/)

View File

@@ -43,10 +43,11 @@ DOC = <<~DOCOPT
crew deps [options] [-t|--tree] [-b|--include-build-deps] [--exclude-buildessential] <name> ...
crew download [options] <name> ...
crew files [options] <name> ...
crew help [<command>]
crew help [<command>] [<subcommand>]
crew install [options] [-k|--keep] [-s|--build-from-source] [-S|--recursive-build] <name> ...
crew list [options] (available|installed|compatible|incompatible)
crew postinstall [options] <name> ...
crew prop
crew reinstall [options] [-k|--keep] [-s|--build-from-source] [-S|--recursive-build] <name> ...
crew remove [options] <name> ...
crew search [options] [<name> ...]
@@ -379,6 +380,68 @@ def help(pkgName = nil)
Usage: crew postinstall <package1> [<package2> ...]
The package(s) must be currently installed.
EOT
when 'prop'
if ARGV[2]
valid = nil
properties = prop(true)
properties.each do |p|
if ARGV[2] == p
valid = true
break
end
end
abort 'Invalid property.'.lightred unless valid
case ARGV[2]
when 'conflicts_ok'
puts "The 'conflicts_ok' property bypasses checks for other package file conflicts."
when 'git_clone_deep'
puts "The 'git_clone_deep' property clones the repository without a depth value."
puts "Applicable only when 'source_url' is a git repository."
when 'git_fetchtags'
puts "The 'git_fetchtags' property gets the repository tags."
puts "Applicable only when 'source_url' is a git repository."
when 'gnome'
puts "Use the 'gnome' property for gnome specific packages."
when 'is_fake'
puts "Use the 'is_fake' property for packages that simply depend on other packages."
when 'is_musl'
puts "Use the 'is_musl' property for musl specific packages."
when 'is_static'
puts "Use the 'is_static' property for packages which do not require shared dependencies."
when 'no_compile_needed'
puts "Use the 'no_compile_needed' property for packages that do not require pre-built binaries."
when 'no_compress'
puts "Use the 'no_compress' property for packages that do not need compressed files."
when 'no_env_options'
puts "Use the 'no_env_options' property for packages that do not require"
puts 'environment options or to override the default options.'
when 'no_fhs'
puts "The 'no_fhs' property bypasses FHS3 compliance checks."
when 'no_git_submodules'
puts "Use the 'no_git_submodules' property for repositories without git submodules."
puts "Applicable only when 'source_url' is a git repository."
when 'no_links'
puts "Use the 'no_links' property to bypass checks for duplicate links."
when 'no_patchelf'
puts "Use the 'no_patchelf' property to bypass patchelf execution."
when 'no_shrink'
puts "Use the 'no_shrink' property to bypass upx binary compression."
when 'no_strip'
puts "Use the 'no_strip' property to bypass strip execution."
when 'no_zstd'
puts "Use the 'no_zstd' property for the alternate xz compression algorithm."
when 'patchelf'
puts "Use the 'patchelf' property for patchelf execution."
puts 'This is the default and for most cases is not needed.'
else
abort "Help for the '#{ARGV[2]}' property is not available.".lightred
end
else
puts <<~EOT
Display all available package boolean properties.
Usage: crew prop
EOT
end
when 'reinstall'
puts <<~EOT
Remove and install package(s).
@@ -412,10 +475,9 @@ def help(pkgName = nil)
EOT
when 'sysinfo'
puts <<~EOT
Show system infomation.
If `-v` or `--verbose` is present, show system infomation with raw Markdown.
Show system information.
Usage: crew sysinfo
If `-v` or `--verbose` is present, show system information with raw markdown.
EOT
when 'update'
puts <<~EOT
@@ -509,6 +571,22 @@ def files(pkgName)
end
end
def prop(silent = false)
props = []
pkg = Package.new
excluded_methods = %w[compatible is_binary is_source json_creatable autoload include const_defined class_variable_defined singleton_class method_defined public_method_defined private_method_defined protected_method_defined instance_variable_defined instance_of kind_of is_a frozen nil eql respond_to equal]
all_methods = pkg.class.methods.grep(/\?$/).to_s.gsub(/([?:,\[\]])/, '').split
all_methods.each do |method|
props.push(method) unless excluded_methods.include?(method)
end
if silent
return props
else
puts props.sort
puts "For more information, type 'crew help prop <property>' where <property> is one of the above properties.".lightblue
end
end
def whatprovides(regexPat)
matchedList = `grep "#{regexPat}" #{CREW_META_PATH}*.filelist`.lines(chomp: true).flat_map do |result|
filelist, matchedFile = result.split(':', 2)
@@ -1736,6 +1814,10 @@ def postinstall_command(args)
end
end
def prop_command(_)
prop
end
def reinstall_command(args)
args['<name>'].each do |name|
@pkgName = name

View File

@@ -1,6 +1,6 @@
# Defines common constants used in different parts of crew
CREW_VERSION = '1.30.5'
CREW_VERSION = '1.30.6'
# kernel architecture
KERN_ARCH = `uname -m`.chomp