[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Update tagging code (9cc15948)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Aug 1 15:26:47 CEST 2019


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/9cc1594872cb6d8b3b47928d49d95a022272a3d4

>---------------------------------------------------------------

commit 9cc1594872cb6d8b3b47928d49d95a022272a3d4
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Aug 1 14:26:47 2019 +0100

    Update tagging code
    
    There are two copyright forms in the repo:
    they are now reasonably predictable!


>---------------------------------------------------------------

9cc1594872cb6d8b3b47928d49d95a022272a3d4
 base/build.lua              | 51 +---------------------------------
 build-config.lua            | 67 ++++++++++++++++++++++++++++++++++++++++-----
 required/amsmath/build.lua  |  2 ++
 required/graphics/build.lua |  2 ++
 4 files changed, 65 insertions(+), 57 deletions(-)

diff --git a/base/build.lua b/base/build.lua
index 4807dacc..293322be 100644
--- a/base/build.lua
+++ b/base/build.lua
@@ -141,56 +141,7 @@ indexstyle = "source2e.ist"
 -- Allow for TU test
 checkconfigs = {"build","config-TU"}
 
--- Detail how to set the version automatically
-function update_tag(file,content,tagname,tagdate)
-  local year = os.date("%Y")
-  if string.match(content,"%% Copyright %d%d%d%d%-%d%d%d%d") then
-    content = string.gsub(content,
-      "Copyright %(C%) (%d%d%d%d)%-%d%d%d%d",
-      "Copyright (C) %1-" .. year)
-  elseif string.match(content,"%% Copyright %(C%) %d%d%d%d\n") then
-    local oldyear = string.match(content,"%% Copyright %(C%) (%d%d%d%d)\n")
-    if not year == oldyear then
-      content = string.gsub(content,
-        "Copyright %(C%) %d%d%d%d",
-        "Copyright (C) " .. oldyear .. "-" .. year)
-    end
-  end
-  if not string.match(file,"%.md$") and not string.match(file,"ltvers.dtx") then
-    -- Stop here for files other than .md
-    return content
-  end
-  local iso = "%d%d%d%d%-%d%d%-%d%d"
-  local tag, rev = string.match(tagname,"^(.*):([^:]*)$")
-  if not tag then
-    tag = tagname
-  end
-  local patch_level = ""
-  if master_branch then
-    if rev then
-      tag = tag .. " patch level " .. rev
-      patch_level = rev
-    end
-  else
-    tag = tag .. " pre-release "
-    if rev then
-      tag = tag .. rev
-      patch_level = "-" .. rev
-    else
-      patch_level = "0"
-    end
-  end
-  if file == "README.md" then
-    return string.gsub(content,
-      "\nRelease " .. iso .. "[^\n]*\n",
-      "\nRelease " .. tag .. "\n")
-  elseif file == "ltvers.dtx" then
-    return string.gsub(content,
-      "\\patch at level{%-?%d}",
-      "\\patch at level{" .. patch_level .. "}")
-  end
-  return content
-end
+update_tag = update_tag_base
 
 function format ()
   local errorlevel = unpack ()
diff --git a/build-config.lua b/build-config.lua
index 5f341aae..a04e883d 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -62,18 +62,71 @@ else
 end
 
 -- Detail how to set the version automatically
+--  Used by base, cyrillic, tools
 function update_tag(file,content,tagname,tagdate)
   local year = os.date("%Y")
-  if string.match(content,"%% Copyright %d%d%d%d%-%d%d%d%d") then
+  if string.match(content,"%% Copyright %(C%) %d%d%d%d%-%d%d%d%d\n") then
     content = string.gsub(content,
-      "Copyright (%d%d%d%d)%-%d%d%d%d",
-      "Copyright %1-" .. year)
-  elseif string.match(content,"%% Copyright %d%d%d%d\n") then
-    local oldyear = string.match(content,"%% Copyright (%d%d%d%d)\n")
+      "Copyright %(C%) (%d%d%d%d)%-%d%d%d%d",
+      "Copyright (C) %1-" .. year)
+  elseif string.match(content,"%% Copyright %(C%) %d%d%d%d\n") then
+    local oldyear = string.match(content,"%% Copyright %(C%) (%d%d%d%d)\n")
     if not year == oldyear then
       content = string.gsub(content,
-        "Copyright %d%d%d%d",
-        "Copyright " .. oldyear .. "-" .. year)
+        "Copyright %(C%) %d%d%d%d",
+        "Copyright (C) " .. oldyear .. "-" .. year)
+    end
+  end
+  if not string.match(file,"%.md$") and not string.match(file,"ltvers.dtx") then
+    -- Stop here for files other than .md
+    return content
+  end
+  local iso = "%d%d%d%d%-%d%d%-%d%d"
+  local tag, rev = string.match(tagname,"^(.*):([^:]*)$")
+  if not tag then
+    tag = tagname
+  end
+  local patch_level = ""
+  if master_branch then
+    if rev then
+      tag = tag .. " patch level " .. rev
+      patch_level = rev
+    end
+  else
+    tag = tag .. " pre-release "
+    if rev then
+      tag = tag .. rev
+      patch_level = "-" .. rev
+    else
+      patch_level = "0"
+    end
+  end
+  if file == "README.md" then
+    return string.gsub(content,
+      "\nRelease " .. iso .. "[^\n]*\n",
+      "\nRelease " .. tag .. "\n")
+  elseif file == "ltvers.dtx" then
+    return string.gsub(content,
+      "\\patch at level{%-?%d}",
+      "\\patch at level{" .. patch_level .. "}")
+  end
+  return content
+end
+
+-- Form used by amsmath, graphics (and similar to LaTeX3)
+function update_tag_ltx(file,content,tagname,tagdate)
+  local year = os.date("%Y")
+  if string.match(content,
+    "Copyright %(C%) %d%d%d%d%-%d%d%d%d [^\n]*LaTeX3? Project") then
+    content = string.gsub(content,
+      "Copyright %(C%) (%d%d%d%d)%-%d%d%d%d ([^\n]*LaTeX3? Project)",
+      "Copyright (C) %1-" .. year .. " %2")
+  elseif string.match(content,"Copyright %(C%) %d%d%d%d LaTeX") then
+    local oldyear = string.match(content,"Copyright %(C%) (%d%d%d%d) LaTeX")
+    if year ~= oldyear then
+      content = string.gsub(content,
+        "Copyright %(C%) %d%d%d%d LaTeX",
+        "Copyright (C) " .. oldyear .. "-" .. year .. " LaTeX")
     end
   end
   if not string.match(file,"%.md$") then
diff --git a/required/amsmath/build.lua b/required/amsmath/build.lua
index 62c6480a..432d34d9 100644
--- a/required/amsmath/build.lua
+++ b/required/amsmath/build.lua
@@ -22,6 +22,8 @@ checkconfigs = {"build","config-TU"}
 -- Load the common settings for the LaTeX2e repo
 dofile (maindir .. "/build-config.lua")
 
+update_tag = update_tag_ltx
+
 -- Find and run the build system
 kpse.set_program_name ("kpsewhich")
 if not release_date then
diff --git a/required/graphics/build.lua b/required/graphics/build.lua
index fca3e5f8..80314ea8 100644
--- a/required/graphics/build.lua
+++ b/required/graphics/build.lua
@@ -20,6 +20,8 @@ docfiles     = {"cat.eps"}
 -- Load the common settings for the LaTeX2e repo
 dofile (maindir .. "/build-config.lua")
 
+update_tag = update_tag_ltx
+
 -- Find and run the build system
 kpse.set_program_name ("kpsewhich")
 if not release_date then





More information about the latex3-commits mailing list