Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 71957 | Differences between
and this patch

Collapse All | Expand All

(-)site-functions-old/_gcc-config (-2 / +2 lines)
Lines 19-26 Link Here
19
19
20
_gcc_profile(){
20
_gcc_profile(){
21
    local profile
21
    local profile
22
    profile=$(_call_program tag gcc-config --list-profiles)
22
    profile=(${(f)"$(_call_program gcc-installed gcc-config --list-profiles)"})
23
    profile=${profile/\[([^]]*)\]/}
23
    profile=${${profile/\[([^]]*)\]/}/\*}
24
    _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} }
24
    _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} }
25
}
25
}
26
26
(-)site-functions-old/_genlop (-36 / +1 lines)
Lines 61-67 Link Here
61
		"($single --time -t)"{--time,-t}"[display merge time]" \
61
		"($single --time -t)"{--time,-t}"[display merge time]" \
62
		"($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \
62
		"($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \
63
		"($single $arg *)"{--version,-v}"[display version information]" \
63
		"($single $arg *)"{--version,-v}"[display version information]" \
64
		"($single)*:package:_portage_pkglist"
64
		"($single)*:package:_gentoo_packages available"
65
	;;
65
	;;
66
    esac
66
    esac
67
	
67
	
Lines 79-91 Link Here
79
    done   
79
    done   
