[latex3-commits] [git/l3build] master: Better install --dry-run (71d05f3)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Jan 3 17:16:14 CET 2018


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/71d05f38cb369fcb32699b8f7ade76143dec7347

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

commit 71d05f38cb369fcb32699b8f7ade76143dec7347
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Wed Jan 3 16:16:14 2018 +0000

    Better install --dry-run
    
    Key point here is that the 'cleanup' step is omitted.
    
    Formatting of data is also improved.
    
    We may wish to make the cleanup step less agressive once an uninstall
    target is available: one might remove only the files matching those to
    be created. (Or is that a bad idea? Aligns with what uninstall should
    do in the first place.)


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

71d05f38cb369fcb32699b8f7ade76143dec7347
 l3build.lua |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/l3build.lua b/l3build.lua
index 5b2fc95..76111f8 100644
--- a/l3build.lua
+++ b/l3build.lua
@@ -2201,22 +2201,26 @@ function install()
   set_program_name("latex")
   local texmfhome = options["texmfhome"] or var_value("TEXMFHOME")
   local installdir = texmfhome .. "/tex/" .. moduledir
-  errorlevel = cleandir(installdir)
-  if errorlevel ~= 0 then
-    return errorlevel
-  end
-  print()
-  for _,i in ipairs(installfiles) do
-    if options["dry-run"] then
-      for _,file in pairs(filelist(unpackdir,i)) do
-        print("Would install " .. file)
+  if options["dry-run"] then
+    print("\n" .. "Installation root: " .. installdir
+      .. "\n" .. "Intallation files:"
+    )
+    for _,filetype in ipairs(installfiles) do
+      for _,file in pairs(filelist(unpackdir,filetype)) do
+        print("- " .. file)
       end
-    else
-      errorlevel = cp(i, unpackdir, installdir)
     end
+  else
+    errorlevel = cleandir(installdir)
     if errorlevel ~= 0 then
       return errorlevel
     end
+    for _,filetype in ipairs(installfiles) do
+      errorlevel = cp(filetype, unpackdir, installdir)
+      if errorlevel ~= 0 then
+        return errorlevel
+      end
+    end
   end
   return 0
 end





More information about the latex3-commits mailing list