* [PR PATCH] 99-pkglint-subpkgs: replace grep with case..esac
@ 2020-12-14 2:59 sgn
2020-12-30 6:47 ` [PR PATCH] [Closed]: " the-maldridge
0 siblings, 1 reply; 2+ messages in thread
From: sgn @ 2020-12-14 2:59 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
There is a new pull request by sgn against master on the void-packages repository
https://github.com/sgn/void-packages 99-pkglint-speedup
https://github.com/void-linux/void-packages/pull/27137
99-pkglint-subpkgs: replace grep with case..esac
On experience with 100 subpkgs, this change reduces execution time from
284ms to 4ms
A patch file from https://github.com/void-linux/void-packages/pull/27137.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-99-pkglint-speedup-27137.patch --]
[-- Type: text/x-diff, Size: 1477 bytes --]
From 6a86348b811e3a0e8dabc9bfd973fb838bad2c9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Mon, 7 Dec 2020 20:02:47 +0700
Subject: [PATCH] 99-pkglint-subpkgs: replace grep with case..esac
On experience with 100 subpkgs, this change reduces execution time from
284ms to 4ms
---
common/hooks/pre-pkg/99-pkglint-subpkgs.sh | 14 +++++++++-----
1 file 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
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-30 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 2:59 [PR PATCH] 99-pkglint-subpkgs: replace grep with case..esac sgn
2020-12-30 6:47 ` [PR PATCH] [Closed]: " the-maldridge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).