aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Ramage <ramage.lucas@protonmail.com>2020-01-21 14:31:36 +0000
committerLeo <thinkabit.ukim@gmail.com>2020-01-22 00:01:26 +0100
commit6df0adf0d484d78744dea96e0ac32e56fe7a1b84 (patch)
tree7d3f37a0561809f97c517afd9b57a50fbd249714
parent8ca0c58545fa65a70d9f3c97b9cbdf9f3e02a4c0 (diff)
downloadalpine_aports-6df0adf0d484d78744dea96e0ac32e56fe7a1b84.tar.bz2
alpine_aports-6df0adf0d484d78744dea96e0ac32e56fe7a1b84.tar.xz
alpine_aports-6df0adf0d484d78744dea96e0ac32e56fe7a1b84.zip
main/bash-completion: upgrade to 2.10
-rw-r--r--main/bash-completion/01-generalized-containers.patch88
-rw-r--r--main/bash-completion/02-skip-getconf-test.patch25
-rw-r--r--main/bash-completion/03-skip-iconv-test.patch25
-rw-r--r--main/bash-completion/04-fix-ifupdown.patch158
-rw-r--r--main/bash-completion/05-fix-arp-test.patch28
-rw-r--r--main/bash-completion/APKBUILD30
6 files changed, 8 insertions, 346 deletions
diff --git a/main/bash-completion/01-generalized-containers.patch b/main/bash-completion/01-generalized-containers.patch
deleted file mode 100644
index 9d9ce117e5..0000000000
--- a/main/bash-completion/01-generalized-containers.patch
+++ /dev/null
@@ -1,88 +0,0 @@
1From 5443c819622495fcdc759d5dd4e5c31633eab389 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
3Date: Thu, 2 May 2019 16:57:25 +0300
4Subject: [PATCH] _pnames: adapt for busybox ps, rewrite in pure bash
5
6Closes https://github.com/scop/bash-completion/issues/318
7---
8 bash_completion | 51 ++++++++++++++++++++++++++++++------------
9 test/t/test_killall.py | 4 ++++
10 2 files changed, 41 insertions(+), 14 deletions(-)
11
12diff --git a/bash_completion b/bash_completion
13index 58987a7fc1..bf7d02c753 100644
14--- a/bash_completion
15+++ b/bash_completion
16@@ -1069,23 +1069,46 @@ _pnames()
17 } ||
18 _pnames()
19 {
20+ local -a procs
21 if [[ "$1" == -s ]]; then
22- COMPREPLY=( $(compgen -X '<defunct>' \
23- -W '$(command ps axo comm | command sed -e 1d)' -- "$cur") )
24+ procs=( $(command ps axo comm | command sed -e 1d) )
25 else
26- # FIXME: completes "[kblockd/0]" to "0". Previously it was completed
27- # to "kblockd" which isn't correct either. "kblockd/0" would be
28- # arguably most correct, but killall from psmisc 22 treats arguments
29- # containing "/" specially unless -r is given so that wouldn't quite
30- # work either. Perhaps it'd be best to not complete these to anything
31- # for now.
32- COMPREPLY=( $(compgen -X '<defunct>' -W '$(command ps axo command= | command sed -e \
33- "s/ .*//" -e \
34- "s:.*/::" -e \
35- "s/:$//" -e \
36- "s/^[[(-]//" -e \
37- "s/[])]$//" | sort -u)' -- "$cur") )
38+ local line i=-1 OIFS=$IFS
39+ IFS=$'\n'
40+ local -a psout=( $(command ps axo command=) )
41+ IFS=$OIFS
42+ for line in "${psout[@]}"; do
43+ if [[ $i -eq -1 ]]; then
44+ # First line, see if it has COMMAND column header. For example
45+ # the busybox ps does that, i.e. doesn't respect axo command=
46+ if [[ $line =~ ^(.*[[:space:]])COMMAND([[:space:]]|$) ]]; then
47+ # It does; store its index.
48+ i=${#BASH_REMATCH[1]}
49+ else
50+ # Nope, fall through to "regular axo command=" parsing.
51+ break
52+ fi
53+ else
54+ #
55+ line=${line:$i} # take command starting from found index
56+ line=${line%% *} # trim arguments
57+ procs+=( $line )
58+ fi
59+ done
60+ if [[ $i -eq -1 ]]; then
61+ # Regular axo command= parsing
62+ for line in "${psout[@]}"; do
63+ if [[ $line =~ ^[[(](.+)[])]$ ]]; then
64+ procs+=( ${BASH_REMATCH[1]} )
65+ else
66+ line=${line%% *} # trim arguments
67+ line=${line##@(*/|-)} # trim leading path and -
68+ procs+=( $line )
69+ fi
70+ done
71+ fi
72 fi
73+ COMPREPLY=( $(compgen -X "<defunct>" -W '${procs[@]}' -- "$cur" ) )
74 }
75
76 # This function completes on user IDs
77diff --git a/test/t/test_killall.py b/test/t/test_killall.py
78index 725a16e4d6..136eee7373 100644
79--- a/test/t/test_killall.py
80+++ b/test/t/test_killall.py
81@@ -11,3 +11,7 @@ def test_1(self, completion):
82 @pytest.mark.complete("killall --signal ")
83 def test_2(self, completion):
84 assert all(x in completion for x in "INT KILL TERM".split())
85+
86+ @pytest.mark.complete("killall ")
87+ def test_3(self, completion):
88+ assert "command=" not in completion
diff --git a/main/bash-completion/02-skip-getconf-test.patch b/main/bash-completion/02-skip-getconf-test.patch
deleted file mode 100644
index 8185f793a6..0000000000
--- a/main/bash-completion/02-skip-getconf-test.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 70afc1ed3697c3171a004b7db2f19220117d2862 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
3Date: Tue, 30 Apr 2019 18:04:13 +0300
4Subject: [PATCH] test_getconf: skip if -a doesn't output any POSIX_V*
5
6Refs https://github.com/scop/bash-completion/issues/312
7---
8 test/t/test_getconf.py | 4 +++-
9 1 file changed, 3 insertions(+), 1 deletion(-)
10
11diff --git a/test/t/test_getconf.py b/test/t/test_getconf.py
12index 6f9192d251..96713dbe4c 100644
13--- a/test/t/test_getconf.py
14+++ b/test/t/test_getconf.py
15@@ -14,7 +14,9 @@ def test_2(self, completion):
16 def test_3(self, completion):
17 assert completion
18
19- @pytest.mark.complete("getconf -v ")
20+ @pytest.mark.complete(
21+ "getconf -v ", skipif="! getconf -a 2>&1 | command grep -q ^POSIX_V"
22+ )
23 def test_4(self, completion):
24 assert completion
25
diff --git a/main/bash-completion/03-skip-iconv-test.patch b/main/bash-completion/03-skip-iconv-test.patch
deleted file mode 100644
index 092c4019fd..0000000000
--- a/main/bash-completion/03-skip-iconv-test.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 2cdac1b9f24df62a1fa80c1824ee8524c9b02393 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
3Date: Wed, 1 May 2019 13:42:52 +0300
4Subject: [PATCH] test_iconv: skip option completion if --help fails
5
6Such as on Alpine Linux (musl libc).
7
8Refs https://github.com/scop/bash-completion/issues/312
9---
10 test/t/test_iconv.py | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/test/t/test_iconv.py b/test/t/test_iconv.py
14index dc5f8961a6..2edc439b08 100644
15--- a/test/t/test_iconv.py
16+++ b/test/t/test_iconv.py
17@@ -2,7 +2,7 @@
18
19
20 class TestIconv:
21- @pytest.mark.complete("iconv -")
22+ @pytest.mark.complete("iconv -", skipif="! iconv --help &>/dev/null")
23 def test_1(self, completion):
24 assert completion
25
diff --git a/main/bash-completion/04-fix-ifupdown.patch b/main/bash-completion/04-fix-ifupdown.patch
deleted file mode 100644
index 79ab0ed4b5..0000000000
--- a/main/bash-completion/04-fix-ifupdown.patch
+++ /dev/null
@@ -1,158 +0,0 @@
1From 1e3d3b4d40e3f6c150b9d31965f8b007ef823fc7 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
3Date: Tue, 30 Apr 2019 17:47:18 +0300
4Subject: [PATCH] test: generalize check whether we're being run in a container
5
6Refs https://github.com/scop/bash-completion/issues/312
7---
8 test/t/conftest.py | 26 ++++++++++++++++++++++++--
9 test/t/test_ifdown.py | 4 ++--
10 test/t/test_ifup.py | 4 ++--
11 test/t/test_make.py | 4 ++--
12 test/t/test_man.py | 4 ++--
13 test/t/unit/test_unit_ip_addresses.py | 4 ++--
14 6 files changed, 34 insertions(+), 12 deletions(-)
15
16diff --git a/test/t/conftest.py b/test/t/conftest.py
17index f3c28e30c3..f65856288e 100644
18--- a/test/t/conftest.py
19+++ b/test/t/conftest.py
20@@ -2,6 +2,7 @@
21 import os
22 import re
23 import shlex
24+import subprocess
25 from typing import Iterable, List, Optional, Tuple, Union
26
27 import pexpect
28@@ -442,8 +443,29 @@ def completion(request, bash: pexpect.spawn) -> CompletionResult:
29 return assert_complete(bash, marker.args[0], **marker.kwargs)
30
31
32-def in_docker() -> bool:
33- return os.path.exists("/.dockerenv")
34+def in_container() -> bool:
35+ try:
36+ container = subprocess.check_output(
37+ "virt-what || systemd-detect-virt --container",
38+ stderr=subprocess.DEVNULL,
39+ shell=True,
40+ ).strip()
41+ except subprocess.CalledProcessError:
42+ container = None
43+ if container and container != b"none":
44+ return True
45+ if os.path.exists("/.dockerenv"):
46+ return True
47+ try:
48+ with open("/proc/1/environ", "rb") as f:
49+ # LXC, others?
50+ if any(
51+ x.startswith(b"container=") for x in f.readline().split(b"\0")
52+ ):
53+ return True
54+ except OSError:
55+ pass
56+ return False
57
58
59 class TestUnitBase:
60diff --git a/test/t/test_ifdown.py b/test/t/test_ifdown.py
61index 16447be5f3..e91e4bacd1 100644
62--- a/test/t/test_ifdown.py
63+++ b/test/t/test_ifdown.py
64@@ -1,10 +1,10 @@
65 import pytest
66
67-from conftest import in_docker
68+from conftest import in_container
69
70
71 class TestIfdown:
72- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
73+ @pytest.mark.xfail(in_container(), reason="Probably fails in a container")
74 @pytest.mark.complete("ifdown ")
75 def test_1(self, completion):
76 assert completion
77diff --git a/test/t/test_ifup.py b/test/t/test_ifup.py
78index 62d8eb4ac1..60391e478b 100644
79--- a/test/t/test_ifup.py
80+++ b/test/t/test_ifup.py
81@@ -1,10 +1,10 @@
82 import pytest
83
84-from conftest import in_docker
85+from conftest import in_container
86
87
88 class TestIfup:
89- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
90+ @pytest.mark.xfail(in_container(), reason="Probably fails in a container")
91 @pytest.mark.complete("ifup ")
92 def test_1(self, completion):
93 assert completion
94diff --git a/test/t/test_make.py b/test/t/test_make.py
95index 9c76f83c1d..ae468fa93e 100644
96--- a/test/t/test_make.py
97+++ b/test/t/test_make.py
98@@ -2,7 +2,7 @@
99
100 import pytest
101
102-from conftest import in_docker
103+from conftest import in_container
104
105
106 class TestMake:
107@@ -35,7 +35,7 @@ def test_6(self, bash, completion):
108 os.remove("%s/make/%s" % (bash.cwd, "extra_makefile"))
109
110 @pytest.mark.xfail(
111- in_docker() and os.environ.get("DIST") == "centos6",
112+ in_container() and os.environ.get("DIST") == "centos6",
113 reason="Fails for some unknown reason on CentOS 6, "
114 "even though the behavior appears to be correct",
115 )
116diff --git a/test/t/test_man.py b/test/t/test_man.py
117index 60021d9958..2da3087e55 100644
118--- a/test/t/test_man.py
119+++ b/test/t/test_man.py
120@@ -2,7 +2,7 @@
121
122 import pytest
123
124-from conftest import assert_bash_exec, in_docker
125+from conftest import assert_bash_exec, in_container
126
127
128 @pytest.mark.bashcomp(ignore_env=r"^[+-]MANPATH=")
129@@ -43,7 +43,7 @@ def test_3(self, completion):
130 assert completion == "man/quux.8"
131
132 @pytest.mark.xfail(
133- in_docker() and os.environ.get("DIST") == "centos6",
134+ in_container() and os.environ.get("DIST") == "centos6",
135 reason="TODO: Fails in CentOS for some reason, unknown "
136 "how to trigger same behavior as tests show (is "
137 "different and correct when tried manually, but here "
138diff --git a/test/t/unit/test_unit_ip_addresses.py b/test/t/unit/test_unit_ip_addresses.py
139index cd7a38abc1..8120c88216 100644
140--- a/test/t/unit/test_unit_ip_addresses.py
141+++ b/test/t/unit/test_unit_ip_addresses.py
142@@ -1,6 +1,6 @@
143 import pytest
144
145-from conftest import assert_bash_exec, in_docker
146+from conftest import assert_bash_exec, in_container
147
148
149 @pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
150@@ -41,7 +41,7 @@ def test_3(self, functions, completion):
151 assert completion
152 assert all("." in x for x in completion)
153
154- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
155+ @pytest.mark.xfail(in_container(), reason="Probably fails in a container")
156 @pytest.mark.complete("ia6 ")
157 def test_4(self, functions, completion):
158 """_ip_addresses -6 should complete ipv6 addresses."""
diff --git a/main/bash-completion/05-fix-arp-test.patch b/main/bash-completion/05-fix-arp-test.patch
deleted file mode 100644
index 3b01bbcc7d..0000000000
--- a/main/bash-completion/05-fix-arp-test.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 90ede989622143dc93c9a05a18bc23767c4bff9c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
3Date: Tue, 30 Apr 2019 09:59:19 +0200
4Subject: [PATCH] test_arp: Skip if ARP tables are empty
5
6Skip test_arp if 'arp' yields no output. This e.g. happens when
7the host is not networking-enabled.
8---
9 test/t/test_arp.py | 5 +----
10 1 file changed, 1 insertion(+), 4 deletions(-)
11
12diff --git a/test/t/test_arp.py b/test/t/test_arp.py
13index 35963d754e..0dc117284e 100644
14--- a/test/t/test_arp.py
15+++ b/test/t/test_arp.py
16@@ -1,11 +1,8 @@
17 import pytest
18
19-from conftest import in_docker
20-
21
22 class TestArp:
23- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker")
24- @pytest.mark.complete("arp ")
25+ @pytest.mark.complete("arp ", skipif='test -z "$(arp 2>/dev/null)"')
26 def test_1(self, completion):
27 assert completion
28
diff --git a/main/bash-completion/APKBUILD b/main/bash-completion/APKBUILD
index 7231cd5719..755e3fc95b 100644
--- a/main/bash-completion/APKBUILD
+++ b/main/bash-completion/APKBUILD
@@ -2,7 +2,7 @@
2# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com> 2# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com>
3# Maintainer: Lucas Ramage <ramage.lucas@openmailbox.org> 3# Maintainer: Lucas Ramage <ramage.lucas@openmailbox.org>
4pkgname=bash-completion 4pkgname=bash-completion
5pkgver=2.9 5pkgver=2.10
6pkgrel=0 6pkgrel=0
7pkgdesc="Command-line tab-completion for bash" 7pkgdesc="Command-line tab-completion for bash"
8options="!check" # 7 Tests fail 8options="!check" # 7 Tests fail
@@ -13,12 +13,7 @@ depends="bash"
13makedepends="autoconf automake bc grep iputils musl-utils procps psmisc sed usbutils" 13makedepends="autoconf automake bc grep iputils musl-utils procps psmisc sed usbutils"
14checkdepends="py3-pexpect py3-pytest" 14checkdepends="py3-pexpect py3-pytest"
15subpackages="$pkgname-doc" 15subpackages="$pkgname-doc"
16source="https://github.com/scop/${pkgname}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz 16source="https://github.com/scop/bash-completion/releases/download/$pkgver/bash-completion-$pkgver.tar.xz"
17 01-generalized-containers.patch
18 02-skip-getconf-test.patch
19 03-skip-iconv-test.patch
20 04-fix-ifupdown.patch
21 05-fix-arp-test.patch"
22builddir="$srcdir"/$pkgname-$pkgver 17builddir="$srcdir"/$pkgname-$pkgver
23 18
24# Provided with util-linux and networkmanager: 19# Provided with util-linux and networkmanager:
@@ -45,18 +40,14 @@ _conflicting="
45 40
46prepare() { 41prepare() {
47 cd "$builddir" 42 cd "$builddir"
48 for i in $source; do 43 default_prepare
49 case $i in
50 *.patch) msg $i; patch -p1 -i "$srcdir/$i" || return 1;;
51 esac
52 done
53 44
54 # ifup/down tests are still failing 45 # ifup/down tests are still failing
55 rm $builddir/test/t/test_ifdown.py 46 rm $builddir/test/t/test_ifdown.py
56 rm $builddir/test/t/test_ifup.py 47 rm $builddir/test/t/test_ifup.py
57 sed -i '/test_ifdown.py \\/d' $builddir/test/t/Makefile.am || return 1; 48 sed -i '/test_ifdown.py \\/d' $builddir/test/t/Makefile.am
58 sed -i '/test_ifup.py \\/d' $builddir/test/t/Makefile.am || return 1; 49 sed -i '/test_ifup.py \\/d' $builddir/test/t/Makefile.am
59 autoreconf -fiv || return 1; 50 autoreconf -fiv
60} 51}
61 52
62build() { 53build() {
@@ -74,7 +65,7 @@ build() {
74check() { 65check() {
75 cd "$builddir" 66 cd "$builddir"
76 mkdir ./bin 67 mkdir ./bin
77 ln -sf "$(which pytest-3)" ./bin/pytest 68 ln -sf "$(command -v pytest-3)" ./bin/pytest
78 export PATH="${PATH}:$PWD/bin" 69 export PATH="${PATH}:$PWD/bin"
79 make check 70 make check
80} 71}
@@ -93,9 +84,4 @@ package() {
93 done 84 done
94} 85}
95 86
96sha512sums="e864091196d670699bdb2af3fc40464788e79c932fa564afa7ba34a637aa1583db7dbceab0e7ba6718fac99e9fd2dfb03d1ee51d7cf279d925ad63f60401d7d5 bash-completion-2.9.tar.xz 87sha512sums="d434e0e48b25328e8c6b43ed64e58f56459186434754ee972795edd031ce1864038b53926b218fe06e5b3882682db4dec5101b3124362c0137101d3fa6d87cd7 bash-completion-2.10.tar.xz"
971f7466e7bbc2eea30e75e3dd10819289f1586c2ba9b2a2f5199e4e8af99ed4ec081638e8c8efc6aefd8a8336cb67527b4152c2cd89620b173dfed798268c686c 01-generalized-containers.patch
98540cdc655911912475a48a191061f7a94a550d94ac750b601dc8a21e72ef469890b6416cee8fcb677cdb51b21b6f54742a0dc954b0cea5bc4d0b4adf8af86ec6 02-skip-getconf-test.patch
99a8d145f8b38ed9422426696e2204167e6dacfb03dec09dc7c23e83c9a6295524a9f93be6ac10e0e4a5ca079965dfe542bca11aae392248c7e21c6855a4543d64 03-skip-iconv-test.patch
10097de46d137b6f6b54891a13f8308928854e1bdc33e35808e1aa760514c9d3dbb87bcf2a08db72dc941e68bc3af7a106a81e7159e452823dc07f874d3b8e27b77 04-fix-ifupdown.patch
101262f7b6c654d8be95930c6230b4b9d1add344ef1a60f0c6c81cf46bb104dab3814a96e0fb92e99449cbd086a53ec1169e1db21b45436007710952004895e7a3f 05-fix-arp-test.patch"