texlive[73518] Master/tlpkg: TLUtils.pm (parse_AddHyphen_line):

commits+karl at tug.org commits+karl at tug.org
Sun Jan 19 23:46:45 CET 2025


Revision: 73518
          https://tug.org/svn/texlive?view=revision&revision=73518
Author:   karl
Date:     2025-01-19 23:46:45 +0100 (Sun, 19 Jan 2025)
Log Message:
-----------
TLUtils.pm (parse_AddHyphen_line): require left/righthyphenmin to be
specified, rather than defaulting to 2/3, since latest hyph-utf8 missed
some settings. Also require non-empty luaspecial, databases, synonyms, name.

tl-update-tlpdb (finish): include commented-out call to
create_language_def, which (along with its siblings) is what invokes
parse_AddHyphen_line.

hyphen-arabic.tlpsrc,
hyphen-farsi.tlpsrc: add 0 for left/righthyphenmin=.

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLUtils.pm
    trunk/Master/tlpkg/bin/tl-update-tlpdb
    trunk/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc
    trunk/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2025-01-19 20:55:58 UTC (rev 73517)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2025-01-19 22:46:45 UTC (rev 73518)
@@ -3677,20 +3677,19 @@
   close(OUTFILE) || warn "close(>$dest) failed: $!";
 }
 
