Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 71957 - ZSH-completion update using cache
Summary: ZSH-completion update using cache
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Mamoru KOMACHI (RETIRED)
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2004-11-21 09:23 UTC by Bapt
Modified: 2005-02-22 07:55 UTC (History)
1 user (show)

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


Attachments
Patch for the update (zsh-completion.patch,13.90 KB, patch)
2004-11-21 09:25 UTC, Bapt
Details | Diff
_gentoo_packages (_gentoo_packages,4.11 KB, text/plain)
2004-12-10 05:06 UTC, oberyno
Details
_portage patch (_portage-04-12-10.patch,5.29 KB, patch)
2004-12-10 05:08 UTC, oberyno
Details | Diff
global patch (zsh-completion-20041227.patch,31.36 KB, patch)
2004-12-27 03:01 UTC, Bapt
Details | Diff
equery patch (zsh-completion-20050107.patch,8.81 KB, patch)
2005-01-07 02:53 UTC, oberyno
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bapt 2004-11-21 09:23:53 UTC
_gentoo_packages:
        initial creation function to store installed packages and 
        available packages in the cache.
        to use it :_gentoo_packages installed|available
_portage:
        remove _portage_pkglist has we now uses _gentoo_packages installed
        clean _portage_unmerge => _gentoo_packages installed
        clean _portage_pkglist => _gentoo_packages available
_gcc-config:
        make it work correctly

_gentoolkit:
        modify to use _gentoo_packages
_genlop: 
        modify to use _gentoo_packages

TODO:
        view if other function can be removed/cleaned in _portage,  _gentoolkit,
        _genlop
        Do some cleanup in vars in _gentoolkit
        add _ebuild_cache in _gentoo_packages
Comment 1 Bapt 2004-11-21 09:25:24 UTC
Created attachment 44419 [details, diff]
Patch for the update
Comment 2 Mamoru KOMACHI (RETIRED) gentoo-dev 2004-11-23 03:41:09 UTC
I don't think Gentoo completion cache is 
worth to enable(it's not enabled by default 
anyway), but I'll look into it for those who
may want to use it.
Comment 3 Bapt 2004-11-23 06:37:53 UTC
Any way, using the completion or not, I think it's a good idea to use _gentoo_packages or _gentoo_functions for common function to prevent copying them each time a new function is created, because, if the function is updated, we only have to do it ones and not for "each copy".
Comment 4 Mamoru KOMACHI (RETIRED) gentoo-dev 2004-11-23 07:43:41 UTC
Yes, I think it good thing to separate the function
from each files. However, I would also want to 
add oberyno's patch in bug #71532
(it contains many bug fixes). Could you update
your patch to work with his patch? 
Comment 5 oberyno 2004-11-24 03:52:23 UTC
I agree with baptux that having packages completed separately is a good thing.
With _gentoo_packages, a user can use premade completion functions for custom commands, with something like this in their .zshrc:
compdef '_gentoo_packages available' ecd
I'm not sure, but I don't think _portage_pkglist was accessible in such a way before when everything was grouped together.

Also, is "_tags packages && " actually doing anything? As far as I know, we're trying to assign a tag to a list, and it doesn't seem to be working.
For example, putting this in a .zshrc should make all packages blue:
zstyle ':completion:*:emerge:*:packages' list-colors '=*=32'
It works for me with _wanted:
_wanted packages expl 'packages' compadd...

I think we should try to keep completion without cache as fast as possible also. In my first bug, I added cache to =pkg-ver, which was much faster than no cache. My last patch removed the cache in favor of matching $PREFIX which was slightly slower than cache. I think a solution that has cache for those who want it and $PREFIX matching for everyone else would work nicely. Also, is cache needed for installed packages?
Comment 6 Bapt 2004-12-01 09:49:18 UTC
Sorry I'm leaving for a while in africa, and won't have internet access so I can't integrate with  a send it before I come back. 

A good idea is to point each part that can be done by a "super function" like I've done for _portage_packages and write, like that, it would be easier to write new functions bug #71532.

For the cache your are probably right, no real speed improvements ;)
Comment 7 oberyno 2004-12-10 05:06:38 UTC
Created attachment 45679 [details]
_gentoo_packages

Here's a version that's pretty much straight from my last patch.
I couldn't figure out a decent way to source make.conf outside of the _gentoo
functions, so make.conf is sourced within each function.
Also, all cat/pkg completions have the tag "cat_packages".
Oh, and there's no cache.
Comment 8 oberyno 2004-12-10 05:08:37 UTC
Created attachment 45680 [details, diff]
_portage patch
Comment 9 Bapt 2004-12-27 03:01:54 UTC
Created attachment 46949 [details, diff]
global patch

I'm back, and made some small works.

Here is a global patch (against zsh-completion-20040730) integrated all the
great work made by oberyno, and added some small changes :

_gentoo_packages:
	Added category to list each available category

_gentoolkit:
	Updated to completly use _gentoo_packages and use the new
	installed_versions

I think this time it could be integrated in portage, works great for me ;)


Merry Christmas ;)
Comment 10 oberyno 2005-01-07 02:53:50 UTC
Created attachment 47825 [details, diff]
equery patch

Ok, one final patch atop baptux's global patch.
_gentoo_packages:
 useflag completion
_gentoolkit:
 redid equery to work in a state based manner
added all the recent options (hasuse, depends, --filter for files, ...)
--options can be completed after the main argument, i.e., equery size zsh
-<tab> works
list asks for a pattern as per its description
--help is not treated specially; i.e. equery --help files <tab> brings up
belongs args. I'm not quite sure what to do about that.
Comment 11 Mamoru KOMACHI (RETIRED) gentoo-dev 2005-01-18 05:14:12 UTC
Sorry for the delay. I submitted my thesis yesterday,
so hopefully I have time to check and include this by
the end of his week :)
Comment 12 oberyno 2005-01-20 03:29:21 UTC
No problem. Still a couple bugs though.
The description for --fetch-all-uri is wrong. Oops.
"Fetch all possible files for all packages" would be better.

Also, xorg-x11 should be added to opengl-update.
Comment 13 Bapt 2005-01-20 07:35:09 UTC
Ok for me it's your turn to work Mamoru all seems ok for everybody...

Good luck for your thesis ;)
Comment 14 Mamoru KOMACHI (RETIRED) gentoo-dev 2005-02-22 07:55:52 UTC
Thanks for your great work. I like the _gentoo_portage thing.
Tested on several of my servers for several weeks already :)
Commited to CVS.