--- _portage 2004-12-10 04:21:45.815420384 -0800 +++ ../.zfpath/_portage 2004-12-10 04:26:57.800991368 -0800 @@ -114,19 +114,18 @@ _quickpkg () { if compset -P '(\\|)(>=|<=|<|>|=)'; then _arguments -s \ - '*:installed package:_portage_unmerge_vers' + '*:installed package:_gentoo_packages installed_versions' elif compset -P '(\\|)[/]'; then _path_files -W / -/ else _arguments \ - '*:installed package:_portage_unmerge' + '*:installed package:_gentoo_packages installed' fi } # Stuff for emerge _emerge () { - local state local nopkg_opts all noask_opts bopts install_args common_args profiles noask_opts=(-p -a --pretend --ask --regen --info --search -s --searchdesc \ @@ -194,34 +193,16 @@ 'system[All packages in the system profile]' ) - #Reading informations from make.conf - - local trees portage_pkglist category var - - for var in PORTDIR PORTDIR_OVERLAY PKGDIR ; do - local env_var=\$${var} - - [[ -z ${(e)env_var} && -r /etc/make.conf ]] && local $var="`. /etc/make.conf 2>/dev/null; - echo ${(e)env_var}`" - [[ -z ${(e)env_var} && -r /etc/make.globals ]] && local $var="`. /etc/make.globals 2>/dev/null; - echo ${(e)env_var}`" - done - - trees=( $PORTDIR $=PORTDIR_OVERLAY ) - portage_pkglist=( $trees/*-*/*(:t) ) - category=( $trees/*-*(/:t) ) - typeset -U category - # Dispatch if (( $words[(I)(--(unmerge|clean|prune)|-[[:alpha:]]#(C|c|P)[[:alpha:]]#)] )) ; then if compset -P '(\\|)(>=|<=|<|>|=)'; then _arguments -s \ - '*:installed package:_portage_unmerge_vers' && return 0 + '*:installed package:_gentoo_packages installed_versions' && return 0 else _arguments -s \ "$common_args[@]" "$install_args[@]" \ - "*:installed package:_portage_unmerge" && return 0 + "*:installed package:_gentoo_packages installed" && return 0 fi elif (( $words[(I)(world|system)] )) ; then @@ -232,7 +213,7 @@ elif (( $words[(I)(--usepkgonly|-[[:alnum:]]#K[[:alnum:]]#)] )) ; then _arguments -s \ "$common_args[@]" "$install_args[@]" \ - '*:binary package:_portage_tbz2list' && return 0 + '*:binary package:_gentoo_packages binary' && return 0 elif [[ $words[-3] == (--help|-h) ]] ; then _message "No more arguments" && return 0 @@ -240,82 +221,21 @@ else if compset -P '(\\|)(>=|<=|<|>|=)'; then _arguments \ - "*:portage:_portage_pkglist_vers" && return 0 + "*:portage:_gentoo_packages available_versions" && return 0 elif (( $words[(I)(--inject|-i)] )) ; then _arguments -s \ "$common_args[@]" "$install_args[@]" \ - "*:portage:_portage_pkglist_vers" && return 0 + "*:portage:_gentoo_packages available_versions" && return 0 else _arguments -s \ "$common_args[@]" "$install_args[@]" \ "($nopkg_opts)::portage: _values 'profile' \$profiles[@] " \ - "($nopkg_opts)*:portage:_portage_pkglist" && return 0 + "($nopkg_opts)*:portage:_gentoo_packages available" && return 0 fi fi } -#Function to show only installed packages -- pkgname (no category or version #) -_portage_unmerge(){ - local installed_pkgname installed_list installed_portage - installed_portage=(/var/db/pkg/*-*/*) - - installed_pkgname=( ${${installed_portage:t}%%-[0-9]*} ) - _tags installed_pkgname && compadd "$@" ${installed_pkgname} - - installed_list=( ${${installed_portage#*/pkg/}%%-[0-9]*} ) - _wanted packages expl 'category/package' _multi_parts "$@" / installed_list -} - -#Function to show only installed packages -- cat/name-ver -_portage_unmerge_vers(){ - local installed_list installed_portage - installed_portage=(/var/db/pkg/*-*/*) - _tags installed_pkgname && compadd "$@" ${installed_portage:t} - - # most other cat/pkg don't work with _files, so I changed this one too. - installed_list=( ${installed_portage##*/pkg/} ) - _wanted packages expl 'category/package' _multi_parts "$@" / installed_list -} - -#Function to show tbz2 files available -_portage_tbz2list() { - # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official - # binary mirror will be available we should rewrite it accordingly. - _path_files -g \*.tbz2 -W "${PKGDIR}/All" -} - -#Function to show all available portage names -_portage_pkglist(){ - local pkg - _tags portage_pkglist && compadd "$@" $portage_pkglist - - # Complete cat/pkg. _multi_parts is much to slow for such a large task, - # _sep_parts removes the dash from gnome-, and _path_files wants to - # complete cat/pkg/files (if "files" is ignored with -F, miscfiles, etc... - # don't get completed). - if [[ $PREFIX != */* ]] ; then - _wanted packages expl 'category/package' compadd -S '/' $category - else - compset -P '*/' - pkg=( $trees/$IPREFIX/*(:t) ) - _wanted packages expl 'category/package' compadd $pkg - fi -} - -#Function to show all package versions -_portage_pkglist_vers(){ - local portage_ebuilds overlay_ebuilds pkg - - if [[ $#PREFIX -ge 1 && -z $words[(r)(--inject|-i)] ]] ; then - overlay_ebuilds=(${=PORTDIR_OVERLAY}/*-*/${PREFIX%%-[0-9]#*}*/*.ebuild(:t:r) ) - portage_ebuilds=($PORTDIR/metadata/cache/*-*/${PREFIX%%-[0-9]#*}*(:t)) - _tags portage_pkglist && compadd "$@" $portage_ebuilds $overlay_ebuilds - fi - - pkg=( $trees/${PREFIX%%/*}/*/*.ebuild(:t:r) ) - _wanted packages expl 'category/package' _sep_parts category / pkg -} local gentoo_runlevels