Github messages for voidlinux
 help / color / mirror / Atom feed
From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: 99-pkglint-subpkgs: simplify and correct
Date: Mon, 07 Dec 2020 13:59:55 +0100	[thread overview]
Message-ID: <20201207125955.oGGd2W88BWo7NE2WWpoaoSU_NqzcY4ZZrL4ETJbC4OY@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-26950@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/26950#issuecomment-739903041

Comment:
I tentative to add this change:
```diff
diff --git a/common/hooks/pre-pkg/99-pkglint-subpkgs.sh b/common/hooks/pre-pkg/99-pkglint-subpkgs.sh
index 53e4e697e2..b932d122b6 100644
--- a/common/hooks/pre-pkg/99-pkglint-subpkgs.sh
+++ b/common/hooks/pre-pkg/99-pkglint-subpkgs.sh
@@ -32,13 +32,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
 }
```

On looping over 100 subpkgs, the new code show a reduction from 286ms to 4ms.

  parent reply	other threads:[~2020-12-07 12:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05  1:41 [PR PATCH] " sgn
2020-12-05  3:44 ` [PR PATCH] [Updated] " sgn
2020-12-07  0:03 ` [PR PATCH] [Closed]: " sgn
2020-12-07  9:03 ` [PR REVIEW] " Piraty
2020-12-07  9:03 ` Piraty
2020-12-07 11:29 ` sgn
2020-12-07 11:34 ` [PR PATCH] [Updated] " sgn
2020-12-07 12:59 ` sgn
2020-12-07 12:59 ` sgn [this message]
2020-12-09 18:29 ` [PR REVIEW] " ericonr
2020-12-10  0:13 ` [PR PATCH] [Updated] " sgn
2020-12-10  0:14 ` [PR REVIEW] " sgn
2020-12-10  0:27 ` ericonr
2020-12-10  0:39 ` [PR PATCH] [Updated] " sgn
2020-12-10 14:23 ` sgn
2020-12-14  2:35 ` [PR PATCH] [Merged]: " sgn

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=20201207125955.oGGd2W88BWo7NE2WWpoaoSU_NqzcY4ZZrL4ETJbC4OY@z \
    --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).