[csw-devel] SF.net SVN: gar:[21477] csw/mgar/pkg/bash_completion/trunk

chninkel at users.sourceforge.net chninkel at users.sourceforge.net
Wed Jul 10 15:07:15 CEST 2013


Revision: 21477
          http://gar.svn.sourceforge.net/gar/?rev=21477&view=rev
Author:   chninkel
Date:     2013-07-10 13:07:15 +0000 (Wed, 10 Jul 2013)
Log Message:
-----------
bash_completion/trunk: dropped pkgutil, pkgadd, pkgrm and svcadm completions that were merged upstream.

Modified Paths:
--------------
    csw/mgar/pkg/bash_completion/trunk/Makefile
    csw/mgar/pkg/bash_completion/trunk/files/changelog.CSW

Removed Paths:
-------------
    csw/mgar/pkg/bash_completion/trunk/files/pkg-get.completion
    csw/mgar/pkg/bash_completion/trunk/files/pkgadd.completion
    csw/mgar/pkg/bash_completion/trunk/files/pkgrm.completion
    csw/mgar/pkg/bash_completion/trunk/files/pkgutil.completion
    csw/mgar/pkg/bash_completion/trunk/files/svcadm.completion

Modified: csw/mgar/pkg/bash_completion/trunk/Makefile
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/Makefile	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/Makefile	2013-07-10 13:07:15 UTC (rev 21477)
@@ -58,9 +58,6 @@
 DISTNAME  = $(shell echo $(NAME) | tr '_' '-')-$(VERSION)
 
 DISTFILES  = $(DISTNAME).tar.gz
-# we automatically include all 
-DISTFILES += $(shell cd files; for FILE in *.completion; do echo $$FILE; done)
-
 DISTFILES += changelog.CSW
 
 # change the paths to use opencsw ones
@@ -76,16 +73,8 @@
 # no test script in bash_completion
 TEST_SCRIPTS =
 
-post-merge: merge-opencsw-completion merge-compatibility-link merge-additional-docs merge-changelog
+post-merge: merge-compatibility-link merge-additional-docs merge-changelog
 