80
}
80
}
81
81
82
#Function to show all available portage names
83
_portage_pkglist(){
84
    portage_pkglist="$portage_pkglist"
85
    _tags -s portage_pkglist && { compadd "$@" ${(kv)=portage_pkglist} }
86
    _path_files -/ -F "*CVSROOT" -F "*eclass" -F "*distfiles" -F "*licences" -F "*files" -W "${portdir}"
87
}
88
89
_days() {
82
_days() {
90
	local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday"	
83
	local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday"	
91
	local day=$(date +%u)
84
	local day=$(date +%u)
Lines 115-145 Link Here
115
	elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d
108
	elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d
116
	fi
109
	fi
117
}
110
}
118
119
#Reading informations from make.conf
120
#
121
# Using portageq is the right way to get PORTDIR, but it is very slow :-(
122
#
123
#portdir="$(portageq portdir)"
124
#pkgdir="$(portageq pkgdir)"
125
#portdir_overlay="$(portageq portdir_overlay)"
126
[[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}"
127
[[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}"
128
if [[ -n "${PORTDIR_OVERLAY}" ]] ; then
129
    for overlay in ${=PORTDIR_OVERLAY} ; do
130
	portdir_overlay=(${overlay} ${portdir_overlay})
131
    done
132
fi
133
[[ -r /etc/make.globals ]] && source /etc/make.globals
134
[[ -r /etc/make.conf ]] && source /etc/make.conf
135
136
[[ -z "${portdir}" ]] && portdir="${PORTDIR}"
137
[[ -z "${pkgdir}" ]] && pkgdir="${PKGDIR}"
138
if [[ -z "${portdir_overlay}" ]] ; then
139
    for overlay in ${=PORTDIR_OVERLAY} ; do
140
	portdir_overlay=(${overlay} ${portdir_overlay})
141
    done
142
fi
143
144
portage_pkglist=(${portdir}/*-*/* ${=portdir_overlay}/*-*/*)
145
portage_pkglist=(${portage_pkglist##*/})
(-)site-functions-old/_gentoolkit (-24 / +11 lines)
Lines 19-30 Link Here
19
_tags -s category && { compadd "$@" ${(kv)=category} }
19
_tags -s category && { compadd "$@" ${(kv)=category} }
20
}
20
}
21
21
22
#Function to show only installed packages   -- pkgname (no category or version #)
23
_portage_installed(){
24
    installed_portage=(/var/db/pkg/*-*/*)
25
    installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
26
    _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
27
}
28
#moved out of equery 
22
#moved out of equery 
29
_equery_val(){
23
_equery_val(){
30
    _values  "equery actions" \
24
    _values  "equery actions" \
Lines 38-50 Link Here
38
	'size[print size of files contained in package]' 
32
	'size[print size of files contained in package]' 
39
	}
33
	}
40
34
41
#Function to show all available portage names
42
_portage_pkglist(){
43
    portage_pkglist="$portage_pkglist"
44
    _tags -s portage_pkglist && { compadd "$@" ${(kv)=portage_pkglist} }
45
    _path_files -/ -F "*CVSROOT" -F "*eclass" -F "*distfiles" -F "*licences" -W "${portdir}"
46
}
47
48
#Reading informations from Portage
35
#Reading informations from Portage
49
#
36
#
50
# Using portageq is the right way to get PORTDIR, but it is very slow :-(
37
# Using portageq is the right way to get PORTDIR, but it is very slow :-(
Lines 70-77 Link Here
70
    done
57
    done
71
fi
58
fi
72
59
73
portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
60
#portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
74
portage_pkglist=(${portage_pkglist##*/})
61
#portage_pkglist=(${portage_pkglist##*/})
75
62
76
63
77
case $service in
64
case $service in
Lines 101-118 Link Here
101
	"($excl --uninstalled -U --installed -I $dups -d)"{--installed,-I}"[include only installed packages]" \
88
	"($excl --uninstalled -U --installed -I $dups -d)"{--installed,-I}"[include only installed packages]" \
102
	"($excl --group -g $dups -d)"{--group,-g}"[find by group]:group:_category" \
89
	"($excl --group -g $dups -d)"{--group,-g}"[find by group]:group:_category" \
103
	"($check $excl --list -l $dups -d)"{--list,-l}"[list package contents]" \
90
	"($check $excl --list -l $dups -d)"{--list,-l}"[list package contents]" \
104
	"($excl --info -i $dups -d 1)"{--info,-i}"[get package description and home page]:package:_portage_pkglist" \
91
	"($excl --info -i $dups -d 1)"{--info,-i}"[get package description and home page]:package:_gentoo_packages available" \
105
	"($excl $check $find $dups --uninstalled -U)"{--check-time,-ct}"[verify package file timestamps]" \
92
	"($excl $check $find $dups --uninstalled -U)"{--check-time,-ct}"[verify package file timestamps]" \
106
	"($excl $check $find $dups --uninstalled -U)"{--check-md5,-cm}"[verify package files md5]" \
93
	"($excl $check $find $dups --uninstalled -U)"{--check-md5,-cm}"[verify package files md5]" \
107
	"($excl $check $find $dups --uninstalled -U)"{--check,-c}"[verify mtimes and md5]" \
94
	"($excl $check $find $dups --uninstalled -U)"{--check,-c}"[verify mtimes and md5]" \
108
	"($excl $find --query-deps -q $dups -d 1)"{--query-deps,-q}"[display all installed packages depending on selected packages]:package:_portage_pkglist" \
95
	"($excl $find --query-deps -q $dups -d 1)"{--query-deps,-q}"[display all installed packages depending on selected packages]:package:_gentoo_packages available" \
109
	"()"{--no-color,-nc}"[dont use colors]" \
96
	"()"{--no-color,-nc}"[dont use colors]" \
110
	"*--verbose[be more verbose (2 levels)]" \
97
	"*--verbose[be more verbose (2 levels)]" \
111
	"*-v[be more verbose (2 levels)]" \
98
	"*-v[be more verbose (2 levels)]" \
112
	"($excl --non-masked -n --masked -m $dups)"{--masked,-m}"[include only masked packages]" \
99
	"($excl --non-masked -n --masked -m $dups)"{--masked,-m}"[include only masked packages]" \
113
	"($excl --non-masked -n --masked -m $dups)"{--non-masked,-n}"[include only non-masked packages]" \
100
	"($excl --non-masked -n --masked -m $dups)"{--non-masked,-n}"[include only non-masked packages]" \
114
	"(- :)"{--help,-h}"[show help]" \
101
	"(- :)"{--help,-h}"[show help]" \
115
	"(--info -i --query-deps -q --slot -s)1:package:_portage_installed"
102
	"(--info -i --query-deps -q --slot -s)1:package:_gentoo_packages installed"
116
;;
103
;;
117
 
104
 
118
equery)
105
equery)
Lines 130-136 Link Here
130
		 '--timestamp[append timestamp]' \
117
		 '--timestamp[append timestamp]' \
131
		 '--md5sum[append md5sum]' \
118
		 '--md5sum[append md5sum]' \
132
		 '--type[prepend file type]' \
119
		 '--type[prepend file type]' \
133
		 '*:installed pkgname:_portage_installed' && return 0
120
		 '*:installed pkgname:_gentoo_packages installed' && return 0
134
		;;
121
		;;
135
	    belongs|--earlyout)
122
	    belongs|--earlyout)
