Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 762331 - app-portage/gentoolkit: ekeyword has no way to distinguish ebuild arguments aside from the .ebuild file suffix
Summary: app-portage/gentoolkit: ekeyword has no way to distinguish ebuild arguments a...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal enhancement (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-12-29 01:51 UTC by Zac Medico
Modified: 2022-07-10 23:05 UTC (History)
0 users

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 2020-12-29 01:51:02 UTC
We'd like to use ekeyword in a git merge driver implementation (see https://archives.gentoo.org/gentoo-portage-dev/message/ddf7e0285b28ac044e5da7e5ce4fec47), but the files that the driver will pass to ekeyword do not necessarily have a .ebuild suffix. Therefore, it would be handy to be able to distinguish ebuild arguments some other way. Perhaps os.path.isfile(arg) would be sufficient.
Comment 2 Brian Dolbec (RETIRED) gentoo-dev 2020-12-31 05:45:59 UTC
Looks good to me.  Go ahead from me.
Comment 3 Zac Medico gentoo-dev 2020-12-31 07:26:03 UTC
FWIW, our git merge driver could potentially bypass the argument parsing logic like this:

try:
   ekeyword.process_ebuild(pathname, list(map(ekeyword.arg_to_op, args))
except Exception:
   result = 1
   traceback.print_exc()
else:
   result = 0
Comment 4 Larry the Git Cow gentoo-dev 2022-07-09 19:50:42 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=04e8fd5252c9bc1efad66fdb8cb40d376550d580

commit 04e8fd5252c9bc1efad66fdb8cb40d376550d580
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-12-29 02:00:42 +0000
Commit:     Brian Dolbec <dolsen@gentoo.org>
CommitDate: 2022-07-09 19:46:35 +0000

    ekeyword: remove .ebuild file suffix requirement (bug 762331)
    
    We'd like to use ekeyword in a git merge driver implementation, but the
    files that the driver will pass to ekeyword do not necessarily have a
    .ebuild suffix. Therefore, it would be handy to be able to distinguish
    ebuild arguments some other way. If the ignorable_arg(arg) function
    returns False and os.path.isfile(arg) returns True, then simply assume
    that the argument is an ebuild.
    
    Bug: https://bugs.gentoo.org/762331
    Signed-off-by: Zac Medico <zmedico@gentoo.org>
    Closes: https://github.com/gentoo/gentoolkit/pull/13
    Signed-off-by: Brian Dolbec <dolsen@gentoo.org>

 pym/gentoolkit/ekeyword/ekeyword.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)