mirror of
https://github.com/yann64/haikuports.git
synced 2026-03-19 01:46:00 +01:00
bash_completion: update to version 2.14.0. (#11200)
* Fix completion of "pkgman install" for local files. * Should avoid issues with future updates of the `bash_completion` package (#8157). Albeit it requires that users first manually remove the old `/boot/system/settings/etc/profile.d/bash_completion.sh` file previous to the installation of this package version (then should work OK in the future).
This commit is contained in:
@@ -13,14 +13,23 @@ a daily basis."
|
||||
HOMEPAGE="https://github.com/scop/bash-completion"
|
||||
COPYRIGHT="2006-2020 Debian Project"
|
||||
LICENSE="GNU GPL v2"
|
||||
REVISION="2"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/scop/bash-completion/releases/download/$portVersion/bash-completion-$portVersion.tar.xz"
|
||||
CHECKSUM_SHA256="73a8894bad94dee83ab468fa09f628daffd567e8bef1a24277f1e9a0daf911ac"
|
||||
CHECKSUM_SHA256="5c7494f968280832d6adb5aa19f745a56f1a79df311e59338c5efa6f7285e168"
|
||||
SOURCE_DIR="bash-completion-$portVersion"
|
||||
PATCHES="bash_completion-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="any"
|
||||
|
||||
GLOBAL_WRITABLE_FILES="
|
||||
settings/etc/bash_completion.d directory keep-old
|
||||
settings/etc/profile.d/bash_completion.sh auto-merge # doesn't work, sadly.
|
||||
"
|
||||
USER_SETTINGS_FILES="
|
||||
settings/etc/bash_completion.d directory
|
||||
settings/etc/profile.d/bash_completion.sh
|
||||
"
|
||||
|
||||
PROVIDES="
|
||||
bash_completion = $portVersion
|
||||
"
|
||||
@@ -40,13 +49,6 @@ BUILD_PREREQUIRES="
|
||||
cmd:make
|
||||
"
|
||||
|
||||
GLOBAL_WRITABLE_FILES="
|
||||
settings/etc/profile.d/bash_completion.sh auto-merge
|
||||
"
|
||||
USER_SETTINGS_FILES="
|
||||
settings/etc/profile.d/bash_completion.sh
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
autoreconf -i
|
||||
@@ -1,102 +0,0 @@
|
||||
From c83f6af3e75d67aa7789c5656f872c4b3aaf49cc Mon Sep 17 00:00:00 2001
|
||||
From: Kostadin Damyanov <maxmight@gmail.com>
|
||||
Date: Wed, 23 Sep 2015 22:55:52 +0300
|
||||
Subject: [PATCH] Add pkgman and finddir support
|
||||
|
||||
---
|
||||
completions/Makefile.am | 4 +++-
|
||||
completions/finddir | 17 +++++++++++++++++
|
||||
completions/pkgman | 42 +++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 62 insertions(+), 1 deletion(-)
|
||||
create mode 100644 completions/finddir
|
||||
create mode 100644 completions/pkgman
|
||||
|
||||
diff --git a/completions/Makefile.am b/completions/Makefile.am
|
||||
index 723b42f..6a66739 100644
|
||||
--- a/completions/Makefile.am
|
||||
+++ b/completions/Makefile.am
|
||||
@@ -467,7 +467,9 @@ bashcomp_DATA = 2to3 \
|
||||
_yum \
|
||||
yum-arch \
|
||||
zopfli \
|
||||
- zopflipng
|
||||
+ zopflipng \
|
||||
+ pkgman \
|
||||
+ finddir
|
||||
|
||||
EXTRA_DIST = $(bashcomp_DATA)
|
||||
|
||||
diff --git a/completions/finddir b/completions/finddir
|
||||
new file mode 100644
|
||||
index 0000000..cf7f6e4
|
||||
--- /dev/null
|
||||
+++ b/completions/finddir
|
||||
@@ -0,0 +1,17 @@
|
||||
+_finddir()
|
||||
+{
|
||||
+ local cur words
|
||||
+ _init_completion || return
|
||||
+
|
||||
+ COMPREPLY=()
|
||||
+ cur=${COMP_WORDS[COMP_CWORD]}
|
||||
+
|
||||
+ if [[ "$cur" == -* ]]; then
|
||||
+ COMPREPLY=( $( compgen -W '-l -v' -- "$cur" ) )
|
||||
+ else
|
||||
+ COMPREPLY=( $( compgen -W '$( finddir -l )' -- "$cur" ) )
|
||||
+ fi
|
||||
+
|
||||
+ return 0
|
||||
+} &&
|
||||
+complete -F _finddir finddir
|
||||
diff --git a/completions/pkgman b/completions/pkgman
|
||||
new file mode 100644
|
||||
index 0000000..f1f942f
|
||||
--- /dev/null
|
||||
+++ b/completions/pkgman
|
||||
@@ -0,0 +1,42 @@
|
||||
+_pkgman()
|
||||
+{
|
||||
+ local cur words
|
||||
+ _init_completion || return
|
||||
+
|
||||
+ COMPREPLY=()
|
||||
+ cur=${COMP_WORDS[COMP_CWORD]}
|
||||
+
|
||||
+ local special i
|
||||
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
|
||||
+ if [[ ${words[i]} == @(install|uninstall) ]]; then
|
||||
+ special=${words[i]}
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ if [[ -n $special ]]; then
|
||||
+ case $special in
|
||||
+ install)
|
||||
+ COMPREPLY=( $( compgen -W "$( pkgman search -a -D | awk 'NR>2 { print $2 }' )" -- "$cur" ) )
|
||||
+ return 0
|
||||
+ ;;
|
||||
+ uninstall)
|
||||
+ COMPREPLY=( $( compgen -W "$( pkgman search -a -i | awk 'NR>2 { print $2 }' )" -- "$cur" ) )
|
||||
+ return 0
|
||||
+ ;;
|
||||
+ *)
|
||||
+ return 0
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+
|
||||
+ if [[ "$cur" == -* ]]; then
|
||||
+ COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
|
||||
+ else
|
||||
+ COMPREPLY=( $( compgen -W 'full-sync install search \
|
||||
+ uninstall update add-repo drop-repo list-repos refresh \
|
||||
+ resolve-dependencies' -- "$cur" ) )
|
||||
+ fi
|
||||
+
|
||||
+ return 0
|
||||
+} &&
|
||||
+complete -F _pkgman pkgman
|
||||
--
|
||||
2.30.0
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
From 7a33d288489e6b48ba54b6aa7ac33f4d7f713497 Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sat, 25 May 2024 01:47:20 -0300
|
||||
Subject: Add pkgman and finddir support
|
||||
|
||||
Original patch by: Kostadin Damyanov <maxmight@gmail.com
|
||||
|
||||
Modified to allow auto-completion of `pkgman install` of local .hpkg files.
|
||||
|
||||
diff --git a/completions/Makefile.am b/completions/Makefile.am
|
||||
index 219ea10..e6c2e4b 100644
|
||||
--- a/completions/Makefile.am
|
||||
+++ b/completions/Makefile.am
|
||||
@@ -500,7 +500,9 @@ bashcomp_DATA = 2to3 \
|
||||
_yum \
|
||||
yum-arch \
|
||||
zopfli \
|
||||
- zopflipng
|
||||
+ zopflipng \
|
||||
+ pkgman \
|
||||
+ finddir
|
||||
|
||||
EXTRA_DIST = $(bashcomp_DATA)
|
||||
|
||||
diff --git a/completions/finddir b/completions/finddir
|
||||
new file mode 100644
|
||||
index 0000000..cf7f6e4
|
||||
--- /dev/null
|
||||
+++ b/completions/finddir
|
||||
@@ -0,0 +1,17 @@
|
||||
+_finddir()
|
||||
+{
|
||||
+ local cur words
|
||||
+ _init_completion || return
|
||||
+
|
||||
+ COMPREPLY=()
|
||||
+ cur=${COMP_WORDS[COMP_CWORD]}
|
||||
+
|
||||
+ if [[ "$cur" == -* ]]; then
|
||||
+ COMPREPLY=( $( compgen -W '-l -v' -- "$cur" ) )
|
||||
+ else
|
||||
+ COMPREPLY=( $( compgen -W '$( finddir -l )' -- "$cur" ) )
|
||||
+ fi
|
||||
+
|
||||
+ return 0
|
||||
+} &&
|
||||
+complete -F _finddir finddir
|
||||
diff --git a/completions/pkgman b/completions/pkgman
|
||||
new file mode 100644
|
||||
index 0000000..f8a7628
|
||||
--- /dev/null
|
||||
+++ b/completions/pkgman
|
||||
@@ -0,0 +1,52 @@
|
||||
+_pkgman()
|
||||
+{
|
||||
+ local cur words
|
||||
+ _init_completion || return
|
||||
+
|
||||
+ COMPREPLY=()
|
||||
+ cur=${COMP_WORDS[COMP_CWORD]}
|
||||
+
|
||||
+ local special i
|
||||
+ for (( i=0; i < ${#words[@]}-1; i++ )); do
|
||||
+ if [[ ${words[i]} == @(install|uninstall) ]]; then
|
||||
+ special=${words[i]}
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ if [[ -n $special ]]; then
|
||||
+ case $special in
|
||||
+ install)
|
||||
+ if [ -z "$cur" ]; then
|
||||
+ return 0
|
||||
+ fi
|
||||
+
|
||||
+ # First try with local packages.
|
||||
+ local local_packages=$(compgen -f -X '!*.hpkg' "$cur")
|
||||
+ if [ ! -z "$local_packages" ]; then
|
||||
+ COMPREPLY=( $( compgen -W "$local_packages" -- "$cur" ) )
|
||||
+ else
|
||||
+ COMPREPLY=( $( compgen -W "$( pkgman search -a -D | awk 'NR>2 { print $2 }' )" -- "$cur" ) )
|
||||
+ fi
|
||||
+ return 0
|
||||
+ ;;
|
||||
+ uninstall)
|
||||
+ COMPREPLY=( $( compgen -W "$( pkgman search -a -i | awk 'NR>2 { print $2 }' )" -- "$cur" ) )
|
||||
+ return 0
|
||||
+ ;;
|
||||
+ *)
|
||||
+ return 0
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+
|
||||
+ if [[ "$cur" == -* ]]; then
|
||||
+ COMPREPLY=( $( compgen -W '-h --help' -- "$cur" ) )
|
||||
+ else
|
||||
+ COMPREPLY=( $( compgen -W 'full-sync install search \
|
||||
+ uninstall update add-repo drop-repo list-repos refresh \
|
||||
+ resolve-dependencies' -- "$cur" ) )
|
||||
+ fi
|
||||
+
|
||||
+ return 0
|
||||
+} &&
|
||||
+complete -F _pkgman pkgman
|
||||
--
|
||||
2.45.1
|
||||
|
||||
|
||||
From 66495734b0a5ed9fab03d0955e7271d11d27e5a5 Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Sat, 25 May 2024 01:52:08 -0300
|
||||
Subject: Avoid using package version on paths for bash_completion.sh
|
||||
|
||||
This file ends up under $settingsDir/etc/profile.d, and it won't get
|
||||
automatically updated (location is user writable) when installing
|
||||
newer versions, breaking the auto-complete functionality.
|
||||
|
||||
See haikuports issue #8157.
|
||||
|
||||
diff --git a/bash_completion.sh.in b/bash_completion.sh.in
|
||||
index a3bba6f..7c8d71e 100644
|
||||
--- a/bash_completion.sh.in
|
||||
+++ b/bash_completion.sh.in
|
||||
@@ -7,9 +7,9 @@ if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO
|
||||
[ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then
|
||||
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &&
|
||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
|
||||
- if shopt -q progcomp && [ -r @datadir@/@PACKAGE@/bash_completion ]; then
|
||||
+ if shopt -q progcomp && [ -r `finddir B_SYSTEM_DATA_DIRECTORY`/@PACKAGE@/bash_completion ]; then
|
||||
# Source completion code.
|
||||
- . @datadir@/@PACKAGE@/bash_completion
|
||||
+ . `finddir B_SYSTEM_DATA_DIRECTORY`/@PACKAGE@/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
||||
Reference in New Issue
Block a user