- Apply upstream ~username completion fix for #628130.
- Apply upstream rpm completion improvements for #630328. - Apply upstream IPv6 address completion fix for #630658. - Drop some completions that are included in respective upstream packages. - Fix qdbus/dcop uninstall trigger.
This commit is contained in:
parent
a9d71764b0
commit
c506b646c8
14
bash-completion-1.2-known_hosts-ipv6-630658.patch
Normal file
14
bash-completion-1.2-known_hosts-ipv6-630658.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/bash_completion b/bash_completion
|
||||
index f7e1a28..98f35ca 100644
|
||||
--- a/bash_completion
|
||||
+++ b/bash_completion
|
||||
@@ -1298,8 +1298,7 @@ _known_hosts_real()
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
|
||||
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
|
||||
gsub(" .*$", "", $i); \
|
||||
- gsub("[\\[\\]]", "", $i); \
|
||||
- gsub(":[0-9]+$", "", $i); \
|
||||
+ sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
|
||||
if ($i ~ /'"$awkcur"'/) {print $i} \
|
||||
}}' "${kh[@]}" 2>/dev/null ) )
|
||||
fi
|
78
bash-completion-1.2-rpm-630328.patch
Normal file
78
bash-completion-1.2-rpm-630328.patch
Normal file
@ -0,0 +1,78 @@
|
||||
diff --git a/contrib/rpm b/contrib/rpm
|
||||
index 20f9852..d268cab 100644
|
||||
--- a/contrib/rpm
|
||||
+++ b/contrib/rpm
|
||||
@@ -142,7 +142,7 @@ _rpm()
|
||||
-- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
- --define|-D)
|
||||
+ --define|-D|--fileid|--hdrid|--pkgid)
|
||||
# argument required but no completions available
|
||||
return 0
|
||||
;;
|
||||
@@ -180,12 +180,11 @@ _rpm()
|
||||
# options common to all query types
|
||||
opts="$opts --changelog --configfiles --conflicts --docfiles
|
||||
--dump --enhances --filesbypkg --filecaps --fileclass
|
||||
- --filecolor --fileprovide --filerequire --filesbypkg
|
||||
- --info --list --obsoletes --pipe --provides
|
||||
- --queryformat --rcfile --requires --scripts --suggests
|
||||
- --triggeredby --triggers --whatprovides --whatrequires --xml"
|
||||
+ --filecolor --fileprovide --filerequire --filesbypkg --info
|
||||
+ --list --obsoletes --pipe --provides --queryformat --rcfile
|
||||
+ --requires --scripts --suggests --triggers --xml"
|
||||
|
||||
- if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
|
||||
+ if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
|
||||
# -qf completion
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
|
||||
@@ -193,23 +192,26 @@ _rpm()
|
||||
else
|
||||
_filedir
|
||||
fi
|
||||
- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
|
||||
+ elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
|
||||
# -qg completion
|
||||
_rpm_groups
|
||||
- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
|
||||
+ elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
|
||||
# -qp; uninstalled package completion
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \
|
||||
- --httpport --httpproxy" -- "$cur" ) )
|
||||
+ --httpport --httpproxy --nomanifest" -- "$cur" ) )
|
||||
else
|
||||
_filedir 'rpm'
|
||||
fi
|
||||
else
|
||||
# -q; installed package completion
|
||||
if [[ "$cur" == -* ]]; then
|
||||
- COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \
|
||||
- --last --root --state" -- "$cur" ) )
|
||||
- elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
|
||||
+ COMPREPLY=( $( compgen -W "$opts --all --file --fileid
|
||||
+ --dbpath --fscontext --ftswalk --group --hdrid --last
|
||||
+ --package --pkgid --root --specfile --state
|
||||
+ --triggeredby --whatprovides --whatrequires" \
|
||||
+ -- "$cur" ) )
|
||||
+ elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then
|
||||
_rpm_installed_packages "$nodig" "$nosig"
|
||||
fi
|
||||
fi
|
||||
@@ -229,11 +231,11 @@ _rpm()
|
||||
--nofiles --noscripts --nomd5 --querytags --specfile \
|
||||
--whatrequires --whatprovides" -- "$cur" ) )
|
||||
# check whether we're doing file completion
|
||||
- elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
|
||||
+ elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
|
||||
_filedir
|
||||
- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
|
||||
+ elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then
|
||||
_rpm_groups
|
||||
- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
|
||||
+ elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then
|
||||
_filedir 'rpm'
|
||||
else
|
||||
_rpm_installed_packages "$nodig" "$nosig"
|
117
bash-completion-1.2-tilde-username-628130.patch
Normal file
117
bash-completion-1.2-tilde-username-628130.patch
Normal file
@ -0,0 +1,117 @@
|
||||
diff --git a/bash_completion b/bash_completion
|
||||
index 53eea33..e1e926b 100644
|
||||
--- a/bash_completion
|
||||
+++ b/bash_completion
|
||||
@@ -618,7 +618,7 @@ _filedir()
|
||||
{
|
||||
local i IFS=$'\t\n' xspec
|
||||
|
||||
- __expand_tilde_by_ref cur
|
||||
+ _tilde "$cur" || return 0
|
||||
|
||||
local -a toks
|
||||
local quoted tmp
|
||||
@@ -803,7 +803,26 @@ _available_interfaces()
|
||||
}
|
||||
|
||||
|
||||
+# Perform tilde (~) completion
|
||||
+# @return True (0) if completion needs further processing,
|
||||
+# False (> 0) if tilde is followed by a valid username, completions
|
||||
+# are put in COMPREPLY and no further processing is necessary.
|
||||
+_tilde() {
|
||||
+ local result=0
|
||||
+ # Does $1 start with tilde (~) and doesn't contain slash (/)?
|
||||
+ if [[ ${1:0:1} == "~" && $1 == ${1//\/} ]]; then
|
||||
+ # Try generate username completions
|
||||
+ COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
|
||||
+ result=${#COMPREPLY[@]}
|
||||
+ fi
|
||||
+ return $result
|
||||
+}
|
||||
+
|
||||
+
|
||||
# Expand variable starting with tilde (~)
|
||||
+# We want to expand ~foo/... to /home/foo/... to avoid problems when
|
||||
+# word-to-complete starting with a tilde is fed to commands and ending up
|
||||
+# quoted instead of expanded.
|
||||
# Only the first portion of the variable from the tilde up to the first slash
|
||||
# (~../) is expanded. The remainder of the variable, containing for example
|
||||
# a dollar sign variable ($) or asterisk (*) is not expanded.
|
||||
diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp
|
||||
index 171f6e1..fa47f85 100644
|
||||
--- a/test/lib/completions/ls.exp
|
||||
+++ b/test/lib/completions/ls.exp
|
||||
@@ -19,4 +19,15 @@ if {[assert_exec {ls --help} "" "" "unsupported"]} {
|
||||
sync_after_int
|
||||
|
||||
|
||||
+set test "~part should complete to ~full"
|
||||
+assert_bash_exec {compgen -u} {} /@ users
|
||||
+find_unique_completion_pair $users part full
|
||||
+# If home directory exists, append slash "/", else space " "
|
||||
+set trail [expr {[llength [glob -nocomplain ~$full]] ? "/" : " "}]
|
||||
+assert_complete "~$full$trail" "ls ~$part" $test
|
||||
+
|
||||
+
|
||||
+sync_after_int
|
||||
+
|
||||
+
|
||||
teardown
|
||||
diff --git a/test/unit/_tilde.exp b/test/unit/_tilde.exp
|
||||
new file mode 100644
|
||||
index 0000000..54394cb
|
||||
--- /dev/null
|
||||
+++ b/test/unit/_tilde.exp
|
||||
@@ -0,0 +1,51 @@
|
||||
+# @param string $part Reference to variable to hold partial unique username
|
||||
+# @param string $full Reference to variable to hold full unique username
|
||||
+proc setup {part full} {
|
||||
+ upvar $part _part
|
||||
+ upvar $full _full
|
||||
+
|
||||
+ assert_bash_exec {compgen -u} {} /@ users
|
||||
+ find_unique_completion_pair $users _part _full
|
||||
+ save_env
|
||||
+}
|
||||
+
|
||||
+
|
||||
+proc teardown {} {
|
||||
+ assert_env_unmodified {
|
||||
+ /COMPREPLY=/d
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+setup part full
|
||||
+
|
||||
+
|
||||
+set test "function should run without errors"
|
||||
+assert_bash_exec {_tilde > /dev/null} $test
|
||||
+
|
||||
+
|
||||
+sync_after_int
|
||||
+
|
||||
+
|
||||
+set test "function should not pollute environment"
|
||||
+# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown()
|
||||
+assert_bash_exec {foo() { local aa="~"; _tilde "$aa"; }; foo; unset foo} $test
|
||||
+
|
||||
+
|
||||
+sync_after_int
|
||||
+
|
||||
+
|
||||
+set test "~full should complete to ~full unmodified"
|
||||
+set cmd [format {_tilde "~%s"; printf "%%s" "${COMPREPLY[@]}"} $full]
|
||||
+assert_bash_list "~$full" $cmd $test
|
||||
+
|
||||
+
|
||||
+sync_after_int
|
||||
+
|
||||
+
|
||||
+set test "~part should complete to ~full"
|
||||
+set cmd [format {_tilde "~%s"; printf "%%s" "${COMPREPLY[@]}"} $part]
|
||||
+assert_bash_list "~$full" $cmd $test
|
||||
+
|
||||
+
|
||||
+teardown
|
@ -3,7 +3,7 @@
|
||||
|
||||
Name: bash-completion
|
||||
Version: 1.2
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Epoch: 1
|
||||
Summary: Programmable completion for Bash
|
||||
|
||||
@ -14,6 +14,12 @@ Source0: http://bash-completion.alioth.debian.org/files/%{name}-%{version
|
||||
Source1: %{name}-plague-client
|
||||
# From upstream post-1.2 git
|
||||
Patch0: %{name}-1.2-init.d.patch
|
||||
# From upstream post-1.2 git, #628130
|
||||
Patch1: %{name}-1.2-tilde-username-628130.patch
|
||||
# From upstream post-1.2 git, #630328
|
||||
Patch2: %{name}-1.2-rpm-630328.patch
|
||||
# From upstream post-1.2 git, #630658
|
||||
Patch3: %{name}-1.2-known_hosts-ipv6-630658.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildArch: noarch
|
||||
@ -34,15 +40,20 @@ of the programmable completion feature of bash.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
install -pm 644 %{SOURCE1} contrib/plague-client
|
||||
|
||||
# Updated completions shipped upstream:
|
||||
rm contrib/cowsay
|
||||
# mock too, but only in >= 1.1.1
|
||||
# modules too, but only in >= 3.2.7
|
||||
# subversion too, but only in >= 1.6.5-2
|
||||
# yum-utils too, but only in >= 1.1.24
|
||||
# yum too, but only in >= 3.2.25-2
|
||||
rm contrib/_modules # environment-modules >= 3.2.7
|
||||
%if 0%{?fedora} || 0%{?rhel} > 5
|
||||
rm contrib/_mock # mock >= 1.1.1
|
||||
rm contrib/_subversion # subversion >= 1.6.5-2
|
||||
rm contrib/_yum-utils # yum-utils >= 1.1.24
|
||||
rm contrib/_yum # yum >= 3.2.25-2
|
||||
%endif
|
||||
|
||||
# Combine to per-package files to work around #585384:
|
||||
cd contrib
|
||||
@ -208,6 +219,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%bashcomp_trigger minicom
|
||||
%bashcomp_trigger mkinitrd
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} < 6
|
||||
%triggerin -- mock
|
||||
if [ -e %{_sysconfdir}/bash_completion.d/mock.bash ] ; then
|
||||
# Upstream completion in mock >= 1.1.1
|
||||
@ -217,16 +229,7 @@ elif [ ! -e %{_sysconfdir}/bash_completion.d/_mock ] ; then
|
||||
fi
|
||||
%triggerun -- mock
|
||||
[ $2 -gt 0 ] || rm -f %{_sysconfdir}/bash_completion.d/_mock || :
|
||||
|
||||
%triggerin -- environment-modules
|
||||
if [ -e %{_datadir}/Modules/init/bash_completion ] ; then
|
||||
# Upstream completion in environment-modules >= 3.2.7
|
||||
rm -f %{_sysconfdir}/bash_completion.d/_modules || :
|
||||
elif [ ! -e %{_sysconfdir}/bash_completion.d/_modules ] ; then
|
||||
ln -s %{_datadir}/%{name}/_modules %{_sysconfdir}/bash_completion.d || :
|
||||
fi
|
||||
%triggerun -- environment-modules
|
||||
[ $2 -gt 0 ] || rm -f %{_sysconfdir}/bash_completion.d/_modules || :
|
||||
%endif
|
||||
|
||||
%bashcomp_trigger monodevelop
|
||||
%bashcomp_trigger mplayer
|
||||
@ -251,7 +254,14 @@ fi
|
||||
%bashcomp_trigger povray
|
||||
%bashcomp_trigger procps
|
||||
%bashcomp_trigger python
|
||||
%bashcomp_trigger qdbus qt,kdelibs3
|
||||
|
||||
%triggerin -- qt,kdelibs3,kdelibs
|
||||
[ -e %{_sysconfdir}/bash_completion.d/qdbus ] || \
|
||||
ln -s %{_datadir}/%{name}/qdbus %{_sysconfdir}/bash_completion.d || :
|
||||
%triggerpostun -- qt,kdelibs3,kdelibs
|
||||
[ $2 -gt 0 ] || [ -x %{_bindir}/dcop ] || [ -x %{_bindir}/qdbus ] || \
|
||||
rm -f %{_sysconfdir}/bash_completion.d/qdbus || :
|
||||
|
||||
%bashcomp_trigger qemu
|
||||
%bashcomp_trigger quota-tools quota
|
||||
%bashcomp_trigger rcs
|
||||
@ -274,6 +284,7 @@ fi
|
||||
%bashcomp_trigger sshfs fuse-sshfs
|
||||
%bashcomp_trigger strace
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} < 6
|
||||
%triggerin -- subversion
|
||||
if [ -e %{_sysconfdir}/bash_completion.d/subversion ] ; then
|
||||
# Upstream completion in subversion >= 1.6.5-2
|
||||
@ -283,6 +294,7 @@ elif [ ! -e %{_sysconfdir}/bash_completion.d/_subversion ] ; then
|
||||
fi
|
||||
%triggerun -- subversion
|
||||
[ $2 -gt 0 ] || rm -f %{_sysconfdir}/bash_completion.d/_subversion || :
|
||||
%endif
|
||||
|
||||
%bashcomp_trigger svk perl-SVK
|
||||
%bashcomp_trigger tar
|
||||
@ -306,6 +318,7 @@ fi
|
||||
%bashcomp_trigger xz
|
||||
%bashcomp_trigger yp-tools
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} < 6
|
||||
%triggerin -- yum
|
||||
if [ -e %{_sysconfdir}/bash_completion.d/yum.bash ] ; then
|
||||
# Upstream completion in yum >= 3.2.25-2
|
||||
@ -325,6 +338,7 @@ elif [ ! -e %{_sysconfdir}/bash_completion.d/_yum-utils ] ; then
|
||||
fi
|
||||
%triggerun -- yum-utils
|
||||
[ $2 -gt 0 ] || rm -f %{_sysconfdir}/bash_completion.d/_yum-utils || :
|
||||
%endif
|
||||
|
||||
%bashcomp_trigger yum-arch
|
||||
|
||||
@ -349,6 +363,13 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Sep 28 2010 Ville Skyttä <ville.skytta@iki.fi> - 1:1.2-3
|
||||
- Apply upstream ~username completion fix for #628130.
|
||||
- Apply upstream rpm completion improvements for #630328.
|
||||
- Apply upstream IPv6 address completion fix for #630658.
|
||||
- Drop some completions that are included in respective upstream packages.
|
||||
- Fix qdbus/dcop uninstall trigger.
|
||||
|
||||
* Mon Jun 28 2010 Ville Skyttä <ville.skytta@iki.fi> - 1:1.2-2
|
||||
- Apply upstream post 1.2 /etc/init.d/* completion improvements to fix #608351.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user