7085700 miscellaneous completion fixes: _svcs_fmri, _dtrace, _pkg5, _zoneadm
authorDanek Duvall <danek.duvall@oracle.com>
Wed, 31 Aug 2011 15:30:47 -0700
changeset 510 53bd319b010e
parent 509 07ee58881cb3
child 511 f84d7a36b8c7
7085700 miscellaneous completion fixes: _svcs_fmri, _dtrace, _pkg5, _zoneadm 7085734 shell/zsh should set overlay=allow on editable configuration files
components/zsh/Completion/Solaris/Command/_dtrace
components/zsh/Completion/Solaris/Command/_pkg5
components/zsh/Completion/Solaris/Command/_zoneadm
components/zsh/Completion/Solaris/Type/_svcs_fmri
components/zsh/zsh.p5m
--- a/components/zsh/Completion/Solaris/Command/_dtrace	Fri Sep 02 06:01:11 2011 -0700
+++ b/components/zsh/Completion/Solaris/Command/_dtrace	Wed Aug 31 15:30:47 2011 -0700
@@ -12,7 +12,7 @@
 	'-C[run cpp(1) preprocessor on script files]' \
 	'-D[define symbol when invoking preprocessor]' \
 	'-e[exit after compiling request but prior to enabling probes]' \
-	'-f[enable or list probes matching the specified function name]:function:_dtrace_function' \
+	'-f[enable or list probes matching the specified function name]:function: ' \
 	'-F[coalesce trace output by function]' \
 	'-G[generate an ELF file containing embedded dtrace program]' \
 	'-H[print included files when invoking preprocessor]' \
@@ -21,11 +21,11 @@
 	'-I[add include directory to preprocessor search path]:include dir:_files -/' \
 	'-L[Add directory to search path for DTrace libraries]:lib dir:_files -/' \
 	'-l[list probes matching specified criteria]' \
-	'-m[enable or list probes matching the specified module name]:module:_dtrace_module' \
-	'-n[enable or list probes matching the specified probe name]:name:_dtrace_name' \
+	'-m[enable or list probes matching the specified module name]:module: ' \
+	'-n[enable or list probes matching the specified probe name]:name: ' \
 	'-o[set output file]:output file:_files' \
 	'-p[grab specified process-ID and cache its symbol tables]:pid:_pids' \
-	'-P[enable or list probes matching the specified provider name]:provider:_dtrace_provider' \
+	'-P[enable or list probes matching the specified provider name]:provider: ' \
 	'-q[set quiet mode (only output explicitly traced data)]' \
 	'-s[enable or list probes according to the specified D script]' \
 	'-S[print D compiler intermediate code]' \
--- a/components/zsh/Completion/Solaris/Command/_pkg5	Fri Sep 02 06:01:11 2011 -0700
+++ b/components/zsh/Completion/Solaris/Command/_pkg5	Wed Aug 31 15:30:47 2011 -0700
@@ -62,10 +62,6 @@
 	compadd "[email protected]" - $(pkg -R $pkg5_root facet -H | awk '{print $1}')
 }
 
-_pkg5_properties() {
-	compadd "[email protected]" - $(pkg -R $pkg5_root property -H | awk '{print $1}')
-}
-
 _pkg5_known_caching_policy() {
 	[[ $pkg5_root/var/pkg/state/known/catalog.attrs -nt "$1" ]]
 }