-# we add some completion scripts for Solaris 
-merge-opencsw-completion:
-	@( for FILE in $(WORKDIR)/*.completion; do \
-	      NFILE="`basename $$FILE | sed -e 's/\.completion$$//'`"; \
-	      ginstall -D $$FILE $(PKGROOT)$(sharedstatedir)/bash-completion/completions/$$NFILE; \
-	done )
-	@$(MAKECOOKIE)	
-
 # to make sure we don't break completion loading for users of previous versions of this package
 merge-compatibility-link:
 	@(cd $(PKGROOT)$(prefix)/etc/ && ln -s profile.d/bash_completion.sh bash_completion)

Modified: csw/mgar/pkg/bash_completion/trunk/files/changelog.CSW
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/files/changelog.CSW	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/files/changelog.CSW	2013-07-10 13:07:15 UTC (rev 21477)
@@ -1,6 +1,8 @@
 bash_completion (2.1,REV=2013.07.10)
 
   * New upstream release.
+  * Dropped pkgutil, pkgadd, pkgrm and svcadm completions that
+    were merged upstream.
 
    -- Yann Rouillard <yann at opencsw.org>  Wed, 10 Jul 2013 14:35:54 +0200
 

Deleted: csw/mgar/pkg/bash_completion/trunk/files/pkg-get.completion
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/files/pkg-get.completion	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/files/pkg-get.completion	2013-07-10 13:07:15 UTC (rev 21477)
@@ -1,80 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at opencsw.org>
-# All rights reserved.  Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted.  This code is without warranty of any kind.  The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-# pkg-get.completion - bash completion for opencsw pkg-get
-#
-
-_have pkg-get && 
-_pkg-get_get_catalog_file()
-{
-	local url="$1"
-	local catalog_file i conffile
-
-	for file in /etc/opt/csw/pkg-get.conf /opt/csw/etc/pkg-get.conf /etc/pkg-get.conf; do
-		if [[ -f $file ]]; then
-			conffile="$file"
-			break
-		fi
-	done
-	conffile="${conffile:-/opt/csw/etc/pkg-get.conf}"
-
-	if [[ -z "$url" ]]; then
-		url=$(awk -F= ' $1=="url" { print $2 }' $conffile)
-	fi
-
-	catalog_file="${url##*//}"
-	catalog_file="${catalog_file%%/*}"
-	catalog_file="/var/pkg-get/catalog-$catalog_file"
-
-	echo "$catalog_file"
-} &&
-_pkg-get()
-{
-	local cur prev file catalog_file url command
-	COMPREPLY=()
-	cur="${COMP_WORDS[COMP_CWORD]}"
-	prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-	if [[ "${prev}" = "-s" ]]; then
-		return 1
-	fi
-
-	i=${#COMP_WORDS[*]} 
-	while [[ $i -gt 0 ]]; do
-		i=$((i-1))
-		if [[ "${COMP_WORDS[$i]}" = "-s" ]]; then
-			url="${COMP_WORDS[$((i+1))]}"
-		fi
-		if [[ "${COMP_WORDS[$i]}" == @(available|-a|describe|-D|download|-d|install|-i|list|updatecatalog|-U|upgrade|-u) ]]; then
-			command="${COMP_WORDS[$i]}"	
-		fi
-	done
-	
-	if [[ -n "$command" ]]; then
-		if [[ "$command" == @(describe|-D|download|-d|install|-i) ]]; then
-			catalog_file=$(_pkg-get_get_catalog_file "$url")
-			if [[ -f $catalog_file ]]; then
-				local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' $catalog_file)
-				COMPREPLY=( $(compgen -W "${packages_list}" -- ${cur}) )
-			fi
-		fi
-		return 0
-	fi
-
-	if [[ ${cur} == -* ]] ; then
-		local opts="-c -d -D -f -i -l -s -S -u -U -v"
-		COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
-		return 0
-	else
-		local commands="available describe download install list updatecatalog upgrade" 
-		COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
-		return 0
-	fi
-} &&
-complete -F _pkg-get pkg-get

Deleted: csw/mgar/pkg/bash_completion/trunk/files/pkgadd.completion
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/files/pkgadd.completion	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/files/pkgadd.completion	2013-07-10 13:07:15 UTC (rev 21477)
@@ -1,64 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at opencsw.org>
-# All rights reserved.  Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted.  This code is without warranty of any kind.  The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-
-_pkgadd ()
-{
-	local cur prev words cword 
-	_init_completion -n : || return
-
-	# if a device directory was given
-	# we must complete with the package
-	# available in this directory
-	local device=/var/spool/pkg;
-	local i=$cword
-	while [[ $((i--)) -gt 0 ]]; do
-		case "${words[$i]}" in
-		-d)
-			device="${words[$((i+1))]}";
-			break
-			;;
-		esac;
-	done;
-
-	case $prev in 
-	-d)
-		_filedir pkg
-		_filedir -d
-		;;
-	-a|-r|-V)
-		_filedir
-		;;
-	-k|-s|-R)
-		_filedir -d
-		;;
-	-P|-k|-x)
-		;;
-	*)	
-		if [[ ${cur} == -* ]] ; then
-			local opts="-a -A -d -k -n -M -P -r -R -s -v -V -x"
-			COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
-		else	
-			local pkginst_list
-			if [[ -d $device ]]; then	
-				for filedir in $(/bin/ls -1 $device); do
-					if [[ -d "$device/$filedir" ]] && [[ -f "$device/$filedir/pkginfo" ]]; then 
-						pkginst_list+=( ${pkginst_list[@]:-} "$filedir" )
-					fi
-				done
-				pkginst_list="${pkginst_list[@]}"
-			else
-				pkginst_list=$(strings $(dequote $device) | grep "^PKG=" | sort -u | cut -d= -f2)
-			fi
-			COMPREPLY=( $(compgen -W "$pkginst_list" -- ${cur}) )
-		fi
-	esac
-} &&
-complete -F _pkgadd pkgadd
-

