texlive[68496] Master/tlpkg/bin/tl-update-tlpdb: (equal_hashes):

commits+karl at tug.org commits+karl at tug.org
Tue Oct 10 00:06:02 CEST 2023


Revision: 68496
          https://tug.org/svn/texlive?view=revision&revision=68496
Author:   karl
Date:     2023-10-10 00:06:02 +0200 (Tue, 10 Oct 2023)
Log Message:
-----------
(equal_hashes): avoid now-deprecated smartmatch.
Also eliminate special case of ignoring the "date" field,
since we removed catalogue-date from tlpdb quite a
while ago. Fingers crossed.

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tl-update-tlpdb

Modified: trunk/Master/tlpkg/bin/tl-update-tlpdb
===================================================================
--- trunk/Master/tlpkg/bin/tl-update-tlpdb	2023-10-09 21:39:02 UTC (rev 68495)
+++ trunk/Master/tlpkg/bin/tl-update-tlpdb	2023-10-09 22:06:02 UTC (rev 68496)
@@ -12,7 +12,6 @@
 }
 
 use strict; use warnings;
-use experimental qw(smartmatch); # what the heck, see ~~ below
 
 use TeXLive::TLConfig;
 use TeXLive::TLPSRC;
@@ -641,7 +640,7 @@
 sub equal_hashes {
   my ($h1,$h2) = @_;
 
-  # if neither is defined, that's ok.
+  # if both are undef, that's ok.
   return 1 if !defined $h1 && !defined $h2;
   
   # both must be hash references.
@@ -650,13 +649,6 @@
     return 0;
   }
 
-  # must have the same keys (smartmatch operator).
-  if (! (%$h1 ~~ %$h2)) {
-    debug(" keys not equal:", join("|", keys %$h1), " vs. ",
-           join("|", keys %$h2), "\n");
-    return 0;
-  }
-  
   # if they have no keys, they are the same (we won't go through the loop).
   my $ret = (keys %$h1 == 0);
   #
@@ -663,11 +655,6 @@
   for my $k (keys %$h1) {
     #debug(" checking key $k\n");
     
-    # ignore catalogue-date differences. We will eliminate the field
-    # entirely at some point, but there are so many packages that differ
-    # only in catalogue-date, no need to do it all at once.
-    next if $k eq "date"; 
-    
     my $aval = $h1->{$k};
     my $bval = $h2->{$k};
     
@@ -693,6 +680,14 @@
     last if $ret == 0; # as soon as something is not equal, we're done
   }
   
+  # check that h2 doesn't have any keys besides those in h1.
+  for my $k (keys %$h2) {
+    next if exists $h1->{$k};
+    ddebug("  key $k exists in h2 but not h1\n");
+    $ret = 0;
+    last;
+  }
+
   #debug("equal_hashes returns: $ret\n");
   return $ret;
 }



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