136
		  _arguments -s \
123
		  _arguments -s \
Lines 148-176 Link Here
148
		 '(-I --exclude-installed -i --installed)'{-I,--exclude-installed}'[do not search installed packages]' \
135
		 '(-I --exclude-installed -i --installed)'{-I,--exclude-installed}'[do not search installed packages]' \
149
		 '(-p --portage)'{-p,--portage-tree}'[also search in portage tree]' \
136
		 '(-p --portage)'{-p,--portage-tree}'[also search in portage tree]' \
150
		 '(-o --overlay-tree)'{-o,--overlay-tree}'[also search in overlay tree]' \
137
		 '(-o --overlay-tree)'{-o,--overlay-tree}'[also search in overlay tree]' \
151
		 '*:package:_portage_installed' && return 0
138
		 '*:package:_gentoo_packages installed' && return 0
152
		;;
139
		;;
153
	    uses|which)
140
	    uses|which)
154
	    	_arguments \
141
	    	_arguments \
155
		'*:package:_portage_pkglist' \
142
		'*:package:_gentoo_packages available' \
156
		     && return 0
143
		     && return 0
157
		;;
144
		;;
158
	    depgraph|-U|--no-useflags|-l|--linear)
145
	    depgraph|-U|--no-useflags|-l|--linear)
159
	    	_arguments -s \
146
	    	_arguments -s \
160
		'(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \
147
		'(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \
161
		'(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \
148
		'(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \
162
		 '*:package:_portage_installed' \
149
		 '*:package:_gentoo_packages installed' \
163
		   && return 0
150
		   && return 0
164
		;;
151
		;;
165
	    size|-b|--bytes)
152
	    size|-b|--bytes)
166
	    	_arguments -s \
153
	    	_arguments -s \
167
		'(-b --bytes)'{-b,--bytes}'[report size in bytes]' \
154
		'(-b --bytes)'{-b,--bytes}'[report size in bytes]' \
168
		'*:package:_portage_installed' \
155
		'*:package:_gentoo_packages installed' \
169
		    && return 0
156
		    && return 0
170
		;;
157
		;;
171
	    check)
158
	    check)
172
		_arguments -s \
159
		_arguments -s \
173
		'*:package:_portage_installed' \
160
		'*:package:_gentoo_packages installed' \
174
		    && return 0
161
		    && return 0
175
	        ;;
162
	        ;;
176
	    --nocolor|-C|--quiet|-q)
163
	    --nocolor|-C|--quiet|-q)
