Skip to contentSkip to conversation

Improve generating of LINGUAS

PATCH In review Glenn Washburn 2 participants 6 messages Nov 20, 2025 – Nov 22, 2025

lore
Share & tools
lore
#3 lore raw

PATCH v4 3/4 bootstrap: Condense and simplify LINGUAS generation

In reply to Glenn Washburn

Remove unnecessary subshells. Loop over autogenerated po files only once. Use existing LINGUAS created by bootstrap instead of finding po files again.

Add wget as a soft requirement now that we are using bootstrap's code for updating translation files. This should only be needed if updated translations are desired, which is the default. There should be older translation files already, and wget is not necessary if those will suffice.

---
 INSTALL        |  1 +
 bootstrap.conf | 23 +++++++++++------------
 2 files changed, 12 insertions(+), 12 deletions(-)
INSTALL +1 -0
index f49bfdd2d0c5..056e36e06df3 100644
@@ -25,6 +25,7 @@ configuring the GRUB.
 * Flex 2.5.35 or later
 * pkg-config
 * GNU patch
+* wget (for downloading updated translations)
 * Other standard GNU/Unix tools
 * a libc with large file support (e.g. glibc 2.1 or later)
 
bootstrap.conf +11 -12
index 79d4248c84aa..40e0b0cf47bb 100644
@@ -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
 }
Signature · 7 lines
2.34.1


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

PATCH v4 1/4 bootstrap: Run linguas.sh in bootstrap epilogue

In reply to Glenn Washburn

Heretofore, linguas.sh had to be run by the user and a common mistake made when building GRUB was to not run the command. By adding it to the bootstrap epilogue it will by default get run at the end of the bootstrap script. The user no longer needs to remember to run it. If the --skip-po option is passed to bootstrap, do not run linguas.sh. This allows for bootstrap to be run without updating the translations, which might be desired in the future if we track po files so that translations can be used as they were at time of release.

Update INSTALL file to reflect that it is no longer necessary to run linguas.sh. Also, fix a list numbering error.

Fixes 9f73ebd49be (* INSTALL: Document linguas.sh.)
---
 INSTALL        | 17 +++++++----------
 bootstrap.conf |  8 +++++++-
 2 files changed, 14 insertions(+), 11 deletions(-)
INSTALL +7 -10
index 22b68cb6c766..f49bfdd2d0c5 100644
@@ -140,15 +140,12 @@ The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code.
 
-  2. Skip this and following step if you use release tarball and proceed to
-     step 4. If you want translations type `./linguas.sh'.
-  
-  3. Type `./bootstrap'.
+  2. Type `./bootstrap'.
 
      The autogen.sh (called by bootstrap) uses python. By default autodetect
      it, but it can be overridden by setting the PYTHON variable.
 
-  4. Type `./configure' to configure the package for your system.
+  3. Type `./configure' to configure the package for your system.
      If you're using `csh' on an old version of System V, you might
      need to type `sh ./configure' instead to prevent `csh' from trying
      to execute `configure' itself.
@@ -156,19 +153,19 @@ The simplest way to compile this package is:
      Running `configure' takes awhile.  While running, it prints some
      messages telling which features it is checking for.
 
-  6. Type `make' to compile the package.
+  4. Type `make' to compile the package.
 
-  7. Optionally, type `make check' to run any self-tests that come with
+  5. Optionally, type `make check' to run any self-tests that come with
      the package. Note that many of the tests require root privileges in
      order to run.
 
-  8. Type `make install' to install the programs and any data files and
+  6. Type `make install' to install the programs and any data files and
      documentation.
 
-  9. Type `make html' or `make pdf' to generate the html or pdf
+  7. Type `make html' or `make pdf' to generate the html or pdf
      documentation.  Note, these are not built by default.
 
- 10. You can remove the program binaries and object files from the
+  8. You can remove the program binaries and object files from the
      source code directory by typing `make clean'.  To also remove the
      files that `configure' created (so you can compile the package for
      a different kind of computer), type `make distclean'.  There is
bootstrap.conf +7 -1
index 8eff35b45d5d..e894666fd252 100644
@@ -63,7 +63,7 @@ checkout_only_file=
 copy=true
 vc_ignore=
 
-SKIP_PO=t
+SKIP_PO=n
 
 # Build prerequisites
 buildreq="\
@@ -108,4 +108,10 @@ bootstrap_post_import_hook () {
 
 bootstrap_epilogue () {
   mv INSTALL.grub INSTALL
+
+  # Update translation files and create LINGUAS file used to determine
+  # the set of languages used to translate.
+  if [ "x$SKIP_PO" = "xn" ]; then
+    ./linguas.sh
+  fi
 }
Signature · 7 lines
2.34.1


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

PATCH v4 4/4 INSTALL: Fix a grammatical error

In reply to Glenn Washburn

Also, add more documentation mentioning that the tests require a "specially crafted environment" to run. Just running as root is not enough.

---
 INSTALL | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
INSTALL +4 -4
index 056e36e06df3..9d67d4719ed1 100644
@@ -143,8 +143,8 @@ The simplest way to compile this package is:
 
   2. Type `./bootstrap'.
 
-     The autogen.sh (called by bootstrap) uses python. By default autodetect
-     it, but it can be overridden by setting the PYTHON variable.
+     The autogen.sh (called by bootstrap) uses python. By default it is
+     autodetected, but it can be overridden by setting the PYTHON variable.
 
   3. Type `./configure' to configure the package for your system.
      If you're using `csh' on an old version of System V, you might
@@ -157,8 +157,8 @@ The simplest way to compile this package is:
   4. Type `make' to compile the package.
 
   5. Optionally, type `make check' to run any self-tests that come with
