Package init

This commit is contained in:
overweight 2019-09-30 10:32:16 -04:00
commit 6d41349609
11 changed files with 361 additions and 0 deletions

View File

@ -0,0 +1,24 @@
From 57b2c937c1fa8409a4416702cf5b8844233a5566 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sat, 17 Mar 2018 13:04:12 +0200
Subject: [PATCH 001/352] completions/Makefile: Fix check-local in VPATH builds
---
completions/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/completions/Makefile.am b/completions/Makefile.am
index e442a9e..30b190d 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -1000,6 +1000,6 @@ check-local:
ret=0
for file in $(bashcomp_DATA) ; do \
$${bashcomp_bash:-$${BASH:-bash}} \
- -O extglob -n $$file || ret=$$? ; \
+ -O extglob -n $(srcdir)/$$file || ret=$$? ; \
done ; \
exit $$ret
--
1.8.3.1

View File

@ -0,0 +1,26 @@
From 583562b9e56207bd428497ceb96df4e1f1f53158 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sun, 6 May 2018 21:41:48 +0200
Subject: [PATCH 056/352] __load_completion: Avoid bad array subscript on
"commands" ending with slash
Closes #209
---
bash_completion | 1 +
1 file changed, 1 insertion(+)
diff --git a/bash_completion b/bash_completion
index 9a9eae0..442c075 100644
--- a/bash_completion
+++ b/bash_completion
@@ -2019,6 +2019,7 @@ __load_completion()
{
local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions )
local OIFS=$IFS IFS=: dir cmd="${1##*/}" compfile
+ [[ -n $cmd ]] || return 1
for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
dirs+=( $dir/bash-completion/completions )
done
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From a47bd375bb0f95dc6d388d4097c420bddb72ae33 Mon Sep 17 00:00:00 2001
From: John Swinbank <john@swinbank.org>
Date: Wed, 9 May 2018 22:17:01 -0700
Subject: [PATCH 059/352] _xspecs: Declare as global on bash >= 4.2
By default, associative arrays are local. If bash_completion is sourced from within a function, they won't propagate to the caller, and the system is not initialized properly. By making this explicitly global, it propagates as expected. bash >= 4.2 only, because of declare -g support.
Closes #210
---
bash_completion | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/bash_completion b/bash_completion
index 442c075..3884850 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1891,7 +1891,13 @@ complete -F _longopt a2ps awk base64 bash bc bison cat chroot colordiff cp \
sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \
texindex touch tr uname unexpand uniq units vdir wc who
-declare -A _xspecs
+# declare only knows -g in bash >= 4.2.
+if [[ ${BASH_VERSINFO[0]} -gt 4 ||
+ ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -ge 2 ]]; then
+ declare -Ag _xspecs
+else
+ declare -A _xspecs
+fi
_filedir_xspec()
{
local cur prev words cword
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From ee6b37ad7ff5b309cbb9b886a871252abd9398fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Fri, 25 May 2018 17:38:59 +0200
Subject: [PATCH 069/352] completions/Makefile.am: Use install-data-hook, not
install-data-local
-hook is run after the main rule, while -local might end up before.
https://www.gnu.org/software/automake/manual/html_node/Extending.html#index-hook-targets
Closes #212
---
completions/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 0242c46..5419e9d 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -1013,8 +1013,8 @@ symlinks: $(targetdir) $(DATA)
all-local: targetdir = .
all-local: symlinks
-install-data-local: targetdir = $(DESTDIR)$(bashcompdir)
-install-data-local: symlinks
+install-data-hook: targetdir = $(DESTDIR)$(bashcompdir)
+install-data-hook: symlinks
check-local:
ret=0
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From 8d2c976c11e379f28430f1ae15be3764755dcffb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Thu, 25 Apr 2019 23:19:28 +0300
Subject: [PATCH 076/156] ssh: fix suboption completion with combined -*o
---
completions/ssh | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/completions/ssh b/completions/ssh
index 7bfae90..df2f865 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -168,7 +168,7 @@ _ssh_suboption_check()
{
# Get prev and cur words without splitting on =
local cureq=`_get_cword :=` preveq=`_get_pword :=`
- if [[ $cureq == *=* && $preveq == -o ]]; then
+ if [[ $cureq == *=* && $preveq == -*o ]]; then
_ssh_suboption $cureq "$1"
return $?
fi
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From e8ac021ed13e5b110b9e0701b29d6c9704d33461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Thu, 9 May 2019 01:49:33 +0700
Subject: [PATCH 137/156] badblocks: fix $i leak
---
completions/badblocks | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/completions/badblocks b/completions/badblocks
index a366338..221f42b 100644
--- a/completions/badblocks
+++ b/completions/badblocks
@@ -16,11 +16,8 @@
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
# Filter out -w (dangerous) and -X (internal use)
- for i in ${!COMPREPLY[@]}; do
- [[ ${COMPREPLY[i]} == -[wX] ]] && unset 'COMPREPLY[i]'
- done
+ COMPREPLY=( $(compgen -X -[wX] -W '$(_parse_usage "$1")' -- "$cur") )
return
fi
--
1.8.3.1

View File

@ -0,0 +1,33 @@
From b3a25cfe429b8c87d9194c2d9042349ba71979c9 Mon Sep 17 00:00:00 2001
From: Russell Davis <551404+russelldavis@users.noreply.github.com>
Date: Mon, 9 Jul 2018 00:58:25 -0700
Subject: [PATCH 313/352] man: Fix completion when failglob option is enabled
(#225)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Modified-by: Ville Skyttä <ville.skytta@iki.fi>
---
completions/man | 3 +++
1 file changed, 3 insertions(+)
diff --git a/completions/man b/completions/man
index d5fa50f..37af081 100644
--- a/completions/man
+++ b/completions/man
@@ -67,8 +67,11 @@ _man()
manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
fi
+ local IFS=$' \t\n' reset=$( shopt -p failglob ); shopt -u failglob
# redirect stderr for when path doesn't exist
COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
+ $reset
+
# weed out directory path names and paths to man pages
COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
# strip suffix from man pages
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From dd80f35279afd4f056dc191767b9869c9649d476 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Mon, 11 Mar 2019 21:26:24 +0200
Subject: [PATCH 352/352] _longopt: don't complete --no-* with file/dirname arg
Closes https://github.com/scop/bash-completion/pull/291
Thanks-to: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
---
bash_completion | 4 ++--
test/t/test_grep.py | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bash_completion b/bash_completion
index a2f0a74..d35858e 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1850,11 +1850,11 @@ _longopt()
--help|--usage|--version)
return
;;
- --*dir*)
+ --!(no-*)dir*)
_filedir -d
return
;;
- --*file*|--*path*)
+ --!(no-*)@(file|path)*)
_filedir
return
;;
--
1.8.3.1

