diff -Nau site-functions-old/_gcc-config site-functions/_gcc-config --- site-functions-old/_gcc-config 2004-08-17 23:26:02.000000000 +0200 +++ site-functions/_gcc-config 2004-11-17 22:23:14.710433000 +0100 @@ -19,8 +19,8 @@ _gcc_profile(){ local profile - profile=$(_call_program tag gcc-config --list-profiles) - profile=${profile/\[([^]]*)\]/} + profile=(${(f)"$(_call_program gcc-installed gcc-config --list-profiles)"}) + profile=${${profile/\[([^]]*)\]/}/\*} _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} } } diff -Nau site-functions-old/_genlop site-functions/_genlop --- site-functions-old/_genlop 2004-10-09 17:39:15.000000000 +0200 +++ site-functions/_genlop 2004-11-17 22:38:58.072020000 +0100 @@ -61,7 +61,7 @@ "($single --time -t)"{--time,-t}"[display merge time]" \ "($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \ "($single $arg *)"{--version,-v}"[display version information]" \ - "($single)*:package:_portage_pkglist" + "($single)*:package:_gentoo_packages available" ;; esac @@ -79,13 +79,6 @@ done } -#Function to show all available portage names -_portage_pkglist(){ - portage_pkglist="$portage_pkglist" - _tags -s portage_pkglist && { compadd "$@" ${(kv)=portage_pkglist} } - _path_files -/ -F "*CVSROOT" -F "*eclass" -F "*distfiles" -F "*licences" -F "*files" -W "${portdir}" -} - _days() { local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday" local day=$(date +%u) @@ -115,31 +108,3 @@ elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d fi } - -#Reading informations from make.conf -# -# Using portageq is the right way to get PORTDIR, but it is very slow :-( -# -#portdir="$(portageq portdir)" -#pkgdir="$(portageq pkgdir)" -#portdir_overlay="$(portageq portdir_overlay)" -[[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}" -[[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}" -if [[ -n "${PORTDIR_OVERLAY}" ]] ; then - for overlay in ${=PORTDIR_OVERLAY} ; do - portdir_overlay=(${overlay} ${portdir_overlay}) - done -fi -[[ -r /etc/make.globals ]] && source /etc/make.globals -[[ -r /etc/make.conf ]] && source /etc/make.conf - -[[ -z "${portdir}" ]] && portdir="${PORTDIR}" -[[ -z "${pkgdir}" ]] && pkgdir="${PKGDIR}" -if [[ -z "${portdir_overlay}" ]] ; then - for overlay in ${=PORTDIR_OVERLAY} ; do - portdir_overlay=(${overlay} ${portdir_overlay}) - done -fi - -portage_pkglist=(${portdir}/*-*/* ${=portdir_overlay}/*-*/*) -portage_pkglist=(${portage_pkglist##*/}) diff -Nau site-functions-old/_gentoolkit site-functions/_gentoolkit --- site-functions-old/_gentoolkit 2004-10-09 17:39:15.000000000 +0200 +++ site-functions/_gentoolkit 2004-11-17 22:33:20.690310000 +0100 @@ -19,12 +19,6 @@ _tags -s category && { compadd "$@" ${(kv)=category} } } -#Function to show only installed packages -- pkgname (no category or version #) -_portage_installed(){ - installed_portage=(/var/db/pkg/*-*/*) - installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}} - _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} } -} #moved out of equery _equery_val(){ _values "equery actions" \ @@ -38,13 +32,6 @@ 'size[print size of files contained in package]' } -#Function to show all available portage names -_portage_pkglist(){ - portage_pkglist="$portage_pkglist" - _tags -s portage_pkglist && { compadd "$@" ${(kv)=portage_pkglist} } - _path_files -/ -F "*CVSROOT" -F "*eclass" -F "*distfiles" -F "*licences" -W "${portdir}" -} - #Reading informations from Portage # # Using portageq is the right way to get PORTDIR, but it is very slow :-( @@ -70,8 +57,8 @@ done fi -portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*) -portage_pkglist=(${portage_pkglist##*/}) +#portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*) +#portage_pkglist=(${portage_pkglist##*/}) case $service in @@ -101,18 +88,18 @@ "($excl --uninstalled -U --installed -I $dups -d)"{--installed,-I}"[include only installed packages]" \ "($excl --group -g $dups -d)"{--group,-g}"[find by group]:group:_category" \ "($check $excl --list -l $dups -d)"{--list,-l}"[list package contents]" \ - "($excl --info -i $dups -d 1)"{--info,-i}"[get package description and home page]:package:_portage_pkglist" \ + "($excl --info -i $dups -d 1)"{--info,-i}"[get package description and home page]:package:_gentoo_packages available" \ "($excl $check $find $dups --uninstalled -U)"{--check-time,-ct}"[verify package file timestamps]" \ "($excl $check $find $dups --uninstalled -U)"{--check-md5,-cm}"[verify package files md5]" \ "($excl $check $find $dups --uninstalled -U)"{--check,-c}"[verify mtimes and md5]" \ - "($excl $find --query-deps -q $dups -d 1)"{--query-deps,-q}"[display all installed packages depending on selected packages]:package:_portage_pkglist" \ + "($excl $find --query-deps -q $dups -d 1)"{--query-deps,-q}"[display all installed packages depending on selected packages]:package:_gentoo_packages available" \ "()"{--no-color,-nc}"[dont use colors]" \ "*--verbose[be more verbose (2 levels)]" \ "*-v[be more verbose (2 levels)]" \ "($excl --non-masked -n --masked -m $dups)"{--masked,-m}"[include only masked packages]" \ "($excl --non-masked -n --masked -m $dups)"{--non-masked,-n}"[include only non-masked packages]" \ "(- :)"{--help,-h}"[show help]" \ - "(--info -i --query-deps -q --slot -s)1:package:_portage_installed" + "(--info -i --query-deps -q --slot -s)1:package:_gentoo_packages installed" ;; equery) @@ -130,7 +117,7 @@ '--timestamp[append timestamp]' \ '--md5sum[append md5sum]' \ '--type[prepend file type]' \ - '*:installed pkgname:_portage_installed' && return 0 + '*:installed pkgname:_gentoo_packages installed' && return 0 ;; belongs|--earlyout) _arguments -s \ @@ -148,29 +135,29 @@ '(-I --exclude-installed -i --installed)'{-I,--exclude-installed}'[do not search installed packages]' \ '(-p --portage)'{-p,--portage-tree}'[also search in portage tree]' \ '(-o --overlay-tree)'{-o,--overlay-tree}'[also search in overlay tree]' \ - '*:package:_portage_installed' && return 0 + '*:package:_gentoo_packages installed' && return 0 ;; uses|which) _arguments \ - '*:package:_portage_pkglist' \ + '*:package:_gentoo_packages available' \ && return 0 ;; depgraph|-U|--no-useflags|-l|--linear) _arguments -s \ '(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \ '(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \ - '*:package:_portage_installed' \ + '*:package:_gentoo_packages installed' \ && return 0 ;; size|-b|--bytes) _arguments -s \ '(-b --bytes)'{-b,--bytes}'[report size in bytes]' \ - '*:package:_portage_installed' \ + '*:package:_gentoo_packages installed' \ && return 0 ;; check) _arguments -s \ - '*:package:_portage_installed' \ + '*:package:_gentoo_packages installed' \ && return 0 ;; --nocolor|-C|--quiet|-q) diff -Nau site-functions-old/_gentoo_packages site-functions/_gentoo_packages --- site-functions-old/_gentoo_packages 1970-01-01 01:00:00.000000000 +0100 +++ site-functions/_gentoo_packages 2004-11-17 21:57:17.000000000 +0100 @@ -0,0 +1,92 @@ +#autoload + +#Author: baptux +#Description: +# functions for gentoo packages +# inspired by _deb_packages +#Usage: _gentoo_packages installed|available +local gentoo_pkglist installed_pkg +_gentoo_installed_list(){ + local installed_portage installed_dir installed_pkgname + installed_portage=(/var/db/pkg/*-*/*) + installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}} + installed_dir=/var/db/pkg/ + installed_pkg=${installed_portage//$installed_dir/} + installed_pkg="${installed_pkgname} ${installed_pkg}" +} +_gentoo_pkglist(){ + local portage_pkglist portdir pkgdir portdir_overlay overlay + #Reading informations from make.conf + [[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}" + [[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}" + if [[ -n "${PORTDIR_OVERLAY}" ]] ; then + for overlay in ${=PORTDIR_OVERLAY} ; do + portdir_overlay=(${overlay} ${portdir_overlay}) + done + fi + [[ -r /etc/make.globals ]] && source /etc/make.globals + [[ -r /etc/make.conf ]] && source /etc/make.conf + [[ -z "${portdir}" ]] && portdir="${PORTDIR}" + [[ -z "${pkgdir}" ]] && pkgdir="${PKGDIR}" + if [[ -z "${portdir_overlay}" ]] ; then + for overlay in ${=PORTDIR_OVERLAY} ; do + portdir_overlay=(${overlay} ${portdir_overlay}) + done + fi + portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*) + portage_pkglist=(${portage_pkglist##*/}) + gentoo_classlist="world system" + gentoo_pkglist=(${(kv)=portage_pkglist} ${(kv)=gentoo_classlist}) +} +_gentoo_packages_update_installed(){ + if ( [[ ${+_gentoo_packages_cache_installed} -eq 0 ]] || + _cache_invalid GENTOO_installed ) && ! _retrieve_cache GENTOO_installed; + then + _gentoo_installed_list + _gentoo_packages_cache_installed=( + ${(kv)=installed_pkg} + ) + _store_cache GENTOO_installed _gentoo_packages_cache_installed + fi + cachevar=_gentoo_packages_cache_installed +} + +_gentoo_packages_update_available(){ + if ( [[ ${+_gentoo_packages_cache_available} -eq 0 ]] || + _cache_invalid GENTOO_available ) && ! _retrieve_cache GENTOO_available; + then + _gentoo_pkglist + _gentoo_packages_cache_available=( + ${gentoo_pkglist} + ) + _store_cache GENTOO_available _gentoo_packages_cache_available + fi + cachevar=_gentoo_packages_cache_available +} + +_gentoo_packages () { + local command="$argv[$#]" expl cachevar pkgset update_policy + zstyle -s ":completion:*:*:$service:*" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:*:*:$service:*" cache-policy _gentoo_cache_policy + fi + [[ "$command" = (installed|available) ]] || { + _message "unknown command: $command" + return + } + [[ "$pkgset" = (installed|available) ]] || { + pkgset="$command" + } + expl=("${(@)argv[1,-2]}") + _gentoo_packages_update_$pkgset + _tags packages && compadd "$expl[@]" - "${(@P)cachevar}" +} + +_gentoo_cache_policy () { + # rebuild if cache is more than a week old + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 +} + + +_gentoo_packages "$@" diff -Nau site-functions-old/_portage site-functions/_portage --- site-functions-old/_portage 2004-08-18 00:05:44.000000000 +0200 +++ site-functions/_portage 2004-11-17 22:02:36.000000000 +0100 @@ -6,15 +6,6 @@ # Author: baptux # Author: Mamoru KOMACHI -# Already done: -# -# emerge (fully done) -# rc-update (fully done) -# rc-status (fully done) -# ebuild (fully done) -# opengl-update (fully done) -# rc (fully done) - # Stuff for rc _rc () { if (( CURRENT == 2 ));then @@ -117,7 +108,7 @@ _files -W / -/ && return 0 else _arguments -s \ - '*:installed pkgname:_portage_quickpkg' && return 0 + '*:installed pkgname:_portage_unmerge' && return 0 fi } @@ -145,7 +136,7 @@ ;; clean|-c) _arguments -s \ - '*:installed pkgname:_portage_clean' "$common_args[@]" && return 0 + '*:installed pkgname:_gentoo_packages installed' "$common_args[@]" && return 0 ;; --usepkgonly|-K) _arguments -s \ @@ -204,19 +195,10 @@ #Function to show only installed packages -- pkgname (no category or version #) _portage_unmerge(){ - installed_portage=(/var/db/pkg/*-*/*) - installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}} - _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} } + _gentoo_packages installed _path_files -/ -W "/var/db/pkg/" } -#Function to show only installed packages -- no _path_files -_portage_quickpkg(){ - installed_portage=(/var/db/pkg/*-*/*) - installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}} - _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} } -} - #Function to show only installed packages -- cat/name-ver _portage_unmerge_vers(){ installed_portage=(/var/db/pkg/*-*/*) @@ -225,16 +207,6 @@ _path_files -/ -W "/var/db/pkg/" } -#Functions to show "cat/name", classes and dependencies -_portage_clean() { - installed_portage=(/var/db/pkg/*-*/*) - installed_dir=/var/db/pkg/ - installed_pkg=${installed_portage//$installed_dir/} - installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}} - _tags -s installed_pkg && { compadd "$@" -k installed_pkg || compadd "$@" ${(kv)=installed_pkg} } - _tags -s installed_pkgname && { compadd "$@" -k installed_pkgname || compadd "$@" ${(kv)=installed_pkgname} } -} - #Function to show tbz2 files available _portage_tbz2list() { # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official @@ -244,12 +216,8 @@ #Function to show all available portage names _portage_pkglist(){ - portage_classlist="world system" - portage_pkglist="$portage_pkglist ${portage_classlist}" - _tags -s portage_pkglist && { compadd "$@" -k portage_pkglist || compadd "$@" ${(kv)=portage_pkglist} } + _gentoo_packages available _path_files -/ -W "${portdir}" - # XXX: If I add ${portdir_overlay} category completion won't work properly - #[[ -n "${portdir_overlay}" ]] && _path_files -/ -W "${portdir_overlay}" _path_files -g \*.ebuild } #Function for matching all ebuilds pkg-ver (slow if asking for all packages) @@ -332,7 +300,7 @@ 'world[Represent all packages in the world profiles]' \ 'system[Represent all the system packages]' } -local portage_pkglist gentoo_runlevels portdir pkgdir portdir_overlay overlay +local gentoo_runlevels portdir pkgdir portdir_overlay overlay #Reading informations from make.conf [[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}" [[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}" @@ -351,9 +319,6 @@ portdir_overlay=(${overlay} ${portdir_overlay}) done fi - -portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*) -portage_pkglist=(${portage_pkglist##*/}) gentoo_runlevels=(/etc/runlevels/*) gentoo_runlevels=(${${gentoo_runlevels/\/etc\/runlevels\//}%/})