@@ -75,9 +71,10 @@
 }
 
 _pkg5() {
-	local expl context state line pkg5_root
+	local expl context state line pkg5_root prop
 	typeset -A opt_args
-	local -a subcmds pkg5_actions pkg5_cattr pkg5_sattr
+	local -a subcmds pkg5_actions pkg5_cattr pkg5_sattr be_opts
+	local -a publisher_properties image_properties certs
 
 	subcmds=(
 		install uninstall list update refresh version help
@@ -85,7 +82,7 @@
 		{change-,}{variant,facet} avoid unavoid history
 		{{un,}set-,}property {add,remove}-property-value
 		{{un,}set-,}publisher purge-history rebuild-index
-		update-format
+		update-format freeze unfreeze {{un,}set-,}mediator
 	)
 
 	pkg5_actions=(
@@ -104,6 +101,24 @@
 		$pkg5_cattr search.match search.match_type
 	)
 
+	publisher_properties=(
+		"signature-policy:value:(ignore verify require-signatures require-names)"
+		"signature-required-names:value:"
+	)
+
+	image_properties=(
+	    "be-policy:value:(default always-new create-backup when-required)"
+	    "ca-path:value:_path_files -/"
+	    "check-certificate-revocation:value:(true false)"
+	    "flush-content-cache-on-success:value:(true false)"
+	    "mirror-discovery:value:(true false)"
+	    "send-uuid:value:(true false)"
+	    "signature-policy:value:(ignore verify require-signatures require-names)"
+	    "signature-required-names:value:"
+	    "trust-anchor-directory:value:_path_files -/"
+	    "use-system-repo:value:(true false)"
+	)
+
 	if [[ $service == "pkg" ]]; then
 		_arguments -C -A "-*" \
 			'(-\? --help)'{-\?,--help}'[Help]' \
@@ -120,6 +135,19 @@
 
 	pkg5_root=${${${opt_args[-R]}:-$PKG_IMAGE}:-/}
 
+	certs=( $(pkg -R $pkg5_root property -H ca-path | awk '{print $2}')/* )
+
+	# Options common to subcommands which might have to deal with BEs.
+	be_opts=(
+		"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]"
+		"(--deny-new-be)--require-new-be[Force a new BE to be created]"
+		"--be-name[Specify a BE name]:BE name: "
+		"--no-be-activate[Don't activate the new BE]"
+		"(--require-backup-be)--no-backup-be[Don't leave behind a backup BE]"
+		"(--no-backup-be)--require-backup-be[Force leaving behind a backup BE]"
+		"--backup-be-name[Specify the name for the backup BE]:BE name: "
+	)
+
 	case $service in
 	("install")
 		_arguments -A "-*" \
@@ -129,12 +157,10 @@
 			'-g[Specify additional source of packages]:source:_path_files -/' \
 			"--accept[Accept all licenses]" \
 			"--licenses[Display all licenses]" \
-			"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]" \
-			"(--deny-new-be)--require-new-be[Force a new BE to be created]" \
-			"--be-name[Specify a BE name]:BE name: " \
 			"--reject[Specify an FMRI to exclude from the result]:fmri:_pkg5_pkgs" \
 			"--no-refresh[Don't refresh catalogs]" \
 			"--no-index[Don't reindex search database]" \
+			$be_opts \
 			'*:package:_pkg5_pkgs_a'
 		;;
 
@@ -142,11 +168,8 @@
 		_arguments -A "-*" \
 			'-n[Dry run]' \
 			'-q[Quiet]' \
-			'-r[Recursively uninstall dependencies]' \
 			'-v[Verbose]' \
-			"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]" \
-			"(--deny-new-be)--require-new-be[Force a new BE to be created]" \
-			"--be-name[Specify a BE name]:BE name: " \
+			$be_opts \
 			"--no-index[Don't reindex search database]" \
 			'*:package:_pkg5_pkgs'
 		;;
@@ -160,9 +183,7 @@
 			'-g[Specify additional source of packages]:source:_path_files -/' \
 			"--accept[Accept all licenses]" \
 			"--licenses[Display all licenses]" \
-			"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]" \
-			"(--deny-new-be)--require-new-be[Force a new BE to be created]" \
-			'--be-name[Specify a BE name]:name:' \
+			$be_opts \
 			"--reject[Specify an FMRI to exclude from the result]:fmri:_pkg5_pkgs" \
 			"--no-refresh[Don't refresh catalogs]" \
 			"--no-index[Don't reindex search database]" \
@@ -229,10 +250,8 @@
 		_arguments -A "-*" \
 			'-n[Dry run]' \
 			'-v[Verbose]' \
-			"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]" \
-			"(--deny-new-be)--require-new-be[Force a new BE to be created]" \
 			'--tagged[Revert all tagged files]:tag:' \
-			'--be-name[Specify a BE name]:name:' \
+			$be_opts \
 			"--no-refresh[Don't refresh catalogs]" \
 			"--no-index[Don't reindex search database]" \
 			'*:file:_path_files'
@@ -274,9 +293,7 @@
 			'-g[Specify additional source of packages]:source:_path_files -/' \
 			'--accept[Accept all licenses]' \
 			'--licenses[Display all licenses]' \
-			"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]" \
-			"(--deny-new-be)--require-new-be[Force a new BE to be created]" \
-			'--be-name[Specify a BE name]:name:' \
+			$be_opts \
 			"*:variant:_values -s , 'variant' $(pkg -R $pkg5_root variant -H | awk '{print $1}')" \
 		;;
 
@@ -288,9 +305,7 @@
 			'-g[Specify additional source of packages]:source:_path_files -/' \
 			'--accept[Accept all licenses]' \
 			'--licenses[Display all licenses]' \
-			"(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]" \
-			"(--deny-new-be)--require-new-be[Force a new BE to be created]" \
-			'--be-name[Specify a BE name]:name:' \
+			$be_opts \
 			"*:facet:_values -s , 'facet' $(pkg -R $pkg5_root facet -H | awk '{print $1}')" \
 		;;
 
@@ -318,31 +333,31 @@
 
 	("set-property")
 		_arguments -A "-*" \
-			':property:_pkg5_properties' \
+			':property:_values "property" $image_properties' \
 			':value:'
 		;;
 
 	("add-property-value")
 		_arguments -A "-*" \
-			':property:_pkg5_properties' \
+			':property:_values "property" $image_properties' \
 			':value:'
 		;;
 
 	("remove-property-value")
 		_arguments -A "-*" \
-			':property:_pkg5_properties' \
+			':property:(${image_properties%%\:*})' \
 			':value:'
 		;;
 
 	("unset-property")
 		_arguments -A "-*" \
-			'*:property:_pkg5_properties'
+			'*:property:(${image_properties%%\:*})'
 		;;
 
 	("property")
 		_arguments -A "-*" \
 			'-H[Omit headers]' \
-			'*:property:_pkg5_properties'
+			'*:property:(${image_properties%%\:*})'
 		;;
 
 	("set-publisher")
@@ -361,6 +376,13 @@
 			'--non-sticky[Make this publisher non-sticky]' \
 			'--search-after[Set publisher search-order]:publisher:_pkg5_pubs' \
 			'--search-before[Set publisher search-order]:publisher:_pkg5_pubs' \
+			'--approve-ca-cert[Add trusted CA certificate]:CA cert path:_path_files' \
+			'--revoke-ca-cert[Revoke CA certificate]:CA cert hash:(${${certs#/etc/openssl/certs/}%.0})' \
+			'--unset-ca-cert[Remove trusted CA certificate]:CA cert hash:' \
+			'--set-property[Set publisher property]:property:_values "property" $publisher_properties' \
+			'--unset-property[Remove publisher property]:property:(${publisher_properties%%\:*})' \
+			'--add-property-value[Add publisher property value]:property:_values "property" $publisher_properties' \
+			'--remove-property-value[Remove publisher property value]:property:(${publisher_properties%%\:*})' \
 			':publisher:_pkg5_pubs'
 		;;
 
@@ -392,6 +414,12 @@
 			'-t[Time range]'
 		;;
 
+	("freeze"|"unfreeze")
+		;;
+
+	("mediator"|"set-mediator"|"unset-mediator")
+		;;
+
 	(*)
 		_message "unknown pkg subcommand: $service" ;;
 
--- a/components/zsh/Completion/Solaris/Command/_zoneadm	Fri Sep 02 06:01:11 2011 -0700
+++ b/components/zsh/Completion/Solaris/Command/_zoneadm	Wed Aug 31 15:30:47 2011 -0700
@@ -13,7 +13,8 @@
 	local context state line expl
 	typeset -A opt_args
 	local -a subcmds fields
-	local -a ipkg_attach ipkg_install
+	local -a solaris_attach solaris_install
+	local -a solaris10_attach solaris10_install
 	local brand brand_args
 
 	subcmds=(
@@ -21,11 +22,11 @@
 		ready reboot uninstall verify
 	)
 
-	ipkg_attach=(
+	solaris_attach=(
 		'(-d)-a[Path to archive]:path:_path_files'
 		'(-a)-d[Path to zonepath]:directory:_path_files -/'
 	)
-	ipkg_install=(
+	solaris_install=(
 		- set1
 		'-c[Path to certificate]:path:_path_files'
 		'*-e[Additional package]:package:'
--- a/components/zsh/Completion/Solaris/Type/_svcs_fmri	Fri Sep 02 06:01:11 2011 -0700
+++ b/components/zsh/Completion/Solaris/Type/_svcs_fmri	Wed Aug 31 15:30:47 2011 -0700
@@ -33,7 +33,7 @@
 
 		# Go through the remaining elements and remove the characters
 		# in front of $PREFIX.
-		for ((i = 1; i < $#fmri_abbrevs; i++ )); do
+		for ((i = 1; i <= $#fmri_abbrevs; i++ )); do
 			# Either one of these will work, but they're too
 			# greedy, preventing multiple matches below.
 			fmri_abbrevs[i]=${${fmri_abbrevs[i]}/((#s)|*[\/:])(#b)($PREFIX*)/$match[1]}
--- a/components/zsh/zsh.p5m	Fri Sep 02 06:01:11 2011 -0700
+++ b/components/zsh/zsh.p5m	Wed Aug 31 15:30:47 2011 -0700
@@ -70,7 +70,7 @@
 dir path=usr/share/zsh/$(COMPONENT_VERSION)/functions/Zle
 dir path=usr/share/zsh/$(COMPONENT_VERSION)/scripts
 dir path=usr/share/zsh/site-functions
-file path=etc/zshrc mode=0644 preserve=true
+file path=etc/zshrc mode=0644 overlay=allow preserve=true
 file path=usr/bin/zsh-$(COMPONENT_VERSION)
 file path=usr/lib/zsh/$(COMPONENT_VERSION)/zsh/cap.so
 file path=usr/lib/zsh/$(COMPONENT_VERSION)/zsh/clone.so