View File

@ -0,0 +1,12 @@
diff -up bash-completion-1.99/bash_completion~ bash-completion-1.99/bash_completion
--- bash-completion-1.99/bash_completion~ 2012-01-08 01:03:46.000000000 +0200
+++ bash-completion-1.99/bash_completion 2012-01-08 13:50:33.412012530 +0200
@@ -45,7 +45,7 @@ readonly BASH_COMPLETION_COMPAT_DIR
# Blacklisted completions, causing problems with our code.
#
-_blacklist_glob='@(acroread.sh)'
+_blacklist_glob='@()'
# Turn on extended globbing and programmable completion
shopt -s extglob progcomp

BIN
bash-completion-2.8.tar.xz Normal file

Binary file not shown.

112
bash-completion.spec Normal file
View File

@ -0,0 +1,112 @@
#solve build failure with .py files
%define _python_bytecompile_errors_terminate_build 0
Name: bash-completion
Version: 2.8
Release: 8
Epoch: 1
Summary: Completion for bash command
License: GPLv2
URL: https://github.com/scop/bash-completion
Source0: https://github.com/scop/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
Patch0: %{name}-1.99-noblacklist.patch
Patch6000:0001-completions-Makefile-Fix-check-local-in-VPATH-builds.patch
Patch6001:0056-__load_completion-Avoid-bad-array-subscript-on-comma.patch
Patch6002:0059-_xspecs-Declare-as-global-on-bash-4.2.patch
Patch6003:0069-completions-Makefile.am-Use-install-data-hook-not-in.patch
Patch6004:0313-man-Fix-completion-when-failglob-option-is-enabled-2.patch
Patch6005:0352-_longopt-don-t-complete-no-with-file-dirname-arg.patch
Patch6006:0076-ssh-fix-suboption-completion-with-combined-o.patch
Patch6007:0137-badblocks-fix-i-leak.patch
BuildArch: noarch
BuildRequires: gcc autoconf automake
#for test
BuildRequires: dejagnu tcllib python3-pytest >= 3.6
Requires: bash >= 4.1
%description
%{name} is a collection of shell funcionts that can be
used to complete the command of bash.
%package_help
%prep
%autosetup -n %{name}-%{version} -p1
%build
autoreconf -fiv
%configure
%make_build
#copy _filedir in bash_completion to bash_completion.d as this function
#may conflicts with Adobe Reader
sed -ne '/^_filedir\s*(/,/^}/p' bash_completion >>copy_of__filedir
%install
%make_install
install -Dp copy_of__filedir %{buildroot}%{_sysconfdir}/bash_completion.d/copy_of__filedir
%check
export LANG=en_US.UTF-8
make -C completions check
%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS
%exclude %{_datadir}/%{name}/completions/cow*
%config(noreplace) %{_sysconfdir}/profile.d/*.sh
%{_sysconfdir}/bash_completion.d/*
%{_datadir}/%{name}/*
%{_datadir}/cmake/*
%{_datadir}/pkgconfig/%{name}.pc
%files help
%defattr(-,root,root)
%doc CHANGES README.md doc/bash_completion.txt CONTRIBUTING.md
%changelog
* Fri Sep 20 2019 shenyangyang<shenyangyang4@huawei.com> - 1:2.8-8
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:remove a patch
* Sat Aug 31 2019 shenyangyang<shenyangyang4@huawei.com> - 1:2.8-7
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:revise spec
* Tue Aug 20 2019 yaokai<yaokai13@huawei.com> - 1:2.8-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:rename patches
* Tue Jul 09 2019 zhangyujing<zhangyujing1@huawei.com> - 1:2.8-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: backport some bugfix from community
* Tue Apr 16 2019 yuejiayan<yuejiayan@huawei.com> - 1:2.8-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:completions/Makefile: Fix check-local in VPATH builds
__load_completion: Avoid bad array subscript on "commands" ending wit…
_xspecs: Declare as global on bash >= 4.2
completions/Makefile.am: Use install-data-hook, not install-data-local
man: Fix completion when failglob option is enabled (#225)
_longopt: don't complete --no-* with file/dirname arg
* Thu Aug 30 2018 openEuler Buildteam <buildteam@openeuler.org> - 1:2.8-3
- Package init