Difference between revisions of "Package:Chuse"

From Funtoo
Jump to navigation Jump to search
m (Added ebuild footer)
(Updated Chuse doc for version 1.1)
Line 15: Line 15:
== Installation ==
== Installation ==


Chuse is available from the [https://github.com/apinsard/sapher-overlay sapher overlay].
{{console|body=###i## emerge -av app-portage/chuse}}


Once you have added this overlay through layman or whatever, just emerge {{c|chuse}}.
The latest version (1.1) requires {{c|dev-python/appi}} which is still in experimental development state. If you wish to avoid this dependency, you can mask {{c|>=app-portage/chuse-1.1}} and use version 1.0 which should still be supported a while.


{{console|body=###i## emerge -av chuse}}
{{console|body=
###i## echo '>=app-portage/chuse-1.1' >> /etc/portage/package.mask
###i## 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 {{c|/etc/chuse.conf}} rather than environment variable
- Coloration of useflags
 
== Configuration ==


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


This file would contain each rules for the package ''<pkg-name>'' in the category ''<cat-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 don't use this hierarchy pattern ===
Line 34: Line 46:
{{file|name=~/.bashrc|desc=PACKAGE_USE_FILE_PATTERN examples|body=
{{file|name=~/.bashrc|desc=PACKAGE_USE_FILE_PATTERN examples|body=
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use" # All in one file
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use" # All in one file
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/%(cat)s" # One file per category
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/{cat}" # One file per category
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/%(cat)s/%(pkg)s" # This is the default
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
PACKAGE_USE_FILE_PATTERN="/etc/portage/package.use/chuse" # One file dedicated to chuse
}}
}}


{{c|%(cat)s}} and {{c|%(pkg)s}} would be respectively replaced by the category name and the package name of
{{c|{cat} }} and {{c|{pkg} }} would be respectively replaced by the category name and the package name of
the atom you want to alter USE flags.
the atom you want to alter USE flags.
Since version 1.1, you can now configure this in {{c|/etc/chuse.conf}} which may be more convenient:
{{file|name=/etc/chuse.conf|body=
[package.use]
file-pattern = /etc/portage/package.use/{cat}
}}


==== If you want to adopt this hierarchy pattern ====
==== If you want to adopt this hierarchy pattern ====
Line 56: Line 75:
== Usage ==
== Usage ==


     chuse <atom> [[modifier]<flag> ...] [(--because|#) <reason>]
 
      
     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:
     atom:
        [version-selector]<ebuild-cat>/<ebuild-pkg>[-<version>][:<slot>]
         A valid package atom.
        Obviously 'version-selector' and 'version' should never be set without the other.
    version-selector:
        One of : "=", ">", "<", ">=", "<=".
    ebuild-cat:
        An ebuild category (validity won't be checked).
    ebuild-pkg:
        An ebuild package (validity won't be checked).
    version:
        A version of the underlying package (validity won't be checked).
    slot:
         A slot of the underlying package (validity won't be checked.
     modifier:
     modifier:
         One of : "+", "-", "%" (% means reset default). If omitted, "+" is assumed.
         One of: +, -, %. (% means reset default). If omitted, + is assumed.
     flag:
     flag:
         A USE flag (validity won't be checked).
         A USE flag (validity won't be checked).
     reason:
     reason:
         The reason why you changed these USE flags (so that you remember why you set this and if now
         The reason why you changed these US flags (so that you remember why you set this
        you can reset default for instance).
        and if you can reset default in the future for instance.


If no flag is specified, this will display the current rules matching the underlying atom.


== Examples ==
== Examples ==

Revision as of 14:04, January 15, 2017

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