Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 267565 - app-portage/gentoolkit-dev: rewrite ekeyword in python
Summary: app-portage/gentoolkit-dev: rewrite ekeyword in python
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2009-04-26 16:01 UTC by michael@smith-li.com
Modified: 2014-01-20 05:40 UTC (History)
0 users

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


Attachments
ekeyword2 (ekeyword2,2.14 KB, text/plain)
2009-04-26 16:02 UTC, michael@smith-li.com
Details
ekeywords2_getknown.patch (ekeywords2_getknown.patch,694 bytes, patch)
2009-05-04 17:29 UTC, michael@smith-li.com
Details | Diff
ekeyword2_updates.patch (ekeyword2_updates.patch,2.77 KB, patch)
2009-05-05 00:59 UTC, michael@smith-li.com
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description michael@smith-li.com 2009-04-26 16:01:44 UTC
Here is ekeyword rewritten in python.

Reproducible: Always
Comment 1 michael@smith-li.com 2009-04-26 16:02:05 UTC
Created attachment 189526 [details]
ekeyword2
Comment 2 SpanKY gentoo-dev 2009-04-26 16:23:16 UTC
hard coding of KEYWORDS is not ok ... one of the advantages of ekeyword in perl is that there is no hardcoding

while you could pull arch.list from profiles/, it would prevent using ekeyword on packages with arches that havent been merged into the official tree (like the eprefix stuff)

what might be a useful addition is having ekeyword warn about unknown entries (for cases where people typo something like "amd46") and the keyword doesnt already exist in the ebuild ...
Comment 3 michael@smith-li.com 2009-04-26 17:27:29 UTC
(In reply to comment #2)
> hard coding of KEYWORDS is not ok ... one of the advantages of ekeyword in perl
> is that there is no hardcoding
> 
> while you could pull arch.list from profiles/, it would prevent using ekeyword
> on packages with arches that havent been merged into the official tree (like
> the eprefix stuff)

This pythonized ekeyword doesn't prevent anything. It merely puts out a warning if a keyword isn't recognized, and proceeds anyway. I had in mind to pull the STABLE_KEYWORDS from profiles, but I realized some keywords (particularly for alt projects) wouldn't be there, so the warnings would get annoying.

Another alternative would be an ~/.ekeyword file where known keywords could be configured by individual devs.

Regardless of the method, ekeyword(.py) will not prevent the dev from doing anything, but I think the warnings are helpful.

Do you still disagree, despite the fact that ekeyword doesn't actually refuse anything?
Comment 4 michael@smith-li.com 2009-05-04 17:29:12 UTC
Created attachment 190332 [details, diff]
ekeywords2_getknown.patch

idl0r gave me this improved getting of known keywords. Should work well if the dev has set his PORTDIR_OVERLAY correctly.
Comment 5 michael@smith-li.com 2009-05-05 00:59:43 UTC
Created attachment 190376 [details, diff]
ekeyword2_updates.patch

< FuzzyRay> I just noticed, ekeyword2 doesn't support the remove keywords
            (i.e ^x86) or the all shortcut


With this update it does, although the 'all' parameter itself is optional. It also supports the -* keyword, handles tildes expanded by the shell. Also, removes happen first, so you can remove all keywords before adding some back.

So for example:

# Remove all keywords
$ ekeyword2 ^ foo.ebuild
# or...
$ ekeyword2 ^all foo.ebuild

# Drop mips support
$ ekeyword2 ^mips foo.ebuild

# Remove all keywords except ppc
$ ekeyword2 ^ ppc foo.ebuild

# Set all keywords to testing
$ ekeyword2 ~ foo.ebuild
# or...
$ ekeyword2 ~all foo.ebuild

# Set all keywords to broken
$ ekeyword2 - foo.ebuild
# or...
$ ekeyword2 -all foo.ebuild
Comment 6 Paul Varner (RETIRED) gentoo-dev 2009-05-05 01:45:43 UTC
$ svn commit -m "Add patch from kojiro to support keyword removal and all"
Sending        ekeyword2/ekeyword2
Transmitting file data .
Committed revision 580.
Comment 7 SpanKY gentoo-dev 2014-01-20 05:40:32 UTC
i wrote a new ekeyword from scratch in python.  i didn't realize there was an existing ekeyword2, so i got annoyed when i saw one existed, but then didn't feel bad when i read the code ;).

i've deleted both the old perl ekeyword and python ekeyword2.  there is now just one ekeyword in the tree and it's written cleanly in python.

http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commitdiff;h=840bf7e8df3c86e161f7855a37b008b5cf16f2d8

if you find issues in it, please file new bugs