diff options
author | Lucas Ramage <ramage.lucas@protonmail.com> | 2019-04-29 03:15:58 +0000 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2019-11-19 22:04:12 +0100 |
commit | c06a24eae55ab0a444b5046ef8ef733dbb565793 (patch) | |
tree | 53892b5d82619ade5c6e4a9f7d630c041362a480 | |
parent | 567df27d4e844160c3350b5ddc43291ad5735b36 (diff) | |
download | aports-c06a24eae55ab0a444b5046ef8ef733dbb565793.tar.bz2 aports-c06a24eae55ab0a444b5046ef8ef733dbb565793.tar.xz |
main/bash-completion: upgrade to 2.9
Latest version now requires pexpect to successfully run checks
Tests for ifup/down are still failing on master so they were removed
See: https://github.com/scop/bash-completion/issues/235
-rw-r--r-- | main/bash-completion/01-generalized-containers.patch | 88 | ||||
-rw-r--r-- | main/bash-completion/02-skip-getconf-test.patch | 25 | ||||
-rw-r--r-- | main/bash-completion/03-skip-iconv-test.patch | 25 | ||||
-rw-r--r-- | main/bash-completion/04-fix-ifupdown.patch | 158 | ||||
-rw-r--r-- | main/bash-completion/05-fix-arp-test.patch | 28 | ||||
-rw-r--r-- | main/bash-completion/APKBUILD | 40 |
6 files changed, 358 insertions, 6 deletions
diff --git a/main/bash-completion/01-generalized-containers.patch b/main/bash-completion/01-generalized-containers.patch new file mode 100644 index 0000000000..9d9ce117e5 --- /dev/null +++ b/main/bash-completion/01-generalized-containers.patch @@ -0,0 +1,88 @@ +From 5443c819622495fcdc759d5dd4e5c31633eab389 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> +Date: Thu, 2 May 2019 16:57:25 +0300 +Subject: [PATCH] _pnames: adapt for busybox ps, rewrite in pure bash + +Closes https://github.com/scop/bash-completion/issues/318 +--- + bash_completion | 51 ++++++++++++++++++++++++++++++------------ + test/t/test_killall.py | 4 ++++ + 2 files changed, 41 insertions(+), 14 deletions(-) + +diff --git a/bash_completion b/bash_completion +index 58987a7fc1..bf7d02c753 100644 +--- a/bash_completion ++++ b/bash_completion +@@ -1069,23 +1069,46 @@ _pnames() + } || + _pnames() + { ++ local -a procs + if [[ "$1" == -s ]]; then +- COMPREPLY=( $(compgen -X '<defunct>' \ +- -W '$(command ps axo comm | command sed -e 1d)' -- "$cur") ) ++ procs=( $(command ps axo comm | command sed -e 1d) ) + else +- # FIXME: completes "[kblockd/0]" to "0". Previously it was completed +- # to "kblockd" which isn't correct either. "kblockd/0" would be +- # arguably most correct, but killall from psmisc 22 treats arguments +- # containing "/" specially unless -r is given so that wouldn't quite +- # work either. Perhaps it'd be best to not complete these to anything +- # for now. +- COMPREPLY=( $(compgen -X '<defunct>' -W '$(command ps axo command= | command sed -e \ +- "s/ .*//" -e \ +- "s:.*/::" -e \ +- "s/:$//" -e \ +- "s/^[[(-]//" -e \ +- "s/[])]$//" | sort -u)' -- "$cur") ) ++ local line i=-1 OIFS=$IFS ++ IFS=$'\n' ++ local -a psout=( $(command ps axo command=) ) ++ IFS=$OIFS ++ for line in "${psout[@]}"; do ++ if [[ $i -eq -1 ]]; then ++ # First line, see if it has COMMAND column header. For example ++ # the busybox ps does that, i.e. doesn't respect axo command= ++ if [[ $line =~ ^(.*[[:space:]])COMMAND([[:space:]]|$) ]]; then ++ # It does; store its index. ++ i=${#BASH_REMATCH[1]} ++ else ++ # Nope, fall through to "regular axo command=" parsing. ++ break ++ fi ++ else ++ # ++ line=${line:$i} # take command starting from found index ++ line=${line%% *} # trim arguments ++ procs+=( $line ) ++ fi ++ done ++ if [[ $i -eq -1 ]]; then ++ # Regular axo command= parsing ++ for line in "${psout[@]}"; do ++ if [[ $line =~ ^[[(](.+)[])]$ ]]; then ++ procs+=( ${BASH_REMATCH[1]} ) ++ else ++ line=${line%% *} # trim arguments ++ line=${line##@(*/|-)} # trim leading path and - ++ procs+=( $line ) ++ fi ++ done ++ fi + fi ++ COMPREPLY=( $(compgen -X "<defunct>" -W '${procs[@]}' -- "$cur" ) ) + } + + # This function completes on user IDs +diff --git a/test/t/test_killall.py b/test/t/test_killall.py +index 725a16e4d6..136eee7373 100644 +--- a/test/t/test_killall.py ++++ b/test/t/test_killall.py +@@ -11,3 +11,7 @@ def test_1(self, completion): + @pytest.mark.complete("killall --signal ") + def test_2(self, completion): + assert all(x in completion for x in "INT KILL TERM".split()) ++ ++ @pytest.mark.complete("killall ") ++ def test_3(self, completion): ++ 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 new file mode 100644 index 0000000000..8185f793a6 --- /dev/null +++ b/main/bash-completion/02-skip-getconf-test.patch @@ -0,0 +1,25 @@ +From 70afc1ed3697c3171a004b7db2f19220117d2862 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> +Date: Tue, 30 Apr 2019 18:04:13 +0300 +Subject: [PATCH] test_getconf: skip if -a doesn't output any POSIX_V* + +Refs https://github.com/scop/bash-completion/issues/312 +--- + test/t/test_getconf.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/test/t/test_getconf.py b/test/t/test_getconf.py +index 6f9192d251..96713dbe4c 100644 +--- a/test/t/test_getconf.py ++++ b/test/t/test_getconf.py +@@ -14,7 +14,9 @@ def test_2(self, completion): + def test_3(self, completion): + assert completion + +- @pytest.mark.complete("getconf -v ") ++ @pytest.mark.complete( ++ "getconf -v ", skipif="! getconf -a 2>&1 | command grep -q ^POSIX_V" ++ ) + def test_4(self, completion): + assert completion + diff --git a/main/bash-completion/03-skip-iconv-test.patch b/main/bash-completion/03-skip-iconv-test.patch new file mode 100644 index 0000000000..092c4019fd --- /dev/null +++ b/main/bash-completion/03-skip-iconv-test.patch @@ -0,0 +1,25 @@ +From 2cdac1b9f24df62a1fa80c1824ee8524c9b02393 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> +Date: Wed, 1 May 2019 13:42:52 +0300 +Subject: [PATCH] test_iconv: skip option completion if --help fails + +Such as on Alpine Linux (musl libc). + +Refs https://github.com/scop/bash-completion/issues/312 +--- + test/t/test_iconv.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/t/test_iconv.py b/test/t/test_iconv.py +index dc5f8961a6..2edc439b08 100644 +--- a/test/t/test_iconv.py ++++ b/test/t/test_iconv.py +@@ -2,7 +2,7 @@ + + + class TestIconv: +- @pytest.mark.complete("iconv -") ++ @pytest.mark.complete("iconv -", skipif="! iconv --help &>/dev/null") + def test_1(self, completion): + assert completion + diff --git a/main/bash-completion/04-fix-ifupdown.patch b/main/bash-completion/04-fix-ifupdown.patch new file mode 100644 index 0000000000..79ab0ed4b5 --- /dev/null +++ b/main/bash-completion/04-fix-ifupdown.patch @@ -0,0 +1,158 @@ +From 1e3d3b4d40e3f6c150b9d31965f8b007ef823fc7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> +Date: Tue, 30 Apr 2019 17:47:18 +0300 +Subject: [PATCH] test: generalize check whether we're being run in a container + +Refs https://github.com/scop/bash-completion/issues/312 +--- + test/t/conftest.py | 26 ++++++++++++++++++++++++-- + test/t/test_ifdown.py | 4 ++-- + test/t/test_ifup.py | 4 ++-- + test/t/test_make.py | 4 ++-- + test/t/test_man.py | 4 ++-- + test/t/unit/test_unit_ip_addresses.py | 4 ++-- + 6 files changed, 34 insertions(+), 12 deletions(-) + +diff --git a/test/t/conftest.py b/test/t/conftest.py +index f3c28e30c3..f65856288e 100644 +--- a/test/t/conftest.py ++++ b/test/t/conftest.py +@@ -2,6 +2,7 @@ + import os + import re + import shlex ++import subprocess + from typing import Iterable, List, Optional, Tuple, Union + + import pexpect +@@ -442,8 +443,29 @@ def completion(request, bash: pexpect.spawn) -> CompletionResult: + return assert_complete(bash, marker.args[0], **marker.kwargs) + + +-def in_docker() -> bool: +- return os.path.exists("/.dockerenv") ++def in_container() -> bool: ++ try: ++ container = subprocess.check_output( ++ "virt-what || systemd-detect-virt --container", ++ stderr=subprocess.DEVNULL, ++ shell=True, ++ ).strip() ++ except subprocess.CalledProcessError: ++ container = None ++ if container and container != b"none": ++ return True ++ if os.path.exists("/.dockerenv"): ++ return True ++ try: ++ with open("/proc/1/environ", "rb") as f: ++ # LXC, others? ++ if any( ++ x.startswith(b"container=") for x in f.readline().split(b"\0") ++ ): ++ return True ++ except OSError: ++ pass ++ return False + + + class TestUnitBase: +diff --git a/test/t/test_ifdown.py b/test/t/test_ifdown.py +index 16447be5f3..e91e4bacd1 100644 +--- a/test/t/test_ifdown.py ++++ b/test/t/test_ifdown.py +@@ -1,10 +1,10 @@ + import pytest + +-from conftest import in_docker ++from conftest import in_container + + + class TestIfdown: +- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") ++ @pytest.mark.xfail(in_container(), reason="Probably fails in a container") + @pytest.mark.complete("ifdown ") + def test_1(self, completion): + assert completion +diff --git a/test/t/test_ifup.py b/test/t/test_ifup.py +index 62d8eb4ac1..60391e478b 100644 +--- a/test/t/test_ifup.py ++++ b/test/t/test_ifup.py +@@ -1,10 +1,10 @@ + import pytest + +-from conftest import in_docker ++from conftest import in_container + + + class TestIfup: +- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") ++ @pytest.mark.xfail(in_container(), reason="Probably fails in a container") + @pytest.mark.complete("ifup ") + def test_1(self, completion): + assert completion +diff --git a/test/t/test_make.py b/test/t/test_make.py +index 9c76f83c1d..ae468fa93e 100644 +--- a/test/t/test_make.py ++++ b/test/t/test_make.py +@@ -2,7 +2,7 @@ + + import pytest + +-from conftest import in_docker ++from conftest import in_container + + + class TestMake: +@@ -35,7 +35,7 @@ def test_6(self, bash, completion): + os.remove("%s/make/%s" % (bash.cwd, "extra_makefile")) + + @pytest.mark.xfail( +- in_docker() and os.environ.get("DIST") == "centos6", ++ in_container() and os.environ.get("DIST") == "centos6", + reason="Fails for some unknown reason on CentOS 6, " + "even though the behavior appears to be correct", + ) +diff --git a/test/t/test_man.py b/test/t/test_man.py +index 60021d9958..2da3087e55 100644 +--- a/test/t/test_man.py ++++ b/test/t/test_man.py +@@ -2,7 +2,7 @@ + + import pytest + +-from conftest import assert_bash_exec, in_docker ++from conftest import assert_bash_exec, in_container + + + @pytest.mark.bashcomp(ignore_env=r"^[+-]MANPATH=") +@@ -43,7 +43,7 @@ def test_3(self, completion): + assert completion == "man/quux.8" + + @pytest.mark.xfail( +- in_docker() and os.environ.get("DIST") == "centos6", ++ in_container() and os.environ.get("DIST") == "centos6", + reason="TODO: Fails in CentOS for some reason, unknown " + "how to trigger same behavior as tests show (is " + "different and correct when tried manually, but here " +diff --git a/test/t/unit/test_unit_ip_addresses.py b/test/t/unit/test_unit_ip_addresses.py +index cd7a38abc1..8120c88216 100644 +--- a/test/t/unit/test_unit_ip_addresses.py ++++ b/test/t/unit/test_unit_ip_addresses.py +@@ -1,6 +1,6 @@ + import pytest + +-from conftest import assert_bash_exec, in_docker ++from conftest import assert_bash_exec, in_container + + + @pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=") +@@ -41,7 +41,7 @@ def test_3(self, functions, completion): + assert completion + assert all("." in x for x in completion) + +- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") ++ @pytest.mark.xfail(in_container(), reason="Probably fails in a container") + @pytest.mark.complete("ia6 ") + def test_4(self, functions, completion): + """_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 new file mode 100644 index 0000000000..3b01bbcc7d --- /dev/null +++ b/main/bash-completion/05-fix-arp-test.patch @@ -0,0 +1,28 @@ +From 90ede989622143dc93c9a05a18bc23767c4bff9c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 30 Apr 2019 09:59:19 +0200 +Subject: [PATCH] test_arp: Skip if ARP tables are empty + +Skip test_arp if 'arp' yields no output. This e.g. happens when +the host is not networking-enabled. +--- + test/t/test_arp.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/test/t/test_arp.py b/test/t/test_arp.py +index 35963d754e..0dc117284e 100644 +--- a/test/t/test_arp.py ++++ b/test/t/test_arp.py +@@ -1,11 +1,8 @@ + import pytest + +-from conftest import in_docker +- + + class TestArp: +- @pytest.mark.xfail(in_docker(), reason="Probably fails in docker") +- @pytest.mark.complete("arp ") ++ @pytest.mark.complete("arp ", skipif='test -z "$(arp 2>/dev/null)"') + def test_1(self, completion): + assert completion + diff --git a/main/bash-completion/APKBUILD b/main/bash-completion/APKBUILD index 52e4cd292e..20e9bd5be5 100644 --- a/main/bash-completion/APKBUILD +++ b/main/bash-completion/APKBUILD @@ -2,17 +2,21 @@ # Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com> # Maintainer: Lucas Ramage <ramage.lucas@openmailbox.org> pkgname=bash-completion -pkgver=2.8 +pkgver=2.9 pkgrel=0 pkgdesc="Command-line tab-completion for bash" url="https://github.com/scop/bash-completion" arch="noarch" license="GPL-2.0-or-later" depends="bash" -depends_dev= -makedepends="$depends_dev" -install="" -source="https://github.com/scop/${pkgname}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz" +makedepends="autoconf automake bc grep iputils musl-utils procps psmisc py3-pytest sed usbutils" +subpackages="$pkgname-doc" +source="https://github.com/scop/${pkgname}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz +01-generalized-containers.patch +02-skip-getconf-test.patch +03-skip-iconv-test.patch +04-fix-ifupdown.patch +05-fix-arp-test.patch" builddir="$srcdir"/$pkgname-$pkgver # Provided with util-linux and networkmanager: @@ -37,6 +41,22 @@ _conflicting=" mount " +prepare() { + cd "$builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir/$i" || return 1;; + esac + done + + # ifup/down tests are still failing + rm $builddir/test/t/test_ifdown.py + rm $builddir/test/t/test_ifup.py + sed -i '/test_ifdown.py \\/d' $builddir/test/t/Makefile.am || return 1; + sed -i '/test_ifup.py \\/d' $builddir/test/t/Makefile.am || return 1; + autoreconf -fiv || return 1; +} + build() { cd "$builddir" ./configure \ @@ -51,6 +71,9 @@ build() { check() { cd "$builddir" + mkdir ./bin + ln -sf "$(which pytest-3)" ./bin/pytest + export PATH="${PATH}:$PWD/bin" make check } @@ -68,4 +91,9 @@ package() { done } -sha512sums="d839ef5a98811a2aade7ebdc0bc84c84a41c74db384f89913b06f3c25add1ba22528ac25392b19d27280685d258c74dcdc11247cbaae5b8d82f2c0b546abc268 bash-completion-2.8.tar.xz" +sha512sums="e864091196d670699bdb2af3fc40464788e79c932fa564afa7ba34a637aa1583db7dbceab0e7ba6718fac99e9fd2dfb03d1ee51d7cf279d925ad63f60401d7d5 bash-completion-2.9.tar.xz +1f7466e7bbc2eea30e75e3dd10819289f1586c2ba9b2a2f5199e4e8af99ed4ec081638e8c8efc6aefd8a8336cb67527b4152c2cd89620b173dfed798268c686c 01-generalized-containers.patch +540cdc655911912475a48a191061f7a94a550d94ac750b601dc8a21e72ef469890b6416cee8fcb677cdb51b21b6f54742a0dc954b0cea5bc4d0b4adf8af86ec6 02-skip-getconf-test.patch +a8d145f8b38ed9422426696e2204167e6dacfb03dec09dc7c23e83c9a6295524a9f93be6ac10e0e4a5ca079965dfe542bca11aae392248c7e21c6855a4543d64 03-skip-iconv-test.patch +97de46d137b6f6b54891a13f8308928854e1bdc33e35808e1aa760514c9d3dbb87bcf2a08db72dc941e68bc3af7a106a81e7159e452823dc07f874d3b8e27b77 04-fix-ifupdown.patch +262f7b6c654d8be95930c6230b4b9d1add344ef1a60f0c6c81cf46bb104dab3814a96e0fb92e99449cbd086a53ec1169e1db21b45436007710952004895e7a3f 05-fix-arp-test.patch" |