summaryrefslogtreecommitdiff
path: root/scripts/context
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-08-06 00:00:16 +0300
committerMarius <mariausol@gmail.com>2013-08-06 00:00:16 +0300
commit4bdbf185b1a7e0615f7eb8f3fe02bd13f46928c3 (patch)
treeae525f95a50ba76b9e97036f179f4be7584c76fa /scripts/context
parent3db68d82bb4eb24a3beb49bed1bf5c9799b3fcd5 (diff)
downloadcontext-4bdbf185b1a7e0615f7eb8f3fe02bd13f46928c3.tar.gz
beta 2013.08.05 22:51
Diffstat (limited to 'scripts/context')
-rw-r--r--scripts/context/lua/mtx-context.lua26
-rw-r--r--scripts/context/lua/mtx-rsync.lua34
2 files changed, 41 insertions, 19 deletions
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