Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apinsard/chuse
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1
Choose a base ref
...
head repository: apinsard/chuse
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Aug 12, 2017

  1. Copy the full SHA
    221a10a View commit details
Showing with 55 additions and 18 deletions.
  1. +10 −3 ChangeLog
  2. +15 −5 README.md
  3. +17 −6 chuse
  4. +13 −4 chuse.pod
13 changes: 10 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [1.2] - 2017-08-12
### Changed
- Check that ebuilds matched by the atom accept the given useflags to avoid
typos

## [1.1] - 2017-01-12
### Added
- Possibility to configure file pattern in /etc/chuse.conf
@@ -42,6 +47,8 @@
- Default modifier is now "+" instead of error on missing modifier
- Made PEP8 compliant

[1.0.2]: https://github.com/apinsard/chuse/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/apinsard/chuse/compare/1.0...1.0.1
[1.0]: https://github.com/apinsard/chuse/compare/0.1...1.0
[1.2]: https://gitlab.com/apinsard/chuse/compare/1.1...1.2
[1.1]: https://gitlab.com/apinsard/chuse/compare/1.0.2...1.1
[1.0.2]: https://gitlab.com/apinsard/chuse/compare/1.0.1...1.0.2
[1.0.1]: https://gitlab.com/apinsard/chuse/compare/1.0...1.0.1
[1.0]: https://gitlab.com/apinsard/chuse/compare/0.1...1.0
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ a clean structure. On the other hand, you rarely have more than 10 lines in your
Installation
------------

Chuse is available from the [sapher overlay][1]. It is also available in the main Funtoo tree.
Chuse is available from [flora overlay][1]. It is also available in the main Funtoo tree.

Once you have added this overlay, just emerge `chuse`.

@@ -65,8 +65,9 @@ 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.
or if one of the given useflags doesn't seem to exist, 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)
@@ -123,7 +124,16 @@ the --force (shortly -f) option to disable this behavior:

$ sudo chuse unexisting/package +foo -bar
Error: This atom does not match any existing ebuild. Use --force option
to proceed anyway
to proceed anyway.
$ sudo chuse -f unexisting/package +foo -bar

[1]: https://github.com/apinsard/sapher-overlay
As of version 1.2, useflags existence is also checked:

$ sudo chuse dev-db/postgresql python -fanfan_la_tulipe dartagnan
Error: No ebuild matched by the given atom accepts such use flags:
dartagnan, fanfan_la_tulipe. Make sure you did not make a typo, or use
--force option to proceed anyway.
$ sudo chuse -f dev-db/postgresql python -fanfan_la_tulipe dartagnan


[1]: https://github.com/funtoo/flora
23 changes: 17 additions & 6 deletions chuse
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ __author__ = "Antoine Pinsard"
__copyright__ = "Copyright (C) 2017 Antoine Pinsard"
__credits__ = ["Antoine Pinsard"]
__license__ = "GPL-2"
__version__ = "1.1"
__version__ = "1.2"
__maintainer__ = "Antoine Pinsard"
__email__ = "antoine.pinsard@gmail.com"
__status__ = "Production"
@@ -72,8 +72,9 @@ def usage():
uinfo = (
"chuse [-f|--force] <atom> [[modifier]<flag> ...] [--because <reason>]\n"
" Alter use flags. By default, if the given atom doesn't match any existing ebuild,\n"
" an error will be raised. Use -f/--force option to disable this behavior. If no flag\n"
" is specified, the current rules matching the underlying atom will be displayed.\n"
" or if one of the given useflags doesn't seem to exist, an error will be raised.\n"
" Use -f/--force option to disable this behavior. If no flag is specified, the\n"
" current rules matching the underlying atom will be displayed.\n"
"chuse <atom>\n"
" Print current flags set and history.\n"
"chuse (-h|--help)\n"
@@ -98,7 +99,7 @@ def usage():


def version_info():
webpage = "https://github.com/apinsard/chuse"
webpage = "https://gitlab.com/apinsard/chuse"
vinfo = ("Chuse version %(version)s, %(copyright)s\n"
"Chuse comes with ABSOLUTELY NO WARRANTY\n"
"This is free software, and you are welcome to redistribute it\n"
@@ -203,7 +204,7 @@ def read_current_flags(atom):
break # Another matching line would be foolish
except FileNotFoundError:
pass # Then there is no flag for now
except NotADirectory:
except NotADirectoryError:
raise PackageUseError()

return useflags
@@ -244,7 +245,7 @@ def write_changes(atom, flags, comment):
os.makedirs(os.path.dirname(filename))
except FileExistsError:
pass # Then we don't need to create it
except NotADirectory:
except NotADirectoryError:
raise PackageUseError()

if not found_existing_atom:
@@ -443,6 +444,16 @@ def main():
if reason:
comment += '\n' + reason

if not force:
unexisting_flags = set(new_flags.keys()).difference(
atom.list_possible_useflags())
if unexisting_flags:
error((
"No ebuild matched by the given atom accepts such use "
"flags: {}. Make sure you did not make a typo, or use "
"--force option to proceed anyway."
).format(', '.join(unexisting_flags)))

try:
write_changes(atom, new_flags, comment)
except PackageUseError as e:
17 changes: 13 additions & 4 deletions chuse.pod
Original file line number Diff line number Diff line change
@@ -48,7 +48,8 @@ this and if you can reset default in the future for instance).

=item B<-f --force>

Force writting changes even if no ebuild seems to satisfy the given atom.
Force writting changes even if no ebuild seems to satisfy the given atom or
none of the matched ebuilds seems to accept one of the given useflags.

=item B<--dump>

@@ -130,20 +131,28 @@ the --force (shortly -f) option to disable this behavior:

$ sudo chuse unexisting/package +foo -bar
Error: This atom does not match any existing ebuild. Use --force option
to proceed anyway
to proceed anyway.
$ sudo chuse -f unexisting/package +foo -bar

As of version 1.2, useflags existence is also checked:

$ sudo chuse dev-db/postgresql python -fanfan_la_tulipe dartagnan
Error: No ebuild matched by the given atom accepts such use flags:
dartagnan, fanfan_la_tulipe. Make sure you did not make a typo, or use
--force option to proceed anyway.
$ sudo chuse -f dev-db/postgresql python -fanfan_la_tulipe dartagnan

=head1 BUGS

Please report bugs on github L<https://github.com/apinsard/chuse/issues>
Please report bugs on gitlab L<https://gitlab.com/apinsard/chuse/issues>

=head1 AUTHOR

Antoine Pinsard <antoine.pinsard@gmail.com>

=head1 VERSION

1.1
1.2

=head1 SEE ALSO