Deleted: csw/mgar/pkg/bash_completion/trunk/files/pkgrm.completion
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/files/pkgrm.completion	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/files/pkgrm.completion	2013-07-10 13:07:15 UTC (rev 21477)
@@ -1,55 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at opencsw.org>
-# All rights reserved.  Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted.  This code is without warranty of any kind.  The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-
-_have pkgrm &&
-_pkgrm ()
-{
-    local cur prev words cword 
-    _init_completion || return
-
-    # if a spool directory was given
-    # we must complete with the package
-    # available in this directory
-    local spool=/var/sadm/pkg;
-    local i=$cword
-    while [[ $((i--)) -gt 0 ]]; do
-        i=$((i-1));
-        case "${words[$i]}" in
-            -s)
-                spool="${words[$((i+1))]}";
-                break
-            ;;
-        esac;
-    done;
-
-    case $prev in
-        -a | -V)
-            _filedir
-        ;;
-        -s | -R)
-            _filedir -d
-        ;;
-        -Y)
-
-        ;;
-        *)
-            if [[ ${cur} == -* ]]; then
-                local opts="-a -A -n -M -R -s -v -V -Y";
-                COMPREPLY=($(compgen -W "${opts}" -- ${cur}));
-                return 0;
-            else
-		COMPREPLY=($(compgen -W "$(/bin/ls -1 $spool)" -- ${cur}));
-                return 0;
-            fi
-        ;;
-    esac
-} &&
-complete -F _pkgrm pkgrm
-