+# 

 sub parse_AddHyphen_line {
   my $line = shift;
   my %ret;
   # default values
-  my $default_lefthyphenmin = 2;
-  my $default_righthyphenmin = 3;
-  $ret{"lefthyphenmin"} = $default_lefthyphenmin;
-  $ret{"righthyphenmin"} = $default_righthyphenmin;
+  my $default_lefthyphenmin = -1;
+  my $default_righthyphenmin = -1;
   $ret{"synonyms"} = [];
   for my $p (quotewords('\s+', 0, "$line")) {
     my ($a, $b) = split /=/, $p;
     if ($a eq "name") {
       if (!$b) {
-        $ret{"error"} = "AddHyphen line needs name=something";
+        $ret{"error"} = "AddHyphen line needs name=something: $line";
         return %ret;
       }
       $ret{"name"} = $b;
@@ -3697,16 +3696,24 @@
       next;
     }
     if ($a eq "lefthyphenmin") {
-      $ret{"lefthyphenmin"} = ( $b ? $b : $default_lefthyphenmin );
+      if (! defined $b) {
+        $ret{"error"} = "AddHyphen line needs lefthyphenmin=something: $line";
+        return %ret;
+      }
+      $ret{"lefthyphenmin"} = $b;
       next;
     }
     if ($a eq "righthyphenmin") {
-      $ret{"righthyphenmin"} = ( $b ? $b : $default_righthyphenmin );
+      if (! defined $b) {
+        $ret{"error"} = "AddHyphen line needs righthyphenmin=something: $line";
+        return %ret;
+      }
+      $ret{"righthyphenmin"} = $b;
       next;
     }
     if ($a eq "file") {
       if (!$b) {
-        $ret{"error"} = "AddHyphen line needs file=something";
+        $ret{"error"} = "AddHyphen line needs file=something: $line ";
         return %ret;
       }
       $ret{"file"} = $b;
@@ -3713,33 +3720,59 @@
       next;
     }
     if ($a eq "file_patterns") {
-        $ret{"file_patterns"} = $b;
-        next;
+      # many are blank in hyph-utf8, don't check.
+      $ret{"file_patterns"} = $b;
+      next;
     }
     if ($a eq "file_exceptions") {
-        $ret{"file_exceptions"} = $b;
-        next;
+      # many are blank in hyph-utf8, don't check.
+      $ret{"file_exceptions"} = $b;
+      next;
     }
     if ($a eq "luaspecial") {
-        $ret{"luaspecial"} = $b;
-        next;
+      if (!$b) {
+        $ret{"error"} = "AddHyphen line needs luaspecial=something: $line";
+        return %ret;
+      }
+      $ret{"luaspecial"} = $b;
+      next;
     }
     if ($a eq "databases") {
+      if (!$b) {
+        $ret{"error"} = "AddHyphen line needs databases=something: $line";
+        return %ret;
+      }
       @{$ret{"databases"}} = split /,/, $b;
       next;
     }
     if ($a eq "synonyms") {
+      if (!$b) {
+        $ret{"error"} = "AddHyphen line needs synonyms=something: $line";
+        return %ret;
+      }
       @{$ret{"synonyms"}} = split /,/, $b;
       next;
     }
     if ($a eq "comment") {
-        $ret{"comment"} = $b;
-        next;
+      $ret{"comment"} = $b;
+      next;
     }
     # should not be reached at all
-    $ret{"error"} = "Unknown language directive $a";
+    $ret{"error"} = "Unknown AddHyphen directive $a: $line";
     return %ret;
   }
+  if (! $ret{"name"}) {
+    $ret{"error"} = "AddHyphen is missing name setting: $a";
+    return %ret;    
+  }
+  if ($ret{"lefthyphenmin"} < 0) {
+    $ret{"error"} = "AddHyphen is missing lefthyphemin setting: $a";
+    return %ret;    
+  }
+  if ($ret{"righthyphenmin"} < 0) {
+    $ret{"error"} = "AddHyphen is missing righthyphemin setting: $a";
+    return %ret;    
+  }
   # this default value couldn't be set earlier
   if (not defined($ret{"databases"})) {
     if (defined $ret{"file_patterns"} or defined $ret{"file_exceptions"}

Modified: trunk/Master/tlpkg/bin/tl-update-tlpdb
===================================================================
--- trunk/Master/tlpkg/bin/tl-update-tlpdb	2025-01-19 20:55:58 UTC (rev 73517)
+++ trunk/Master/tlpkg/bin/tl-update-tlpdb	2025-01-19 22:46:45 UTC (rev 73518)
@@ -143,8 +143,8 @@
 
   if ($opt_no_revision_check) {
     if ($opt_keep_revisions) {
-      copy_revisions_over($oldtlpdb, $newtlpdb);
-      info("$prg: keeping old revisions due to --keep-revisions\n");
+     copy_revisions_over($oldtlpdb, $newtlpdb);
+     info("$prg: keeping old revisions due to --keep-revisions\n");
     } else {
      info("$prg: not checking revisions due to --no-reverse-revision-check\n");
     }
@@ -211,7 +211,7 @@
     }
   }
   if (!$buggy_tlpdb) {
-    finish($newtlpdb, $pkgcount);
+    finish($newtlpdb, $pkgcount); # never returns
   } else {
     # return error to the shell script, it is evaluated in cron.tl!
     return 1;
@@ -704,6 +704,13 @@
 

 sub finish {
   my ($tlpdb,$pkgcount) = @_;
+  
+  # uncommenting this line is the way to test parse_AddHyphen_line and
+  # similar, since that's the only time they are called. Seems like it
+  # would be cleaner to parse them when the *.tlpsrc is read. Someday.
+  #TeXLive::TLUtils::create_language_def($tlpdb, "/tmp/tlut-language.def",
+  #                                      "/dev/null");
+  
   if ($opt_output) {
     if (open(OUT, ">$opt_output")) {
       $tlpdb->writeout(\*OUT);

Modified: trunk/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc	2025-01-19 20:55:58 UTC (rev 73517)
+++ trunk/Master/tlpkg/tlpsrc/hyphen-arabic.tlpsrc	2025-01-19 22:46:45 UTC (rev 73518)
@@ -5,8 +5,8 @@
 longdesc Prevent hyphenation in Arabic.
 execute AddHyphen \
 	name=arabic \
-	lefthyphenmin= \
-	righthyphenmin= \
+	lefthyphenmin=0 \
+	righthyphenmin=0 \
 	file=zerohyph.tex \
 	file_patterns=
 runpattern f texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-ar.tex

Modified: trunk/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc	2025-01-19 20:55:58 UTC (rev 73517)
+++ trunk/Master/tlpkg/tlpsrc/hyphen-farsi.tlpsrc	2025-01-19 22:46:45 UTC (rev 73518)
@@ -5,8 +5,8 @@
 longdesc Prevent hyphenation in Persian.
 execute AddHyphen \
 	name=farsi synonyms=persian \
-	lefthyphenmin= \
-	righthyphenmin= \
+	lefthyphenmin=0 \
+	righthyphenmin=0 \
 	file=zerohyph.tex \
 	file_patterns=
 runpattern f texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-fa.tex



More information about the tex-live-commits mailing list.