Accepting request 246763 from shells

- Update to version 5.0.6
  * See included ChangeLog
- Remove zsh-update-zypper-completion.patch, fixed upstream

OBS-URL: https://build.opensuse.org/request/show/246763
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/zsh?expand=0&rev=59
This commit is contained in:
Stephan Kulow 2014-08-31 07:58:42 +00:00 committed by Git OBS Bridge
commit 9107179e04
5 changed files with 11 additions and 224 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6624d2fb6c8fa4e044d2b009f86ed1617fe8583c83acfceba7ec82826cfa8eaf
size 3104375

3
zsh-5.0.6.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84ca509b141533a3b695e314fbce1200b86ff337ab7dd9e3414da05d86378845
size 3174858

View File

@ -1,214 +0,0 @@
Index: zsh-5.0.5/Completion/openSUSE/Command/_zypper
===================================================================
--- zsh-5.0.5.orig/Completion/openSUSE/Command/_zypper
+++ zsh-5.0.5/Completion/openSUSE/Command/_zypper
@@ -1,6 +1,7 @@
#compdef zypper
#
# Copyright (C) 2009 Holger Macht <holger@homac.de>
+# Copyright (C) 2014 Thomas Mitterfellner <thomas.mitterfellner@gmail.com>
#
# This file is released under the GPLv2.
#
@@ -9,60 +10,169 @@
# Toggle verbose completions: zstyle ':completion:*:zypper:*' verbose no
# zstyle ':completion:*:zypper-subcommand:*' verbose no
#
-# version 0.1
+# version 0.3
#
# Main dispatcher
+function _zypper_caching_policy () {
+ # rebuild if zsh's cache is older than zypper's
+ if test /var/cache/zypp/raw -nt "$1"; then
+ return 0
+ else
+ return 1
+ fi
+}
+
_zypper() {
+ typeset -A opt_args
+ local context curcontext="$curcontext" state line
+
if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then
# Remember the subcommand name
- local cmd=${words[2]}
+ local cmd=${words[2]}
# Set the context for the subcommand.
- curcontext="${curcontext%:*:*}:zypper-subcommand"
+ curcontext="${curcontext%:*:*}:zypper-subcommand"
# Narrow the range of words we are looking at to exclude `zypper'
- (( CURRENT-- ))
- shift words
-
- _zypper_cmd_do $cmd
+ (( CURRENT-- ))
+ shift words
+
+ _zypper_cmd_do $cmd
else
- local hline
- local -a cmdlist
- local tag=0
- _call_program help-commands LANG=C zypper help | sed -e ':a;N;$!ba;s/\n\t\t\t\t/ /g' | while read -A hline; do
- # start parsing with "Global Options:"
- [[ $hline =~ "^Global Options:" ]] && tag=1
- [[ $tag = 0 ]] && continue
- # all commands have to start with lower case letters
- [[ $hline[1] =~ ^[A-Z] ]] && continue
- (( ${#hline} < 2 )) && continue
-
- # cut comma at end of command
- hline[1]=`echo $hline[1] | sed -e 's/\(^.*\),/\1/'`
-
- # ${hline[1]%,} truncates the last ','
- cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
- done
- _describe -t zypper-commands 'zypper command' cmdlist
+ local hline
+ local -a cmdlist
+ local tag=0
+ _call_program help-commands LANG=C zypper help | sed -e ':a;N;$!ba;s/\n\t\t\t\t/ /g' | while read -A hline; do
+ # start parsing with "Global Options:"
+ [[ $hline =~ "^Global Options:" ]] && tag=1
+ [[ $tag = 0 ]] && continue
+ # all commands have to start with lower case letters
+ [[ $hline[1] =~ ^[A-Z] ]] && continue
+ (( ${#hline} < 2 )) && continue
+
+ # cut comma at end of command
+ hline[1]=`echo $hline[1] | sed -e 's/\(^.*\),/\1/'`
+
+ # ${hline[1]%,} truncates the last ','
+ cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+ done
+ _describe -t zypper-commands 'zypper command' cmdlist
fi
}
+_all_repos() {
+ local -a repos
+ repos=( $(zypper -q lr | tail -n +3 | cut -d'|' -f 2) )
+ _describe -t repos 'Available repositories' repos && return
+}
+
+_enabled_repos() {
+ repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) )
+ _describe -t repos 'Available repositories' repos && return
+}
+
+_disabled_repos() {
+ repos=( $(zypper -x lr | grep 'enabled="0"' | cut -d\" -f 2) )
+ _describe -t repos 'Available repositories' repos && return
+}
+
_zypper_cmd_do() {
+ typeset -A opt_args
+ local context state line
local hline
local -a cmdlist
local tag=0
+ local curcontext="$curcontext"
+
+ zstyle ":completion:${curcontext}:" use-cache on
+ zstyle ":completion:${curcontext}:" cache-policy _zypper_caching_policy
+
_call_program help-commands LANG=C zypper help $cmd | while read -A hline; do
- # start parsing from "Options:"
- [[ $hline =~ "^Command options:" ]] && tag=1
- [[ $tag = 0 ]] && continue
- # Option has to start with a '-'
- [[ $hline[1] =~ ^- ]] || continue
- (( ${#hline} < 2 )) && continue
+ # start parsing from "Options:"
+ [[ $hline =~ "^Command options:" ]] && tag=1
+ [[ $tag = 0 ]] && continue
+ # Option has to start with a '-'
+ [[ $hline[1] =~ ^- ]] || continue
+ (( ${#hline} < 2 )) && continue
- cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+ cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
done
if [ -n "$cmdlist" ]; then
+ local -a repos
+
+ # special completion lists for certain options (mainly repos)
+ case ${words[CURRENT - 1]} in
+ --from)
+ repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) )
+ _describe -t repos 'Available repositories' repos && return
+ ;;
+ (--enable|-e)
+ case $cmd in
+ (mr|modifyrepo)
+ _disabled_repos && return
+ ;;
+ esac
+ ;;
+ (--disable|-d)
+ case $cmd in
+ (mr|modifyrepo)
+ _enabled_repos && return
+ ;;
+ esac
+ ;;
+ (--type|-t)
+ local -a types
+ case $cmd in
+ (if|info|se|search|in|install)
+ types=( pattern srcpackage package patch )
+ _describe -t types 'Package types' types && return
+ ;;
+ esac
+ ;;
+ esac
+
+ # all options available for the active main command
_describe -t zypper-commands 'zypper command' cmdlist
+
+ case $cmd in
+ (lr|repos)
+ _all_repos
+ ;;
+ (in|install)
+ local expl
+ _description files expl 'RPM files'
+ _files "$expl[@]" -g '*.(#i)rpm(.)'
+ ;;
+ esac
+
+ # only suggest packages if at least one character is given
+ if [[ ${words[CURRENT]} =~ "^[0-9a-zA-Z]" ]] ; then
+ local -a pkglist
+
+ if ( [[ ${+_zypp_all_raw} -eq 0 ]] || _cache_invalid ZYPPER_ALL_RAW ) && ! _retrieve_cache ZYPPER_ALL_RAW;
+ then
+ _zypp_all_raw=$(zypper -x -q se | grep '<solvable' | cut -d \" -f 2,4)
+ _zypp_all=( $(echo $_zypp_all_raw | grep 'installed' | cut -d\" -f 2) )
+ _zypp_not_installed=( $(echo $_zypp_all_raw | grep 'not-installed' | cut -d\" -f 2 ) )
+ _zypp_installed=( $(echo $_zypp_all_raw | grep '^installed' | cut -d\" -f 2 ) )
+ _store_cache ZYPPER_ALL_RAW _zypp_all_raw _zypp_all _zypp_not_installed _zypp_installed
+ fi
+
+ case $cmd in
+ (in|install)
+ pkglist=( $_zypp_not_installed )
+ compadd $pkglist && return
+ ;;
+ (rm|remove|up|update)
+ pkglist=( $_zypp_installed )
+ compadd $pkglist && return
+ ;;
+ (if|info|se|search)
+ pkglist=( $_zypp_all )
+ compadd $pkglist && return
+ ;;
+ esac
+ fi
else
_complete
fi

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 28 19:14:23 UTC 2014 - idonmez@suse.com
- Update to version 5.0.6
* See included ChangeLog
- Remove zsh-update-zypper-completion.patch, fixed upstream
-------------------------------------------------------------------
Wed Aug 6 12:45:57 UTC 2014 - idonmez@suse.com

View File

@ -17,7 +17,7 @@
Name: zsh
Version: 5.0.5
Version: 5.0.6
Release: 0
Summary: Shell with comprehensive completion
License: MIT
@ -37,7 +37,6 @@ Source16: dotzshrc.rh
Source17: zshprompt.pl
%endif
Patch1: trim-unneeded-completions.patch
Patch2: zsh-update-zypper-completion.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
Requires(pre): %{install_info_prereq}
@ -95,7 +94,6 @@ This package contains the Zsh manual in html format.
%setup -q -n %{name}-%{version}
%if 0%{?suse_version}
%patch1 -p1
%patch2 -p1
%endif
# Remove executable bit
@ -137,10 +135,6 @@ mv Doc/*.html Doc/htmldoc
# remove some unwanted files in Etc/
rm -f Etc/Makefile* Etc/*.yo
# FATE#316521
mv Completion/openSUSE/Command/_SuSEconfig Completion/openSUSE/Command/_SUSEconfig
sed -i s,_SuSEconfig,_SUSEconfig, Completion/openSUSE/Command/.distfiles
%install
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
rm -rf %{buildroot}