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 via email to