(-)site-functions-old/_gentoo_packages (+92 lines)
Line 0 Link Here
1
#autoload
2
3
#Author: baptux <bapt@ifrance.com>
4
#Description: 
5
# functions for gentoo packages
6
# inspired by _deb_packages
7
#Usage: _gentoo_packages installed|available
8
local gentoo_pkglist installed_pkg
9
_gentoo_installed_list(){
10
	local installed_portage installed_dir installed_pkgname
11
	installed_portage=(/var/db/pkg/*-*/*)
12
	installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
13
	installed_dir=/var/db/pkg/
14
	installed_pkg=${installed_portage//$installed_dir/}
15
	installed_pkg="${installed_pkgname} ${installed_pkg}"	
16
}
17
_gentoo_pkglist(){
18
	local portage_pkglist portdir pkgdir portdir_overlay overlay
19
	#Reading informations from make.conf
20
	[[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}"
21
	[[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}"
22
	if [[ -n "${PORTDIR_OVERLAY}" ]] ; then
23
		for overlay in ${=PORTDIR_OVERLAY} ; do
24
			portdir_overlay=(${overlay} ${portdir_overlay})
25
		done
26
	fi
27
	[[ -r /etc/make.globals ]] && source /etc/make.globals
28
	[[ -r /etc/make.conf ]] && source /etc/make.conf
29
	[[ -z "${portdir}" ]] && portdir="${PORTDIR}"
30
	[[ -z "${pkgdir}" ]] && pkgdir="${PKGDIR}"
31
	if [[ -z "${portdir_overlay}" ]] ; then
32
		for overlay in ${=PORTDIR_OVERLAY} ; do
33
			portdir_overlay=(${overlay} ${portdir_overlay})
34
		done
35
	fi
36
	portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
37
	portage_pkglist=(${portage_pkglist##*/})
38
	gentoo_classlist="world system"
39
	gentoo_pkglist=(${(kv)=portage_pkglist} ${(kv)=gentoo_classlist})
40
}
41
_gentoo_packages_update_installed(){
42
	if ( [[ ${+_gentoo_packages_cache_installed} -eq 0 ]] ||
43
	      _cache_invalid GENTOO_installed ) && ! _retrieve_cache GENTOO_installed;
44
	then
45
		_gentoo_installed_list
46
	    _gentoo_packages_cache_installed=(
47
	      	${(kv)=installed_pkg}
48
	      )
49
         _store_cache GENTOO_installed _gentoo_packages_cache_installed
50
    fi
51
      cachevar=_gentoo_packages_cache_installed
52
}
53
54
_gentoo_packages_update_available(){
55
	if ( [[ ${+_gentoo_packages_cache_available} -eq 0 ]] ||
56
		_cache_invalid GENTOO_available ) && ! _retrieve_cache GENTOO_available;
57
	then
58
		_gentoo_pkglist
59
		_gentoo_packages_cache_available=(
60
			${gentoo_pkglist}
61
		)
62
		_store_cache GENTOO_available _gentoo_packages_cache_available
63
	fi
64
	cachevar=_gentoo_packages_cache_available
65
}
66
67
_gentoo_packages () {
68
	local command="$argv[$#]" expl cachevar pkgset update_policy
69
	zstyle -s ":completion:*:*:$service:*" cache-policy update_policy
70
	if [[ -z "$update_policy" ]]; then
71
		zstyle ":completion:*:*:$service:*" cache-policy _gentoo_cache_policy
72
	fi
73
	[[ "$command" = (installed|available) ]] || {
74
		_message "unknown command: $command"
75
		return
76
	}
77
	[[ "$pkgset" = (installed|available) ]] || {
78
		pkgset="$command"
79
	}
80
	expl=("${(@)argv[1,-2]}")
81
	_gentoo_packages_update_$pkgset
82
	_tags packages && compadd "$expl[@]" - "${(@P)cachevar}"
83
}
84
85
_gentoo_cache_policy () {
86
  # rebuild if cache is more than a week old
87
    oldp=( "$1"(mw+1) )
88
      (( $#oldp )) && return 0
89
}
90
91
92
_gentoo_packages "$@"
(-)site-functions-old/_portage (-40 / +5 lines)
Lines 6-20 Link Here
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
8
9
# Already done:
10
#
11
# emerge (fully done) 
12
# rc-update (fully done)
13
# rc-status (fully done)
14
# ebuild (fully done)
15
# opengl-update (fully done)
16
# rc (fully done)
17
18
# Stuff for rc
9
# Stuff for rc
19
_rc () {
10
_rc () {
20
	if (( CURRENT == 2 ));then
11
	if (( CURRENT == 2 ));then
Lines 117-123 Link Here
117
		_files -W / -/ && return 0
108
		_files -W / -/ && return 0
118
	  else 
109
	  else 
119
		_arguments -s \
110
		_arguments -s \
120
		    '*:installed pkgname:_portage_quickpkg' && return 0
111
		    '*:installed pkgname:_portage_unmerge' && return 0
121
	  fi
112
	  fi
122
}
113
}
123
 
114
 
Lines 145-151 Link Here
145
		;;
136
		;;
146
	    clean|-c)
137
	    clean|-c)
147
	    	_arguments -s \
138
	    	_arguments -s \
148
		    '*:installed pkgname:_portage_clean' "$common_args[@]" && return 0
139
		    '*:installed pkgname:_gentoo_packages installed' "$common_args[@]" && return 0
149
		;;
140
		;;
150
	    --usepkgonly|-K)
141
	    --usepkgonly|-K)
151
		_arguments -s \
142
		_arguments -s \
Lines 204-222 Link Here
204
195
205
#Function to show only installed packages   -- pkgname (no category or version #)
196
#Function to show only installed packages   -- pkgname (no category or version #)
206
_portage_unmerge(){
197
_portage_unmerge(){
207
    installed_portage=(/var/db/pkg/*-*/*)
198
    _gentoo_packages installed
208
    installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
209
    _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
210
    _path_files -/ -W "/var/db/pkg/"
199
    _path_files -/ -W "/var/db/pkg/"
211
}
200
}
212
201
213
#Function to show only installed packages -- no _path_files 
214
_portage_quickpkg(){
215
    installed_portage=(/var/db/pkg/*-*/*)
216
    installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
217
    _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
218
}
219
220
#Function to show only installed packages -- cat/name-ver
202
#Function to show only installed packages -- cat/name-ver
221
_portage_unmerge_vers(){
203
_portage_unmerge_vers(){
222
    installed_portage=(/var/db/pkg/*-*/*)
204
    installed_portage=(/var/db/pkg/*-*/*)
Lines 225-240 Link Here
225
    _path_files -/ -W "/var/db/pkg/"
207
    _path_files -/ -W "/var/db/pkg/"
226
}
208
}
227
209
228
#Functions to show "cat/name", classes and dependencies
229
_portage_clean() {
230
    installed_portage=(/var/db/pkg/*-*/*)
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
}
237
238
#Function to show tbz2 files available
210
#Function to show tbz2 files available
239
_portage_tbz2list() {
211
_portage_tbz2list() {
240
    # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official
212
    # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official
Lines 244-255 Link Here
244
216
245
#Function to show all available portage names
217
#Function to show all available portage names
246
_portage_pkglist(){
218
_portage_pkglist(){
247
    portage_classlist="world system"
219
    _gentoo_packages available
248
    portage_pkglist="$portage_pkglist ${portage_classlist}"
249
    _tags -s portage_pkglist && { compadd "$@" -k portage_pkglist || compadd "$@" ${(kv)=portage_pkglist} }
250
    _path_files -/ -W "${portdir}"
220
    _path_files -/ -W "${portdir}"
251
    # XXX: If I add ${portdir_overlay} category completion won't work properly
252
    #[[ -n "${portdir_overlay}" ]] && _path_files -/ -W "${portdir_overlay}"
253
    _path_files -g \*.ebuild
221
    _path_files -g \*.ebuild
254
}
222
}
255
#Function for matching all ebuilds  pkg-ver (slow if asking for all packages)
223
#Function for matching all ebuilds  pkg-ver (slow if asking for all packages)
Lines 332-338 Link Here
332
	'world[Represent all packages in the world profiles]' \
300
	'world[Represent all packages in the world profiles]' \
333
	'system[Represent all the system packages]' 
301
	'system[Represent all the system packages]' 
334
}
302
}
335
local portage_pkglist gentoo_runlevels portdir pkgdir portdir_overlay overlay
303
local gentoo_runlevels portdir pkgdir portdir_overlay overlay
336
#Reading informations from make.conf
304
#Reading informations from make.conf
337
[[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}"
305
[[ -n "${PORTDIR}" ]] && portdir="${PORTDIR}"
338
[[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}"
306
[[ -n "${PKGDIR}" ]] && pkgdir="${PKGDIR}"
Lines 351-359 Link Here
351
	portdir_overlay=(${overlay} ${portdir_overlay})
319
	portdir_overlay=(${overlay} ${portdir_overlay})
352
    done
320
    done
353
fi
321
fi
354
355
portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
356
portage_pkglist=(${portage_pkglist##*/})
357
gentoo_runlevels=(/etc/runlevels/*)
322
gentoo_runlevels=(/etc/runlevels/*)
358
gentoo_runlevels=(${${gentoo_runlevels/\/etc\/runlevels\//}%/})
323
gentoo_runlevels=(${${gentoo_runlevels/\/etc\/runlevels\//}%/})
359
324

Return to bug 71957