diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-02-11 06:42:03 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-02-11 06:42:03 +0100 |
commit | 9e4c3a5390bd101a382ed959f81cd5bce62ed98b (patch) | |
tree | 79b522a98de6066345ca55ad7d0e7252e0ae74fb /scripts | |
parent | d9825168b0fb7b07e315879584487f9d4d9e9494 (diff) | |
download | luaotfload-9e4c3a5390bd101a382ed959f81cd5bce62ed98b.tar.gz |
[status] adapt status script to work on subdirectories
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mkstatus | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/scripts/mkstatus b/scripts/mkstatus index 6e6e375..cc0a62c 100755 --- a/scripts/mkstatus +++ b/scripts/mkstatus @@ -24,11 +24,14 @@ local md5sumhexa = md5.sumhexa local ioloaddata = io.loaddata local iosavedata = io.savedata local iopopen = io.popen +local iowrite = io.write +local lfsisdir = lfs.isdir ----------------------------------------------------------------------- -- settings ----------------------------------------------------------------------- +local verbose = false local filelist = "luaotfload-status.lua" --- result local names = { @@ -56,9 +59,9 @@ local names = { "luaotfload-override.lua", "luaotfload-parsers.lua", "luaotfload-tool.lua", - "mkcharacters", - "mkglyphlist", - "mkstatus", + { "scripts", "mkcharacters", }, + { "scripts", "mkglyphlist", }, + { "scripts", "mkstatus", }, } ----------------------------------------------------------------------- @@ -122,17 +125,38 @@ hash_all = function (list, acc) return hash_all (table.fastcopy (names), { }) end - local fname = list[#list] + local finfo = list[#list] list[#list] = nil - if fname then - local sum = hash_file (fname) - acc[#acc+1] = { fname, sum } + if finfo then + local fpath + if type (finfo) == "table" then + local d, f = finfo [1], finfo [2] + if lfs.isdir (d) then + fpath = file.join (d, f) + else + fpath = f + end + else + fpath = finfo + end + if verbose then + iowrite "ยท md5(" + iowrite (fpath) + end + local sum = hash_file (fpath) + if verbose then + iowrite ") = \"" + iowrite (sum) + iowrite "\"\n" + end + acc[#acc+1] = { fpath, sum } return hash_all (list, acc) end return acc end local main = function () + if arg [1] == "-v" then verbose = true end local hashes = hash_all () local notes = git_info () local serialized = table.serialize ({ notes = notes, |