public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-functions:master commit in: /, functions/
Date: Fri,  2 Aug 2024 23:14:12 +0000 (UTC)	[thread overview]
Message-ID: <1722615674.2e8bbd04cb55163b3d18ab407ffd8be24bf82c6e.sam@gentoo> (raw)

commit:     2e8bbd04cb55163b3d18ab407ffd8be24bf82c6e
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug  2 14:31:54 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  2 16:21:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=2e8bbd04

Move is_subset() to experimental

I'm not yet ready to commit to it being among the core functions for the
inaugural API level.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 functions.sh              | 40 ----------------------------------------
 functions/experimental.sh | 40 ++++++++++++++++++++++++++++++++++++++++
 test-functions            |  2 +-
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/functions.sh b/functions.sh
index a002e54..69b9bf5 100644
--- a/functions.sh
+++ b/functions.sh
@@ -246,46 +246,6 @@ is_anyof()
 	false
 }
 
-#
-# Collects the intersection of the parameters up to - but not including - a
-# sentinel value then determines whether the resulting set is a subset of the
-# intersection of the remaining parameters. If the SENTINEL variable is set, it
-# shall be taken as the value of the sentinel. Otherwise, the value of the
-# sentinel shall be defined as <hyphen-dash><hyphen-dash>. If the sentinel value
-# is not encountered or if either set is empty then the return value shall be
-# greater than 1.
-#
-is_subset()
-{
-	SENTINEL=${SENTINEL-'--'} awk -f - -- "$@" <<-'EOF'
-	BEGIN {
-		argc = ARGC
-		ARGC = 1
-		for (i = 1; i < argc; i++) {
-			word = ARGV[i]
-			if (word == ENVIRON["SENTINEL"]) {
-				break
-			} else {
-				set1[word]
-			}
-		}
-		if (i == 1 || argc - i < 2) {
-			exit 1
-		}
-		for (i++; i < argc; i++) {
-			word = ARGV[i]
-			set2[word]
-		}
-		for (word in set2) {
-			delete set1[word]
-		}
-		for (word in set1) {
-			exit 1
-		}
-	}
-	EOF
-}
-
 #
 # Considers one or more pathnames and prints the one having the newest
 # modification time. If at least one parameter is provided, all parameters shall

diff --git a/functions/experimental.sh b/functions/experimental.sh
index bbbf0fa..0ca9904 100644
--- a/functions/experimental.sh
+++ b/functions/experimental.sh
@@ -82,6 +82,46 @@ is_interactive()
 	test -t 0 && { true 3>&1; } 2>/dev/null
 }
 
+#
+# Collects the intersection of the parameters up to - but not including - a
+# sentinel value then determines whether the resulting set is a subset of the
+# intersection of the remaining parameters. If the SENTINEL variable is set, it
+# shall be taken as the value of the sentinel. Otherwise, the value of the
+# sentinel shall be defined as <hyphen-dash><hyphen-dash>. If the sentinel value
+# is not encountered or if either set is empty then the return value shall be
+# greater than 1.
+#
+is_subset()
+{
+	SENTINEL=${SENTINEL-'--'} awk -f - -- "$@" <<-'EOF'
+	BEGIN {
+		argc = ARGC
+		ARGC = 1
+		for (i = 1; i < argc; i++) {
+			word = ARGV[i]
+			if (word == ENVIRON["SENTINEL"]) {
+				break
+			} else {
+				set1[word]
+			}
+		}
+		if (i == 1 || argc - i < 2) {
+			exit 1
+		}
+		for (i++; i < argc; i++) {
+			word = ARGV[i]
+			set2[word]
+		}
+		for (word in set2) {
+			delete set1[word]
+		}
+		for (word in set1) {
+			exit 1
+		}
+	}
+	EOF
+}
+
 #
 # Continuously reads lines from the standard input, prepending each with a
 # timestamp before printing to the standard output. Timestamps shall be in the

diff --git a/test-functions b/test-functions
index 8070c8d..43b5320 100755
--- a/test-functions
+++ b/test-functions
@@ -909,7 +909,7 @@ else
 	test_whenceforth || rc=1
 	test_parallel_run || rc=1
 	test_is_anyof || rc=1
-	test_is_subset || rc=1
+	#test_is_subset || rc=1
 	test_trueof_all || rc=1
 	test_trueof_any || rc=1
 	#test_substr || rc=1


             reply	other threads:[~2024-08-02 23:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 23:14 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-11 10:11 [gentoo-commits] proj/gentoo-functions:master commit in: /, functions/ Sam James
2024-07-07  5:55 Sam James
2024-07-07  5:55 Sam James

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=1722615674.2e8bbd04cb55163b3d18ab407ffd8be24bf82c6e.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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