[PATCH v3 3/4] bootstrap: Condense and simplify LINGUAS generation

Glenn Washburn <[email protected]> Wed, 19 Nov 2025 13:49:20 -0600
Newsgroups org.gnu.grub-devel
Message-ID <3678bd68c4b69a0936f2f29003736240a7efca27.1763581254.git.development@efficientek.com>
Remove unnecessary subshells. Loop over autogenerated po files only once.
Use existing LINGUAS created by bootstrap instead of finding po files
again.

Signed-off-by: Glenn Washburn <[email protected]>
---
 bootstrap.conf | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 79d4248c84aa..40e0b0cf47bb 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -113,17 +113,16 @@ bootstrap_epilogue () {
     # languages.
     autogenerated="en@quot en@hebrew de@hebrew en@cyrillic en@greek en@arabic en@piglatin de_CH"
 
-    for x in $autogenerated; do
-      rm -f "po/$x.po";
-    done
-
-    (
-      (
-        cd po && ls *.po| cut -d. -f1
-        for x in $autogenerated; do
-            echo "$x";
-        done
-      ) | sort | uniq | xargs
-    ) >po/LINGUAS
+    {
+      # NOTE: xargs has no POSIX compliant way to avoid running the program
+      # given as an argument when there are no input lines. So ensure that
+      # basename is always run with at least one argument, the empty string,
+      # and ignore the first line of output.
+      ls po/*.po | xargs -L 100 basename -s .po -a "" | tail -n +2
+      for x in $autogenerated; do
+        rm -f "po/$x.po"
+        echo "$x"
+      done
+    } | sort | uniq | xargs >po/LINGUAS
   fi
 }
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel