Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 784566 - sys-apps/portage: make emerge insensitive to relative order of optional and positional arguments
Summary: sys-apps/portage: make emerge insensitive to relative order of optional and p...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All All
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 785484
  Show dependency tree
 
Reported: 2021-04-20 21:27 UTC by Zac Medico
Modified: 2021-07-05 01:39 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2021-04-20 21:27:29 UTC
The argument preprocessor can be used to make it insensitive to the relative order of optional and positional arguments, avoiding the need for changes like this:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6cfec967ac5ad3894f6ce0e6c7289406bd10d480
Comment 1 Zac Medico gentoo-dev 2021-04-20 21:32:52 UTC
<[Arfrever]> zmedico: I noticed that 'emerge ${package1} ${option} ${package2}' triggers error.
Comment 2 Zac Medico gentoo-dev 2021-04-21 00:24:11 UTC
Maybe we can use parse_intermixed_args for python3.7 and later:


https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.parse_intermixed_args
Comment 3 Michael 'veremitz' Everitt 2021-04-21 03:17:33 UTC
Also:

[Tue 10:41 pm]<[Arfrever]> kveremitz: As long as you use all atoms at the beginning and all options at the end, it works :) .
[Tue 10:42 pm]<zmedico> we've gotta fix that
[Tue 10:42 pm]<kveremitz> ^
[Tue 10:42 pm]<kveremitz> its backwards!
Comment 5 Larry the Git Cow gentoo-dev 2021-04-23 21:43:01 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=971546efe69394743584107c0657b62fb65ee163

commit 971546efe69394743584107c0657b62fb65ee163
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-04-21 04:28:12 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-04-21 04:29:21 +0000

    emerge: use parse_intermixed_args when available (bug 784566)
    
    The included unit test case previously failed with this error:
    
      emerge: error: unrecognized arguments: dev-libs/A
    
    Bug: https://bugs.gentoo.org/784566
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/main.py                     |  2 +-
 lib/portage/tests/emerge/test_simple.py | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
Comment 6 Larry the Git Cow gentoo-dev 2021-05-24 09:05:12 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cba21902d9a8d1ac07d2ff5b0d932e71fc1fac67

commit cba21902d9a8d1ac07d2ff5b0d932e71fc1fac67
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-05-24 07:47:11 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-05-24 09:05:08 +0000

    sys-apps/portage: Bump to version 3.0.19
    
     #520378: allow emerge --fetchonly to log to emerge-fetch.log
     #698244: portage(5) document user patch / eapply_user
     #781854: Suggest PORTAGE_LOG_FILTER_FILE_CMD cat fallback
     #782724: sort emerge --unmerge order for determinism
     #783957: lazily evaluate cnf_* variables in tests
     #784566: make emerge insensitive to relative order of optional
                      and positional arguments
     #787545: emerge CTRL C may be ignored when running pkg_pretend
     #787563: ebuild-ipc could handle KeyboardInterrupt
     #788967: emerge --jobs= triggers TypeError
    
    Bug: https://bugs.gentoo.org/785484
    Bug: https://bugs.gentoo.org/788967
    Bug: https://bugs.gentoo.org/787563
    Bug: https://bugs.gentoo.org/787545
    Bug: https://bugs.gentoo.org/784566
    Bug: https://bugs.gentoo.org/783957
    Bug: https://bugs.gentoo.org/782724
    Bug: https://bugs.gentoo.org/781854
    Bug: https://bugs.gentoo.org/698244
    Bug: https://bugs.gentoo.org/520378
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.19.ebuild | 266 +++++++++++++++++++++++++++++++++
 2 files changed, 267 insertions(+)