Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 71532
Collapse All | Expand All

(-)../zsh-completion-20040730/_portage (-220 / +184 lines)
Lines 5-14 Link Here
5
# ZSH completion function for Portage
5
# ZSH completion function for Portage
6
# Author: baptux <bapt@ifrance.com>
6
# Author: baptux <bapt@ifrance.com>
7
# Author: Mamoru KOMACHI <usata@gentoo.org>
7
# Author: Mamoru KOMACHI <usata@gentoo.org>
8
# Author: oberyno <oberyno@gmail.com>
8
9
9
# Already done:
10
# Already done:
10
#
11
#
11
# emerge (fully done) 
12
# emerge (fully done)
12
# rc-update (fully done)
13
# rc-update (fully done)
13
# rc-status (fully done)
14
# rc-status (fully done)
14
# ebuild (fully done)
15
# ebuild (fully done)
Lines 57-63 Link Here
57
		'package[This command is a lot like the merge command, but create a .tbz2 package]' \
58
		'package[This command is a lot like the merge command, but create a .tbz2 package]' \
58
		'rpm[Builds a RedHat RPM package]'
59
		'rpm[Builds a RedHat RPM package]'
59
	fi
60
	fi
60
	
61
61
}
62
}
62
63
63
# Stuff for rc-status
64
# Stuff for rc-status
Lines 77-82 Link Here
77
# Stuff for rc-update
78
# Stuff for rc-update
78
79
79
_rc-update () {
80
_rc-update () {
81
local used_init
82
    used_init=(${=${(M)${(f)"$(rc-update show 2>/dev/null)"}:#*|*[a-z]*}% |*})
80
    if (( CURRENT == 2 ));then
83
    if (( CURRENT == 2 ));then
81
       _values "rc-update actions" \
84
       _values "rc-update actions" \
82
       'add[Add script to a runlevel]' \
85
       'add[Add script to a runlevel]' \
Lines 87-95 Link Here
87
       '-s[Show scripts lanched at a runlevel]'
90
       '-s[Show scripts lanched at a runlevel]'
88
    elif (( CURRENT == 3 ));then
91
    elif (( CURRENT == 3 ));then
89
	case "$words[2]" in
92
	case "$words[2]" in
90
		add|-a|del|-d)
93
		add|-a)
91
		    _arguments -s \
94
		 _values "scripts" /etc/init.d/*~*.sh(:t)
92
		        '*:scripts:_files -W /etc/init.d/'
95
		;;
96
		del|-d)
97
		_values "scripts" $used_init
93
		;;
98
		;;
94
		show|-s)
99
		show|-s)
95
		    _values "runlevels" $gentoo_runlevels
100
		    _values "runlevels" $gentoo_runlevels
Lines 107-361 Link Here
107
# Stuff for quickpkg
112
# Stuff for quickpkg
108
113
109
_quickpkg () {
114
_quickpkg () {
110
	if compset -P '(\\|)[><][=]'; then
115
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
111
	_arguments -s \
116
	_arguments -s \
112
    	    '*:installed pkgname with versions:_portage_unmerge_vers' && return 0
117
    	    '*:installed package:_portage_unmerge_vers'
113
	  elif compset -P '(\\|)[<=>]'; then
114
		_arguments -s \
115
		    '*:installed pkgname with versions:_portage_unmerge_vers' && return 0
116
	  elif compset -P '(\\|)[/]'; then
118
	  elif compset -P '(\\|)[/]'; then
117
		_files -W / -/ && return 0
119
		_path_files -W / -/
118
	  else 
120
	  else
119
		_arguments -s \
121
    		_arguments \
120
		    '*:installed pkgname:_portage_quickpkg' && return 0
122
		    '*:installed package:_portage_unmerge'
121
	  fi
123
	  fi
122
}
124
}
123
 
125
124
# Stuff for emerge
126
# Stuff for emerge
125
127
126
_emerge () {
128
_emerge () {
127
    local state
129
    local state
128
    if (( CURRENT == 2 ));then
130
    local nopkg_opts all noask_opts bopts install_args common_args profiles
129
        _arguments -s \
131
130
            '*:*:->actions' \
132
  noask_opts=(-p -a --pretend --ask --regen --info --search -s --searchdesc \
131
            "$common_args[@]" "$install_args[@]" && return 0
133
  -S --version -V --help -h --metadata)
132
    elif (( CURRENT > 2 ));then
134
133
        case "$words[2]" in
135
  nopkg_opts=(--resume --skipfirst -c --clean -h --help --depclean --info \
134
	    unmerge|-C)
136
  --metadata -P --prune --regen -s --search -S --searchdesc --sync -C \
135
	 	  if compset -P '(\\|)[><][=]'; then
137
  --unmerge -V --version -i --inject)
136
			_arguments -s \
138
137
		    	'*:installed pkgname with versions:_portage_unmerge_vers' "$common_args[@]" && return 0
139
  bopts=($nopkg_opts -b --buildpkg -B --buildpkgonly -G --getbinpkgonly -g \
138
		  elif compset -P '(\\|)[<=>]'; then
140
  --getbinpkg -k --usepkg -K --usepkgonly --fetch-all-uri -f -F --fetchonly)
139
			_arguments -s \
141
140
		    	'*:installed pkgname with versions:_portage_unmerge_vers' "$common_args[@]" && return 0
142
  all=($bopts -l --changelog --columns --deep -D --emptytree -e --newuse \
141
		  else 
143
  --noconfmem --nodeps -O --noreplace -n --oneshot -1 -o --onlydeps --tree -t \
142
			_arguments -s \
144
  -u --update -U --upgradeonly)
143
		    	'*:installed pkgname:_portage_unmerge' "$common_args[@]" && return 0
145
144
		  fi
146
  common_args=(
145
		;;
147
    "($noask_opts --sync)"{-p,--pretend}"[Simply  display  what would be done]"
146
	    clean|-c)
148
    "($noask_opts)"{-a,--ask}"[Ask what would be done]"
147
	    	_arguments -s \
149
    '(-d --debug --help -h --version -V)'{-d,--debug}'[Tells emerge to run the emerge command in debug mode]'
148
		    '*:installed pkgname:_portage_clean' "$common_args[@]" && return 0
150
    '(--quiet -q --verbose -v)'{-q,--quiet}'[General outcome is a reduced or condensed output]'
149
		;;
151
    '(--verbose -v --quiet -q)'{-v,--verbose}'[Tell emerge to run in verbose mode]'
150
	    --usepkgonly|-K)
152
    '--nospinner[Disables the spinner for the session]'
151
		_arguments -s \
153
  )
152
		    '*:use package only:_portage_tbz2list' "$common_args[@]" && return 0
154
  install_args=(
153
		;;
155
    "($bopts)"{-b,--buildpkg}"[Tells emerge to build binary packages]"
154
	    depclean|help|-h|info|regen|sync|rsync|--searchdesc|-S|search|-s|prune|-P)
156
    "($bopts)"{-B,--buildpkgonly}"[Tells emerge to only build binary packages]"
155
		;;
157
    "($nopkg_opts --emptytree -e -l --changelog --usepkgonly -K)"{-l,--changelog}"[This will show the ChangeLog]"
156
	    --resume|--skipfirst)
158
    "($nopkg_opts -t --tree)--columns[Displays versions in aligned format]"
157
	    	_arguments -s \
159
    "($nopkg_opts -D --deep)"{-D,--deep}"[Consider the entire dependency tree of packages]"
158
		 '--skipfirst[Removes the first package in the resume list]' \
160
    "($nopkg_opts -e -l --changelog --emptytree)"{-e,--emptytree}"[Only consider glibc as installed packages]"
159
		    "$common_args[@]"  && return 0
161
    "($all --nospinner --pretend -p)"{-i,--inject}"[Portage thinks that this package is installed]"
160
		;;
162
    "($nopkg_opts $bopts)"{-f,--fetchonly}"[Just perform fetches for all packages]"
161
	    *)
163
    "($nopkg_opts $bopts)"{-F,--fetch-all-uri}"[As -f, but prints all mirrors when used with -p]"
162
		_arguments -s \
164
    "($bopts)"{-g,--getbinpkg}"[Tells emerge to download binary package]"
163
		    '*:*:->install_portage' \
165
    "($bopts)"{-G,--getbinpkgonly}"[As --getbinpkg, but does not use local info]"
164
		    "$common_args[@]" \
166
    "($nopkg_opts)--noconfmem[Causes portage to disregard merge records]"
165
		    "$install_args[@]" && return 0
167
    "($nopkg_opts -O --nodeps)"{-O,--nodeps}"[Merges specified packages without merging dependencies]"
166
		;;
168
    "($nopkg_opts -n --noreplace)"{-n,--noreplace}"[Skip packages already installed]"
167
        esac
169
    "($nopkg_opts)"{-1,--oneshot}"[Do not add package to the world profile]"
168
    fi
170
    "($nopkg_opts --onlydeps -o)"{-o,--onlydeps}"[Only merge (or pretend to merge) the dependencies]"
169
    while [[ -n "$state" ]]; do
171
    "($nopkg_opts --columns -t --tree)"{-t,--tree}"[Show dependency tree]"
170
        lstate=$state
172
    "($nopkg_opts --update -u)"{-u,--update}"[Updates packages to the most recent version available]"
171
        state=''
173
    "($nopkg_opts --upgradeonly -U)"{-U,--upgradeonly}"[Do not update packages to a lower version]"
172
        case "$lstate" in
174
    "($bopts)"{-k,--usepkg}"[Tells emerge to use binary packages if available]"
173
	    actions)
175
    "($bopts --changelog -l)"{-K,--usepkgonly}"[Tells emerge to use binary packages only]"
174
		if compset -P '(\\|)[><][=]'; then
176
    "($all)"{-c,--clean}"[Cleans the system by removing packages]"
175
		_alternative \
177
    '(: -)'{-h,--help}'[Displays help]:subject:(sync config system)'
176
			'*:portage:_ebuild_cache'
178
    "(: $all)--depclean[Clean all packages that have no reason for being installed]"
177
179
    "(: $all $noask_opts --nospinner --quiet -q)--info[This is a list of information to include in bug reports]"
178
		elif compset -P '(\\|)[<=>]'; then
180
    "(: -)--metadata[Generate metadata]"
179
		_alternative \
181
    "($nopkg_opts --usepkgonly -K)--newuse[Include installed packages which have changed USE flags]"
180
			'*:portage:_ebuild_cache'
182
    "($all)"{-P,--prune}"[Removes all but the latest versions of matching packages]"
181
				
183
    "(: $all $noask_opts --verbose -v)--regen[Causes portage to check and update the dependency cache]"
182
		else 
184
    "(: $all $noask_opts --verbose -v)"{-s,--search}"[Searches for matches]"
183
		_alternative \
185
    "(: $all $noask_opts --verbose -v)"{-S,--searchdesc}"[Matches the seachdesc string against the description field]"
184
		':emerge actions:_actions' \
186
    "(: $all --pretend -p)--sync[Initiates a portage tree update]"
185
		     '*:portage:_portage_pkglist'
187
    "($all)"{-C,--unmerge}"[Removes all matching packages]"
186
		fi
188
    '(: -)'{-V,--version}'[Display version info]'
187
189
    "(: $all[3,-1])--resume[Resumes the last merge operation]"
188
		;;
190
    "(: $all[3,-1])--skipfirst[Removes the first package in the resume list]"
189
	    install_portage)
191
  )
190
		if compset -P '(\\|)[><][=]'; then
192
  profiles=(
191
		_alternative \
193
    'world[All packages in the world profile]'
192
			'*:portage:_ebuild_cache'
194
    'system[All packages in the system profile]'
193
		elif compset -P '(\\|)[<=>]'; then
195
  )
194
		_alternative \
196
195
			'*:portage:_ebuild_cache'
197
  #Reading informations from make.conf
196
		else
198
197
		_alternative \
199
  local trees portage_pkglist category var
198
		     '*:portage:_portage_pkglist'
200
199
		fi
201
  for var in PORTDIR PORTDIR_OVERLAY PKGDIR ; do
200
		;;
202
    local env_var=\$${var}
201
        esac
203
202
    done
204
    [[ -z ${(e)env_var} && -r /etc/make.conf ]] && local $var="`. /etc/make.conf 2>/dev/null;
205
	echo ${(e)env_var}`"
206
    [[ -z ${(e)env_var} && -r /etc/make.globals ]] && local $var="`. /etc/make.globals 2>/dev/null;
207
	echo ${(e)env_var}`"
208
  done
209
210
  trees=( $PORTDIR $=PORTDIR_OVERLAY )
211
  portage_pkglist=( $trees/*-*/*(:t) )
212
  category=( $trees/*-*(/:t) )
213
  typeset -U category
214
215
216
  # Dispatch
217
  if (( $words[(I)(--(unmerge|clean|prune)|-[[:alpha:]]#(C|c|P)[[:alpha:]]#)] )) ; then
218
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
219
	    _arguments -s \
220
		'*:installed package:_portage_unmerge_vers' && return 0
221
	else
222
	    _arguments -s \
223
		"$common_args[@]" "$install_args[@]" \
224
		"*:installed package:_portage_unmerge" && return 0
225
	fi
226
227
  elif (( $words[(I)(world|system)] )) ; then
228
    _arguments -s \
229
	"$common_args[@]" "$install_args[@]" \
230
	"($nopkg_opts[1,-2] --inject -i --oneshot -1):" && return 0
231
232
  elif (( $words[(I)(--usepkgonly|-[[:alnum:]]#K[[:alnum:]]#)] )) ; then
233
    _arguments -s \
234
	"$common_args[@]" "$install_args[@]" \
235
	'*:binary package:_portage_tbz2list' && return 0
236
237
  elif [[ $words[-3] == (--help|-h) ]] ; then
238
      _message "No more arguments" && return 0
239
240
  else
241
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
242
	    _arguments \
243
		"*:portage:_portage_pkglist_vers" && return 0
244
245
	elif (( $words[(I)(--inject|-i)] )) ; then
246
	    _arguments -s \
247
		"$common_args[@]" "$install_args[@]" \
248
		"*:portage:_portage_pkglist_vers" && return 0
249
	else
250
	    _arguments -s \
251
		"$common_args[@]" "$install_args[@]" \
252
		"($nopkg_opts)::portage: _values 'profile' \$profiles[@] " \
253
		"($nopkg_opts)*:portage:_portage_pkglist" && return 0
254
	fi
255
  fi
203
}
256
}
204
257
205
#Function to show only installed packages   -- pkgname (no category or version #)
258
#Function to show only installed packages   -- pkgname (no category or version #)
206
_portage_unmerge(){
259
_portage_unmerge(){
260
    local installed_pkgname installed_list installed_portage
207
    installed_portage=(/var/db/pkg/*-*/*)
261
    installed_portage=(/var/db/pkg/*-*/*)
208
    installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
209
    _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
210
    _path_files -/ -W "/var/db/pkg/"
211
}
212
262
213
#Function to show only installed packages -- no _path_files 
263
    installed_pkgname=( ${${installed_portage:t}%%-[0-9]*} )
214
_portage_quickpkg(){
264
    _tags installed_pkgname && compadd "$@" ${installed_pkgname}
215
    installed_portage=(/var/db/pkg/*-*/*)
265
216
    installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
266
    installed_list=( ${${installed_portage#*/pkg/}%%-[0-9]*} )
217
    _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
267
    _wanted packages expl 'category/package' _multi_parts "$@" / installed_list
218
}
268
}
219
269
220
#Function to show only installed packages -- cat/name-ver
270
#Function to show only installed packages -- cat/name-ver
221
_portage_unmerge_vers(){
271
_portage_unmerge_vers(){
272
    local installed_list installed_portage
222
    installed_portage=(/var/db/pkg/*-*/*)
273
    installed_portage=(/var/db/pkg/*-*/*)
223
    installed_pkgname=${(M)${${installed_portage##*/}}}
274
    _tags installed_pkgname && compadd "$@" ${installed_portage:t}
224
    _tags -s installed_pkgname && {  compadd "$@" ${(kv)=installed_pkgname} }
225
    _path_files -/ -W "/var/db/pkg/"
226
}
227
275
228
#Functions to show "cat/name", classes and dependencies
276
    # most other cat/pkg don't work with _files, so I changed this one too.
229
_portage_clean() {
277
    installed_list=( ${installed_portage##*/pkg/} )
230
    installed_portage=(/var/db/pkg/*-*/*)
278
    _wanted packages expl 'category/package' _multi_parts "$@" / installed_list
231
    installed_dir=/var/db/pkg/
232
    installed_pkg=${installed_portage//$installed_dir/}
233
    installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
234
    _tags -s installed_pkg && { compadd "$@" -k installed_pkg || compadd "$@" ${(kv)=installed_pkg} }
235
    _tags -s installed_pkgname && { compadd "$@" -k installed_pkgname || compadd "$@" ${(kv)=installed_pkgname} }
236
}
279
}
237
280
238
#Function to show tbz2 files available
281
#Function to show tbz2 files available
239
_portage_tbz2list() {
282
_portage_tbz2list() {
240
    # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official
283
    # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official
241
    # binary mirror will be available we should rewrite it accordingly.
284
    # binary mirror will be available we should rewrite it accordingly.
242
    _path_files -g \*.tbz2 -W "${pkgdir}/All"
285
    _path_files -g \*.tbz2 -W "${PKGDIR}/All"
243
}
286
}
244
287
245
#Function to show all available portage names
288
#Function to show all available portage names
246
_portage_pkglist(){
289
_portage_pkglist(){
247
    portage_classlist="world system"
290
    local pkg
248
    portage_pkglist="$portage_pkglist ${portage_classlist}"
291
    _tags portage_pkglist && compadd "$@" $portage_pkglist
249
    _tags -s portage_pkglist && { compadd "$@" -k portage_pkglist || compadd "$@" ${(kv)=portage_pkglist} }
292
250
    _path_files -/ -W "${portdir}"
293
    # Complete cat/pkg. _multi_parts is much to slow for such a large task,
251
    # XXX: If I add ${portdir_overlay} category completion won't work properly
294
    # _sep_parts removes the dash from gnome-<tab>, and _path_files wants to
252
    #[[ -n "${portdir_overlay}" ]] && _path_files -/ -W "${portdir_overlay}"
295
    # complete cat/pkg/files (if "files" is ignored with -F, miscfiles, etc...
253
    _path_files -g \*.ebuild
296
    # don't get completed).
254
}
297
    if [[ $PREFIX != */* ]] ; then
255
#Function for matching all ebuilds  pkg-ver (slow if asking for all packages)
298
	_wanted packages expl 'category/package' compadd -S '/' $category
256
_ebuild_cache(){
299
    else
257
    if _cache_invalid portage_ebuilds || ! _retrieve_cache portage_ebuilds; then
300
	compset -P '*/'
258
301
	pkg=( $trees/$IPREFIX/*(:t) )
259
    overlay_ebuilds=($portdir_overlay/*-*/*/*)
302
	_wanted packages expl 'category/package' compadd $pkg
260
    overlay_list=${${(M)${overlay_ebuilds##*/}#*ebuild}%%.ebuild}
303
    fi
261
    metadata_ebuilds=($portdir/metadata/cache/*-*/*)
304
}
262
    metadata_list=${(M)${${metadata_ebuilds##*/}}}
263
305
264
	 _store_cache portage_ebuilds metadata_list overlay_list
306
#Function to show all package versions
307
_portage_pkglist_vers(){
308
    local portage_ebuilds overlay_ebuilds pkg
309
310
    if [[  $#PREFIX -ge 1  &&  -z $words[(r)(--inject|-i)]  ]] ; then
311
	overlay_ebuilds=(${=PORTDIR_OVERLAY}/*-*/${PREFIX%%-[0-9]#*}*/*.ebuild(:t:r) )
312
	portage_ebuilds=($PORTDIR/metadata/cache/*-*/${PREFIX%%-[0-9]#*}*(:t))
313
	_tags portage_pkglist && compadd "$@" $portage_ebuilds $overlay_ebuilds
265
    fi
314
    fi
266
    _tags -s metadata_list && {compadd "$@" ${(kv)=metadata_list} } 
315
267
    _tags -s overlay_list && {compadd "$@" ${(kv)=overlay_list} }
316
    pkg=( $trees/${PREFIX%%/*}/*/*.ebuild(:t:r) )
317
    _wanted packages expl 'category/package' _sep_parts category / pkg
268
}
318
}
269
319
270
local update_policy
320
271
zstyle -s ":completion:*:*:emerge:*" cache-policy update_policy
321
local gentoo_runlevels
272
if [[ -z "$update_policy" ]]; then
322
gentoo_runlevels=(/etc/runlevels/*(:t))
273
  zstyle ":completion:*:*:emerge:*" cache-policy _ebuilds_caching_policy
274
fi
275
276
_ebuilds_caching_policy () {
277
  # rebuild if cache is more than a week old
278
  oldp=( "$1"(mw+1) )
279
  (( $#oldp )) && return 0
280
}
281
282
common_args=(
283
    {'(-p -a --ask)--pretend','(--pretend -a --ask)-p'}'[simply  display  what would be done]'
284
    {'(-p -a --pretend)--ask','(--pretend -p --ask)-a'}'[ask what would be done]'
285
    {'(-d)--debug','(--debug)-d'}'[Tells emerge to run the emerge command in debug mode]'
286
)
287
install_args=(
288
    {'(--upgradeonly -U --update -u --quiet -q --onlydeps -o --oneshot --nospinner --noreplace -n --nodeps -O --noconfmem -D --deep --changelog --buildpkg -B -b --buildpkgonly --emptytree -e -f --fetchonly)-l','(--upgradeonly -U --update -u --quiet -q --onlydeps -o --nospinner --noreplace -n --nodeps -O --noconfmem -D --deep --emptytree -e -f --fetchonly -l --buildpkg -b -B --buildpkgonly )--changelog'}'[This will show the ChangeLog]'
289
    {'(-b --buildpkgonly -B --changelog -l)--buildpkg','(--changelog -l --buildpkg --buildpkgonly -B)-b'}'[Tells emerge to build binary packages]'
290
    {'(-B -b --buildpkg --changelog -l)--buildpkgonly','(--changelog -l --buildpkgonly --buildpkg -b)-B'}'[Tells emerge to only build binary packages]'
291
    {'(-D --changelog -l)--deep','(-l --changelog --deep)-D'}'[Consider the entire dependency tree of packages]'
292
    {'(-e -l --changelog)--emptytree','(--emptytree -l --changelog)-e'}'[Only consider glibc as installed packages]'
293
    {'(-f -l --changelog)--fetchonly','(-l --changelog --fetchonly)-f'}'[Just perform fetches for all packages]'
294
    '(-l --changelog)--noconfmem[Causes portage to disregard merge records]'
295
    {'(--changelog -l -O)--nodeps','(--nodeps --changelog -l)-O'}'[Merges specified packages without merging dependencies]'
296
    {'(-l --changelog -n)--noreplace','(-l --changelog --noreplace)-n'}'[Skip packages already installed]'
297
    '(-l --changelog)--nospiner[Disables the spinner for the session]'
298
    '(-l --changelog)--oneshot[Do not add package to the world profile]'
299
    {'(--onlydeps --changelog -l)-o','(--changelog -o -l)--onlydeps'}'[Only merge (or pretend to merge) the dependencies]'
300
    {'(--quiet --changelog -l)-q','(-q --changelog -l)--quiet'}'[General outcome is a reduced or condensed output]'
301
    {'(-l --changelog -t)--tree','(-l --changelog --tree)-t'}'[Show dependency tree]'
302
    {'(--update --changelog -l)-u','(-u --changelog -l)--update'}'[Updates packages to the most recent version available]'
303
    {'(--upgradeonly --changelog -l)-U','(-U --changelog -l)--upgradeonly'}'[Do not update packages to a lower version]'
304
    {'(--usepkg --changelog -l)-k','(-k --changelog -l)--usepkg'}'[Tells emerge to use binary packages if available]'
305
    {'(--usepkgonly --changelog -l)-K','(-K --changelog -l)--usepkgonly'}'[Tells emerge to use binary packages only]'
306
    {'(--verbose)-v','(-v)--verbose'}'[Tell emerge to run in verbose mode]'
307
    '(-p --pretend -a --ask)--columns[Displays versions in aligned format]'
308
    '--resume[Resumes the last merge operation]'
309
)
310
311
_actions() {
312
    _values "emerge actions" \
313
	'sync[Initiates a portage tree update]' \
314
	'rsync[Initiates a portage tree update]' \
315
	'unmerge[Removes all matching packages]' \
316
	'search[Searches for matches]' \
317
	'regen[Causes portage to check and update the dependency cache]' \
318
	'prune[Removes all but the latest versions of matching packages]' \
319
	'inject[Portage thinks that this package is installed]' \
320
	'info[This is a list of information to include in bug reports]' \
321
	'help[Displays help]' \
322
	'depclean[Clean all packages that have no reason for being installed]'\
323
	'clean[Cleans the system by removing packages]' \
324
	'-c[Cleans the system by removing packages]' \
325
	'-h[Displays help]' \
326
	'-i[Portage thinks that this package is installed]' \
327
	'-P[Removes all but the latest versions of matching packages]' \
328
	'-s[Searches for matches]' \
329
	'-S[Matches the search string against the description field]' \
330
	'--searchdesc[Matches the search string against the description field]' \
331
	'-C[Removes all matching packages]' \
332
	'world[Represent all packages in the world profiles]' \
333
	'system[Represent all the system packages]' 
334
}
335
local portage_pkglist gentoo_runlevels portdir pkgdir portdir_overlay overlay
336
#Reading informations from make.conf
337
[[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}"
338
[[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}"
339
if [[ -n "${PORTDIR_OVERLAY}" ]] ; then
340
    for overlay in ${=PORTDIR_OVERLAY} ; do
341
	portdir_overlay=(${overlay} ${portdir_overlay})
342
    done
343
fi
344
[[ -r /etc/make.globals ]] && source /etc/make.globals
345
[[ -r /etc/make.conf ]] && source /etc/make.conf
346
347
[[ -z "${portdir}" ]] && portdir="${PORTDIR}"
348
[[ -z "${pkgdir}" ]] && pkgdir="${PKGDIR}"
349
if [[ -z "${portdir_overlay}" ]] ; then
350
    for overlay in ${=PORTDIR_OVERLAY} ; do
351
	portdir_overlay=(${overlay} ${portdir_overlay})
352
    done
353
fi
354
355
portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
356
portage_pkglist=(${portage_pkglist##*/})
357
gentoo_runlevels=(/etc/runlevels/*)
358
gentoo_runlevels=(${${gentoo_runlevels/\/etc\/runlevels\//}%/})
359
323
360
case "$service" in
324
case "$service" in
361
	emerge)
325
	emerge)

Return to bug 71532