[latex3-commits] [git/LaTeX3-latex3-latex3] master: Switch to tagging (fce43d6)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Apr 30 16:26:58 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/fce43d68566ecae908edf53c38e2167e7c3e9d67

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

commit fce43d68566ecae908edf53c38e2167e7c3e9d67
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Apr 30 15:04:19 2018 +0100

    Switch to tagging


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

fce43d68566ecae908edf53c38e2167e7c3e9d67
 build-config.lua   |   43 ++++++++++++++++---------------------------
 build.lua          |   12 +++++++++---
 l3kernel/build.lua |   52 ++++++++++++++++++++++++++++++++++++++++++----------
 3 files changed, 67 insertions(+), 40 deletions(-)

diff --git a/build-config.lua b/build-config.lua
index 20e70e8..6025722 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -17,8 +17,9 @@ checksuppfiles  = checksuppfiles  or
     "SpecialCasing.txt",
     "UnicodeData.txt",
   }
+tagfiles = tagfiles or {"*.dtx", "README.md"}
 unpacksuppfiles = unpacksuppfiles or {"docstrip.tex"}
-versionfiles    = versionfiles    or {"*.dtx", "README.md"}
+
 
 packtdszip  = true
 
@@ -32,31 +33,19 @@ if unpacksearch == nil then
 end
 
 -- Detail how to set the version automatically
-setversion_update_line =
-  setversion_update_line or function(line, date, version)
-  local date = string.gsub(date, "%-", "/")
-  -- Replace the identifiers
-  if string.match(line, "^\\def\\ExplFileDate{%d%d%d%d/%d%d/%d%d}%%?$") or
-     string.match(line, "^%%? ?\\date{Released %d%d%d%d/%d%d/%d%d}$") then
-    line = string.gsub(line, "%d%d%d%d/%d%d/%d%d", date)
-  end
-  -- No real regex so do it one type at a time
-  for _,i in pairs({"Class", "File", "Package"}) do
-    if string.match(
-      line,
-      "^\\ProvidesExpl" .. i .. " *{[a-zA-Z0-9%-%.]+}"
-    ) then
-      line = string.gsub(
-        line,
-        "{%d%d%d%d/%d%d/%d%d}",
-        "{" .. string.gsub(date, "%-", "/") .. "}"
-      )
-   end
-  end
-  if string.match(
-    line, "^Release %d%d%d%d/%d%d/%d%d$"
-  ) then
-    line = "Release " .. date
+function update_tag(file,content,tagname,tagdate)
+  local iso = "%d%d%d%d%-%d%d%-%d%d"
+  if string.match(file,"%.dtx$") then
+    content = string.gsub(content,
+      "\n\\ProvidesExpl" .. "(%w+ *{[^}]+} *){" .. iso .. "}",
+      "\n\\ProvidesExpl%1{" .. tagname .. "}")
+    return string.gsub(content,
+      "\n%% \\date{Released " .. iso .. "}\n",
+      "\n%% \\date{Released " .. tagname .. "}\n")
+  elseif string.match(file,"%.md$") then
+    return string.gsub(content,
+      "\nRelease " .. iso .. "\n",
+      "\nRelease " .. tagname .. "\n")
   end
-  return line
+  return content
 end
diff --git a/build.lua b/build.lua
index 018807a..b28f771 100644
--- a/build.lua
+++ b/build.lua
@@ -22,7 +22,7 @@ ctanbundles  = {"l3kernel", "l3packages", "l3experimental"}
 maindir = "."
 
 -- A custom main function
-function main (target)
+function main(target)
   local errorlevel
   if target == "check" then
     errorlevel = call(checkbundles, "check")
@@ -45,8 +45,14 @@ function main (target)
     errorlevel = call(bundles, "setversion")
   elseif target == "unpack" then
     errorlevel = call (bundles, "unpack")
-  elseif target == "version" then
-      version ()
+  elseif target == "tag" then
+    if options["names"] and #options["names"] == 1 then
+        call(ctanbundles,"tag")
+      else
+        print("Tag name required")
+        help()
+        exit(1)
+      end
   else
     help ()
   end
diff --git a/l3kernel/build.lua b/l3kernel/build.lua
index b829854..a82ddaf 100644
--- a/l3kernel/build.lua
+++ b/l3kernel/build.lua
@@ -21,24 +21,52 @@ installfiles =
     "*.cls", "*.sty", "*.tex"
   }
 sourcefiles  = {"*.dtx", "*.ins"}
+tagfiles     =
+  {
+    "*.dtx", "README.md",
+    "interface3.tex", "l3styleguide.tex",
+    "l3syntax-changes.tex", "source3.tex"
+  }
 typesetfiles =
   {
-    "expl3.dtx", "l3docstrip.dtx", "interface3.tex", "l3syntax-changes.tex",
+    "expl3.dtx", "l3docstrip.dtx","interface3.tex", "l3syntax-changes.tex",
     "l3styleguide.tex", "source3.tex"
   }
 typesetskipfiles = {"source3-body.tex"}
 typesetruns      = 3
 unpackfiles      = {"l3.ins"}
-versionfiles     =
-  {
-    "*.dtx", "README.md", "interface3.tex", "l3styleguide.tex",
-    "l3syntax-changes.tex", "source3.tex"
-  }
 
 -- No deps other than the test system
 typesetdeps = {maindir .. "/l3packages/xparse"}
 unpackdeps  = { }
 
+-- Load the common build code
+dofile(maindir .. "/build-config.lua")
+
+-- Detail how to set the version automatically
+function update_tag(file,content,tagname,tagdate)
+  local iso = "%d%d%d%d%-%d%d%-%d%d"
+  if string.match(file,"expl3%.dtx$") then
+    content = string.gsub(content,
+      "\n\\def\\ExplFileDate{" .. iso .. "}\n",
+      "\n\\def\\ExplFileDate{" .. tagname .. "}\n")
+  elseif string.match(file,"l3drivers%.dtx$") then
+    content = string.gsub(content,
+      "\n  ({l3%w+%.def}){" .. iso .. "}",
+      "\n  %1{" .. tagname .. "}")
+  end
+  if string.match(file,"%.dtx$") or string.match(file,"%.tex$") then
+    return string.gsub(content,
+      "\n%% \\date{Released " .. iso .. "}\n",
+      "\n%% \\date{Released " .. tagname .. "}\n")
+  elseif string.match(file, "%.md$") then
+    return string.gsub(content,
+      "\nRelease " .. iso .. "\n",
+      "\nRelease " .. tagname .. "\n")
+  end
+  return contents
+end
+
 function cmdcheck()
   mkdir(localdir)
   cleandir(testdir)
@@ -141,8 +169,14 @@ function main(target, files)
     else
       help()
     end
-  elseif target == "setversion" then
-    errorlevel = setversion()
+  elseif target == "tag" then
+    if options["names"] and #options["names"] == 1 then
+      tag(options["names"][1])
+    else
+      print("Tag name required")
+      help()
+      exit(1)
+    end
   elseif target == "unpack" then
     errorlevel = unpack()
   elseif target == "version" then
@@ -153,8 +187,6 @@ function main(target, files)
   os.exit(errorlevel)
 end
 
--- Load the common build code
-dofile(maindir .. "/build-config.lua")
 
 -- Find and run the build system
 kpse.set_program_name("kpsewhich")





More information about the latex3-commits mailing list