-     the package. Note that many of the tests require root privileges in
-     order to run.
+     the package. Note that many of the tests require root privileges and
+     a specially crafted environment in order to run.
 
   6. Type `make install' to install the programs and any data files and
      documentation.
Signature · 7 lines
2.34.1


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

v4 cover Improve generating of LINGUAS

I've seen several times and believe that quite often people building GRUB forget to run linguas.sh to download and setup the build for the external translations. So make setting up LINGUAS happen by default when running bootstrap. If a user does not want to setup LINGUAS it can be skipped by running bootstrap with the existing --skip-po argument. In fact, bootstrap already has functionality that automatically downloads a projects translations, so switch to using that in patch #2. Also it is needed to run some extra code because bootstrap will not add GRUB's autogenerated languages. In patch #3 simplify the LINGUAS generation and patch #4 fixes a couple issues in the INSTALL that is dependent on patch #1.

v4:
* List wget as a soft requirement in INSTALL

v3:
* Fix an issue where basename could be called by xargs with no arguments

v2:
* There wasn't intentionally a v1, but I accidentally created a patch series, and then I realized that patch #2 depends on patch #1.

Glenn

Glenn Washburn (4):
bootstrap: Run linguas.sh in bootstrap epilogue
bootstrap: Migrate linguas.sh into bootstrap.conf
bootstrap: Condense and simplify LINGUAS generation
INSTALL: Fix a grammatical error

 INSTALL        | 26 ++++++++++++--------------
 bootstrap.conf | 21 +++++++++++++++++++--
 2 files changed, 31 insertions(+), 16 deletions(-)

Range-diff against v3:

1:  20d27aed572a = 1:  20d27aed572a bootstrap: Run linguas.sh in bootstrap epilogue
2:  6b6fed0beba3 = 2:  6b6fed0beba3 bootstrap: Migrate linguas.sh into bootstrap.conf
3:  3678bd68c4b6 ! 3:  966d24067f97 bootstrap: Condense and simplify LINGUAS generation

@@ Commit message
Use existing LINGUAS created by bootstrap instead of finding po files again.

+ Add wget as a soft requirement now that we are using bootstrap's code
+ for updating translation files. This should only be needed if updated
+ translations are desired, which is the default. There should be older
+ translation files already, and wget is not necessary if those will
+ suffice.
+
+ ## INSTALL ##
+@@ INSTALL: configuring the GRUB.
+ * Flex 2.5.35 or later
+ * pkg-config
+ * GNU patch
++* wget (for downloading updated translations)
+ * Other standard GNU/Unix tools
+ * a libc with large file support (e.g. glibc 2.1 or later) +
+
## bootstrap.conf ##
@@ bootstrap.conf: bootstrap_epilogue () {
# languages.
4: c74c01d6fd85 = 4: fe15bb1a05bf INSTALL: Fix a grammatical error

Signature · 7 lines
2.34.1


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

PATCH v4 2/4 bootstrap: Migrate linguas.sh into bootstrap.conf

Bootstrap has infrustructure for downloading/updating project po files and generating the LINGUAS file. It uses wget instead of rsync, but provides the same functionality, namely that only po files that have a modification date before the corresponding one on the server will get redownloaded. Bootstrap creates a pristine copy of the po files in po/.reference, so update .gitignore to ignore that directory.

Bootstrap also creates the po/LINGUAS file, but it does not know to add in GRUB's autogenerated po files. So move that code from linguas.sh into the bootstrap epilogue.

---
 bootstrap.conf | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
bootstrap.conf +18 -6
index e894666fd252..79d4248c84aa 100644
@@ -63,8 +63,6 @@ checkout_only_file=
 copy=true
 vc_ignore=
 
-SKIP_PO=n
-
 # Build prerequisites
 buildreq="\
 autoconf   2.64
@@ -109,9 +107,23 @@ bootstrap_post_import_hook () {
 bootstrap_epilogue () {
   mv INSTALL.grub INSTALL
 
-  # Update translation files and create LINGUAS file used to determine
-  # the set of languages used to translate.
-  if [ "x$SKIP_PO" = "xn" ]; then
-    ./linguas.sh
+  if [ "x$SKIP_PO" = "x" ]; then
+    # Generate LINGUAS with all supported languages. Bootstrap will
+    # generate a LINGUAS, but it will not contain the autogenerated
+    # 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
   fi
 }
Signature · 7 lines
2.34.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#5 lore raw
In reply to Glenn Washburn
Quoted 21 lines · Glenn Washburn

I've seen several times and believe that quite often people building GRUB forget to run linguas.sh to download and setup the build for the external translations. So make setting up LINGUAS happen by default when running bootstrap. If a user does not want to setup LINGUAS it can be skipped by running bootstrap with the existing --skip-po argument. In fact, bootstrap already has functionality that automatically downloads a projects translations, so switch to using that in patch #2. Also it is needed to run some extra code because bootstrap will not add GRUB's autogenerated languages. In patch #3 simplify the LINGUAS generation and patch #4 fixes a couple issues in the INSTALL that is dependent on patch #1.

v4:
* List wget as a soft requirement in INSTALL

v3:
* Fix an issue where basename could be called by xargs with no arguments

v2:
* There wasn't intentionally a v1, but I accidentally created a patch series, and then I realized that patch #2 depends on patch #1.

Quoted 7 lines

Glenn

Glenn Washburn (4):
bootstrap: Run linguas.sh in bootstrap epilogue
bootstrap: Migrate linguas.sh into bootstrap.conf
bootstrap: Condense and simplify LINGUAS generation
INSTALL: Fix a grammatical error

For all patches Reviewed-by: Daniel Kiper <[email protected]>...

Daniel

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