diff options
author | Đoàn Trần Công Danh <congdanhqx@gmail.com> | 2020-12-07 13:02:47 +0000 |
---|---|---|
committer | Michael Aldridge <maldridge@VoidLinux.org> | 2020-12-30 06:46:59 +0000 |
commit | bd62ff8580fce869c760a03b6d183da7bb916038 (patch) | |
tree | 0afd0888406cd4ab94a6bdb50d4d4074db2ff131 | |
parent | a2186e18f545c993a7f541caa867f4aa2ee4d87c (diff) | |
download | void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.tar void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.tar.gz void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.tar.bz2 void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.tar.lz void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.tar.xz void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.tar.zst void-packages-bd62ff8580fce869c760a03b6d183da7bb916038.zip |
99-pkglint-subpkgs: replace grep with case..esac
On experience with 100 subpkgs, this change reduces execution time from
284ms to 4ms
Closes: #27137 [via git-merge-pr]
-rw-r--r-- | common/hooks/pre-pkg/99-pkglint-subpkgs.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/common/hooks/pre-pkg/99-pkglint-subpkgs.sh b/common/hooks/pre-pkg/99-pkglint-subpkgs.sh index fd1fee6c445..240d5ef0bc4 100644 --- a/common/hooks/pre-pkg/99-pkglint-subpkgs.sh +++ b/common/hooks/pre-pkg/99-pkglint-subpkgs.sh @@ -38,13 +38,17 @@ hook() { /subpackages/s/.*"//p s/".*//p }' $XBPS_SRCPKGDIR/$pkgname/template | - tr ' ' '\n' | sort)" + tr '\v\t\r\n' ' ')" for s in $subpkgs; do - grep -q "^$s$" <<< "$matches" || - msg_warn "${s}_package() defined but will never be built.\n" + case " $matches " in + *" $s "*) ;; + *) msg_warn "${s}_package() defined but will never be built.\n" ;; + esac done - grep -q "^$pkgname$" <<< "$matches" && - msg_warn "$pkgname is sourcepkg but is in subpackages=.\n" || : + case " $matches " in + *" $pkgname "*) + msg_warn "$pkgname is sourcepkg but is in subpackages=.\n" ;; + esac } |