注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Package:Chuse

From Funtoo
Revision as of 14:04, January 15, 2017 by Pytony (talk | contribs) (Updated Chuse doc for version 1.1)
Jump to navigation Jump to search

Chuse

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Chuse stands for CHange USE. This is a Portage tool for managing your local USE flags (ie. set within /etc/portage/package.use).

In contrast to its several equivalents, it is designed with a very specific goal: Make your /etc/portage/package.use management easier. This means chuse does not handle other package.* and focuses on package.use.

Installation

root # emerge -av app-portage/chuse

The latest version (1.1) requires dev-python/appi which is still in experimental development state. If you wish to avoid this dependency, you can mask {{{1}}} and use version 1.0 which should still be supported a while.

root # echo '>=app-portage/chuse-1.1' >> /etc/portage/package.mask
root # emerge -av app-portage/chuse

Major changes brought by 1.1 are :

- Check if ebuilds matching the given atom exist - Allow to omit the package category if it is not ambiguous - Configuration of the "package.use file pattern" in /etc/chuse.conf rather than environment variable - Coloration of useflags

Configuration

By default, chuse uses the following hierarchy pattern: /etc/portage/package.use/<cat-name>/<pkg-name>

Any file matching this pattern should contain the rules for the package <pkg-name> from the category <cat-name>.

If you don't use this hierarchy pattern

If you want to use your own current pattern

You can change this pattern by explicitely setting the PACKAGE_USE_FILE_PATTERN environment variable (eg. in your bashrc).

   ~/.bashrc - PACKAGE_USE_FILE_PATTERN examples
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use" # All in one file
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/{cat}" # One file per category
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/{cat}/{pkg}" # This is the default
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/chuse" # One file dedicated to chuse

{cat} and {pkg} would be respectively replaced by the category name and the package name of the atom you want to alter USE flags.

Since version 1.1, you can now configure this in /etc/chuse.conf which may be more convenient:

   /etc/chuse.conf
[package.use]
file-pattern = /etc/portage/package.use/{cat}

If you want to adopt this hierarchy pattern

You will have to backup your current USE flags in a file and reorganize the package.use hierarchy. To achieve this, issue the following commands:

root # chuse --dump > /root/package.use.bak # Concat all your rules in one file
root # chuse --load /root/package.use.bak # Parse the file to organize your package.use

To avoid mistakes, chuse --load will ask you before erasing /etc/portage/package.use.

Usage

   chuse [-f|--force] <atom> [[modifier]<flag> ...] [--because <reason>]
       Alter use flags. By default, if the given atom doesn't match any existing ebuild,
       an error will be raised. Use -f/--force option to disable this behavior.  If no flag
       is specified, the current rules matching the underlying atom will be displayed.
   chuse <atom>
       Print current flags set and history.
   chuse (-h|--help)
       Print this help.chuse (-v|--version)
       Print version information.
   chuse --dump
       Print all contents of /etc/portage/package.use
   chuse --load <file>
       Load a backup file to the /etc/portage/package.use hierarchy.
   atom:
       A valid package atom.
   modifier:
       One of: +, -, %. (% means reset default). If omitted, + is assumed.
   flag:
       A USE flag (validity won't be checked).
   reason:
       The reason why you changed these US flags (so that you remember why you set this
       and if you can reset default in the future for instance.


Examples

Show the flags you altered for firefox:

user $ chuse www-client/firefox

Add system-cairo, remove system-icu and reset system-jpeg for firefox >= 37.0.1:

root # chuse ">=www-client/firefox-37.0.1" system-cairo -system-icu %system-jpeg