Github messages for voidlinux
 help / color / mirror / Atom feed
From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] 99-pkglint-subpkgs: replace grep with case..esac
Date: Mon, 14 Dec 2020 03:59:34 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27137@inbox.vuxu.org> (raw)

[-- 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
 }

             reply	other threads:[~2020-12-14  2:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  2:59 sgn [this message]
2020-12-30  6:47 ` [PR PATCH] [Closed]: " the-maldridge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27137@inbox.vuxu.org \
    --to=sgn@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).