Deleted: csw/mgar/pkg/bash_completion/trunk/files/pkgutil.completion
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/files/pkgutil.completion	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/files/pkgutil.completion	2013-07-10 13:07:15 UTC (rev 21477)
@@ -1,104 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at opencsw.org>
-# All rights reserved.  Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted.  This code is without warranty of any kind.  The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-# pkgutil.completion - bash completion for pkgutil
-#
-
-
-_pkgutil_url2catalog()
-{
-	local filename="$1"
-
-	filename="${filename##*://}"
-	filename="${filename//\//_}"
-	filename="/var/opt/csw/pkgutil/catalog.${filename}_$(uname -p)_$(uname -r)"
-
-	echo "$filename"
-}
-
-_pkgutil()
-{
-	local cur prev words cword 
-	_init_completion -n : || return
-
-	local command catalog_files configuration_files
-	declare -a configuration_files=("/opt/csw/etc/pkgutil.conf" "/etc/opt/csw/pkgutil.conf")
-	declare -a catalog_files=()
-
-	i=$cword
-	while [[ $((i--)) -gt 1 ]]; do
-		if [[ "${words[$i]}" = @(-t|--temp) ]]; then
-			local url="${words[$((i+1))]}"
-			local catalog=$(_pkgutil_url2catalog "$url")
-			catalog_files=("$catalog")
-		elif [[ "${words[$i]}" = @(--config) ]]; then
-			configuration_files=( "$(dequote ${words[$((i+1))]})" )
-		elif [[ "${words[$i]}" == @(-i|--install|-u|--upgrade|-r|--remove|-d|--download|-a|--available|-c|--compare|-U|--catalog|-S|--stream) ]]; then
-			command="${words[$i]}"	
-		fi
-	done
-
-	if [[ "$prev" = @(-W|--workdir|-P|--pkgdir|-R|--rootpath) ]]; then
-		_filedir -d
-		return 0
-	fi
-
-	if [[ "$prev" = @(-o|--output|--config) ]]; then
-		_filedir
-		return 0
-	fi
-
-	if [[ "$prev" = @(-p|--param) ]]; then
-		compopt -o nospace
-		COMPREPLY=( $(compgen -W "mirror: pkgaddopts: pkgrmopts: wgetopts: use_gpg: use_md5: pkgliststyle: maxpkglist: noncsw: stop_on_hook_soft_error: exclude_pattern: gpg_homedir: root_path: deptree_filter_common: show_current: catalog_not_cached: catalog_update:" -- $cur) )
-		return 0
-	fi
-
-	if [[ "$prev" = @(-T|--target) ]]; then
-		# Work-around bash_completion issue where bash interprets a colon
-		# as a separator, borrowed from maven completion code which borrowed
-		# it from darcs completion code :)
-		local colonprefixes=${cur%"${cur##*:}"}
-		COMPREPLY=( $(compgen -W "sparc:5.9 sparc:5.10 sparc:5.11 i386:5.9 i386:5.10 i386:5.11" -- $cur) )
-		local i=${#COMPREPLY[*]}
-		while [ $((--i)) -ge 0 ]; do
-			COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}
-		done
-		return 0
-	fi
-
-	if [[ -n "$command" ]] && [[ ! "$cur" == -* ]]; then
-
-		local mirrors mirror_url
-		mirrors=$(awk -F= ' $1 ~ /^ *mirror *$/ { print $2 }' ${configuration_files[@]})
-		mirrors=${mirrors:-http://mirror.opencsw.org/opencsw/testing}
-		for mirror_url in $mirrors; do
-			local catalog=$(_pkgutil_url2catalog "$mirror_url")
-			catalog_files=( "${catalog_files[@]}" "$catalog" )
-		done
-
-		if [[ "$command" == @(--download|-d|--install|-i|--upgrade|-u|s|--stream) ]]; then
-			local packages_list=$(awk ' $0 ~ /BEGIN PGP SIGNATURE/ { exit } $1 ~ /^Hash:/ || $1 ~ /^ *(-|#|$)/ { next } { print $1 }' "${catalog_files[@]}")
-			COMPREPLY=( $(compgen -W "${packages_list}" -- $cur) )
-
-		elif [[ "$command" == @(-r|--remove) ]]; then
-			local packages_list=$(pkginfo | awk ' $2 ~ /^CSW/ { printf ("%s|",$2) }')
-			packages_list=${packages_list%|}
-			packages_list=$(nawk " \$3 ~ /^$packages_list\$/ { print \$1 }" "${catalog_files[@]}")
-			COMPREPLY=( $(compgen -W "${packages_list}" -- $cur) )
-		fi
-		return 0
-	fi
-
-	local commands="-i --install -u --upgrade -r --remove -d --download -U --catalog -a --available --describe -c --compare -C --compare-diff -A --compare-avail -e --email -t --temp -x --exclude -W --workdir -P --pkgdir -R --rootpath --config -y --yes -f --force -n --nomod -N --nodeps -D --debug --trace -h --help -v --version -V --syscheck -l --list -L --listfile -F --findfile --deptree --extract -s --stream -o --output -T --target --single -p --param --parse --cleanup --catinfo"
-	COMPREPLY=( $(compgen -W "${commands}" -- $cur) )
-	return 0
-} 
-
-complete -F _pkgutil pkgutil

Deleted: csw/mgar/pkg/bash_completion/trunk/files/svcadm.completion
===================================================================
--- csw/mgar/pkg/bash_completion/trunk/files/svcadm.completion	2013-07-10 13:05:52 UTC (rev 21476)
+++ csw/mgar/pkg/bash_completion/trunk/files/svcadm.completion	2013-07-10 13:07:15 UTC (rev 21477)
@@ -1,152 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at opencsw.org>
-# All rights reserved.  Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted.  This code is without warranty of any kind.  The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-
-
-# 
-# svcadm accept any complete FMRI or abreviated FMRI
-#  - a complete FMRI is svc:/foo/bar/bar/baz
-#  - abbreviated FMRI are foo/bar/bar/baz, bar/bar/baz, bar/baz or baz
-#
-# The goal of this function is to be able to propose all alternatives,
-# but to not clutter the interface with all completions, we will only
-# cut every completion alternative at the next slash.
-#
-# For exemple, if the user types <nothing><tab>, we will propose for svc://foo/bar/bar/baz
-# the following completion: foo/, bar/ and baz
-# If the user types <b><tab>, we will propose: bar/ and baz
-# If the user types <bar/><tab>, we will propose: bar/bar/ and bar/baz
-#
-# By default, the function proproses only abbreviated completions except if the user already
-# began to type svc:. In that case we will propose only the complete FMRI beginning with the
-# pattern
-#
-_smf_complete_fmri ()
-{
-	local cur="$1" prefix="$2"
-	local cur_prefix fmri fmri_list=""
-	local exact_mode pattern
-
-	if [[ "$cur" == $prefix* ]]; then
-		[[ "$cur" == $prefix ]] && cur+="/"
-		pattern="$cur*"
-		exact_mode=1
-	else
-		pattern="$prefix*/$cur*"
-	fi
-		
-	cur_prefix="${cur%"${cur##*/}"}"
-
-	for fmri in $(svcs -H -o FMRI "$pattern" 2>/dev/null); do
-
-		local fmri_part_list fmri_part
-
-		if [[ -z "$exact_mode" ]]; then
-
-			fmri=${fmri#$prefix/}
-
-			# we generate all possibles abbrevations for the FMRI
-			# no need to have a generic loop as we will have a finite
-			# number of components
-			local OIFS="$IFS"; IFS="/"; set -- $fmri; IFS="$OIFS"
-			case $# in
-				1) fmri_part_list=" $1";;
-				2) fmri_part_list=" $2 $1/$2";;
-				3) fmri_part_list=" $3 $2/$3 $1/$2/$3";;
-				4) fmri_part_list=" $4 $3/$4 $2/$3/$4 $1/$2/$3/$4";;
-			esac
-		else
-			fmri_part_list="$fmri"
-		fi
-
-		# Here we make sure the completions begins with the pattern and 
-		# we cut them at the first slash
-		for fmri_part in $fmri_part_list; do
-			[[ "$fmri_part" == $cur* ]] || continue
-			local first_part=${fmri_part#$cur_prefix}
-			first_part=$cur_prefix${first_part%%/*}
-			[[ "$first_part" != "$fmri_part" ]] && first_part+="/"
-			fmri_list+=" $first_part"
-		done
-	done
-
-	COMPREPLY=( $fmri_list )
-
-	# here we want to detect if there only one completion proposed and that
-	# it ends with a slash. That means the users will still have to complete
-	# after, so we gain him one tab keystroke by immediately proposing the
-	# next completion alternatives
-	local i=${#COMPREPLY[*]}
-	if [[ $i -gt 0 ]] && [[ "${COMPREPLY[$((--i))]}" == */ ]]; then
-		# we have to iterate throught the list as we may have duplicate
-		while [[ $i -ne 0 ]]; do
-			[[ "${COMPREPLY[$i]}" != "${COMPREPLY[$((i - 1))]}" ]] && break
-			((i--))
-		done
-		if [[ $i -eq 0 ]]; then
-			_smf_complete_fmri "${COMPREPLY[0]}" "$prefix"
-			return 0
-		fi
-	fi
-
-	# Work-around bash_completion issue where bash interprets a colon
-	# as a separator, borrowed from maven completion code which borrowed
-	# it from darcs completion code :)
-	local colonprefixes=${cur%"${cur##*:}"}
-	local i=${#COMPREPLY[*]}
-	while [ $((--i)) -ge 0 ]; do
-		COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}
-	done
-}
-
-_svcadm ()
-{
-	local cur prev words cword 
-	_init_completion -n : || return
-
-        local command_list="enable disable restart refresh clear mark milestone"
-        local command i
-
-	for (( i=1; i < $cword; i++ )); do
-                if [[ ${words[i]} == @(enable|disable|restart|refresh|clear|mark|milestone) ]]; then
-                        command=${words[i]}
-                fi
-        done
-
-        if [[ -z "$command" ]]; then
-                if [[ ${cur} == -* ]] ; then
-                        COMPREPLY=( $(compgen -W "-v" -- ${cur}) )
-                else
-                        COMPREPLY=( $(compgen -W "$command_list" -- ${cur}) )
-                fi
-        else
-		if [[ ${cur} == -* ]]; then
-			case "$command" in
-                        enable)
-				COMPREPLY=( $(compgen -W "-r -s -t" -- ${cur}) );;
-                        disable)
-				COMPREPLY=( $(compgen -W "-s -t" -- ${cur}) );;
-			mark)
-				COMPREPLY=( $(compgen -W "-I -t" -- ${cur}) );;
-			milestone)
-				COMPREPLY=( $(compgen -W "-d" -- ${cur}) );;
-			esac
-		else
-			if [[ "$command" == "mark" ]] && [[ "$prev" != @(degraded|maintenance) ]]; then
-				COMPREPLY=( $(compgen -W "degraded maintenance" -- ${cur}) )
-			elif [[ "$command" == "milestone" ]]; then
-				_smf_complete_fmri "${cur}" "svc:/milestone"
-			else
-				_smf_complete_fmri "${cur}" "svc:"
-                        fi
-                fi
-        fi
-} &&
-complete -F _svcadm svcadm
-

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list