From f7c41b5340fbcb490d12a9a31494e3c7f924fe24 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 5 Aug 2013 22:51:00 +0200 Subject: beta 2013.08.05 22:51 --- scripts/context/lua/mtx-context.lua | 26 ++++++++++++++++++++------ scripts/context/lua/mtx-rsync.lua | 34 +++++++++++++++++++++------------- 2 files changed, 41 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 87ed3475d..3934cec25 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -975,15 +975,29 @@ local obsolete_results = { } local temporary_runfiles = { - "tui", "tua", "tup", "ted", "tes", "top", - "log", "tmp", "run", "bck", "rlg", - "mpt", "mpx", "mpd", "mpo", "mpb", "ctl", - "synctex", "synctex.gz", "pgf", - "prep", + "tui", -- mkii two pass file + "tua", -- mkiv obsolete + "tup", "ted", "tes", -- texexec + "top", -- mkii options file + "log", -- tex log file + "tmp", -- mkii buffer file + "run", -- mkii stub + "bck", -- backup (obsolete) + "rlg", -- resource log + "ctl", -- + "mpt", "mpx", "mpd", "mpo", "mpb", -- metafun + "prep", -- context preprocessed + "synctex", "synctex.gz", -- synctex + "pgf", -- tikz + "aux", "blg", -- bibtex } local persistent_runfiles = { - "tuo", "tub", "top", "tuc" + "tuo", -- mkii two pass file + "tub", -- mkii buffer file + "top", -- mkii options file + "tuc", -- mkiv two pass file + "bbl", -- bibtex } local special_runfiles = { diff --git a/scripts/context/lua/mtx-rsync.lua b/scripts/context/lua/mtx-rsync.lua index 70a82e929..53cabbe4f 100644 --- a/scripts/context/lua/mtx-rsync.lua +++ b/scripts/context/lua/mtx-rsync.lua @@ -92,19 +92,26 @@ else end end -function rsynccommand(origin,target,dryrun,recurse,delete) - local command = "rsync -t -p " +function rsynccommand(origin,target,dryrun,recurse,delete,exclude) + local command = "rsync -t -p" if dryrun then - command = command .. "-n " + command = command .. " -n" end if recurse then - command = command .. "-r " + command = command .. " -r" end - if delete then - if not recurse then - command = command .. "-d " + if type(exclude) == "table" then + for i=1,#exclude do + local e = exclude[i] + if e then + command = command .. ' --exclude "' .. e .. '"' + end end - command = command .. "--delete " + elseif type(exclude) == "string" then + command = command .. " --exclude-from " .. exclude + end + if delete and recurse then + command = command .. " --delete" end return format('%s %s %s',command,origin,target) end @@ -115,7 +122,7 @@ local rsync = scripts.rsync rsync.mode = "command" -function rsync.run(origin,target,message,recurse,delete) +function rsync.run(origin,target,message,recurse,delete,exclude) if type(origin) == "table" then origin = concat(origin,"/") end @@ -133,15 +140,15 @@ function rsync.run(origin,target,message,recurse,delete) report_message(message) end if rsync.mode == "dryrun" then - local command = rsynccommand(origin,target,true,recurse,delete) + local command = rsynccommand(origin,target,true,recurse,delete,exclude) report_dryrun(command.."\n") os.execute(command) elseif rsync.mode == "force" then - local command = rsynccommand(origin,target,false,recurse,delete) + local command = rsynccommand(origin,target,false,recurse,delete,exclude) report_normal(command.."\n") os.execute(command) else - local command = rsynccommand(origin,target,true,recurse,delete) + local command = rsynccommand(origin,target,true,recurse,delete,exclude) report_command(command) end end @@ -161,8 +168,9 @@ function rsync.job(list) local message = li.message local recurse = li.recurse local delete = li.delete + local exclude = li.exclude if origin and #origin > 0 and target and #target > 0 then -- string or table - rsync.run(origin,target,message,recurse,delete) + rsync.run(origin,target,message,recurse,delete,exclude) else report_message("invalid job specification at index %s",i) end -- cgit v1.2.3