summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-07-07 17:42:54 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-07-07 17:42:54 +0200
commit6b3ed4455d943fca0606a5e2a18e629c6e56a111 (patch)
treec911a17c8cc4e7b3014c098302cd4dd3227a9775
parent9504cd2bf2c83d1c8b2326967836ad2c9f03178c (diff)
downloadluaotfload-6b3ed4455d943fca0606a5e2a18e629c6e56a111.tar.gz
add git metadata to diagnostic info in luaotfload-tool.lua
-rwxr-xr-xluaotfload-tool.lua22
-rw-r--r--mkfilelist34
2 files changed, 50 insertions, 6 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 5a9e08d..3010653 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -928,11 +928,22 @@ do
local verify_files = function (errcnt)
out ("Loading file hashes.")
- local hashes = require (hash_list)
- if not hashes then
- out ("Testing %d files for integrity.", nhashes)
+ local info = require (hash_list)
+ local hashes = info.hashes
+ local notes = info.notes
+ if not hashes or #hashes == 0 then
+ out ("FAILED: cannot read checksums from %s.", hash_list)
+ return 1/0
+ elseif not notes then
+ out ("FAILED: cannot read commit metadata from %s.",
+ hash_list)
return 1/0
end
+
+ out ("Luaotfload revision %s.", notes.revision)
+ out ("Committed by %s.", notes.committer)
+ out ("Timestamp %s.", notes.timestamp)
+
local nhashes = #hashes
out ("Testing %d files for integrity.", nhashes)
for i = 1, nhashes do
@@ -953,14 +964,15 @@ do
errcnt = errcnt + 1
out ("FAILED: checksum mismatch for file %s.",
fname)
- out ("Expected %s, got %s.", canonicalsum, sum)
+ out ("Expected %s.", canonicalsum)
+ out ("Got %s.", sum)
else
out ("Ok, %s passed.", fname)
end
end
end
end
- return errcnt
+ return errcnt, notes
end
actions.diagnose = function (job)
diff --git a/mkfilelist b/mkfilelist
index 756bfe0..72dd59f 100644
--- a/mkfilelist
+++ b/mkfilelist
@@ -23,6 +23,7 @@ local stringformat = string.format
local md5sumhexa = md5.sumhexa
local ioloaddata = io.loaddata
local iosavedata = io.savedata
+local iopopen = io.popen
-----------------------------------------------------------------------
-- settings
@@ -70,6 +71,35 @@ local die = function (...)
os.exit (1)
end
+local gitcmd = "git log -1 \z
+ --format=\"return {\z
+ %n revision = [[%H]],\z
+ %n timestamp = [[%cd]],\z
+ %n committer = [[%cn <%ce>]],\z
+ %n}\" \z
+ --date=iso"
+
+local git_info = function ()
+ --io.write (gitcmd)
+ --io.write "\n"
+ local chan = iopopen (gitcmd)
+ if not chan then
+ die ("this script needs to be run inside \z
+ the luaotfload git repository")
+ end
+
+ local data = chan:read "*all"
+ chan:close ()
+ if data and type (data) == "string" and data ~= "" then
+ data = load (data)
+ if not data then
+ die "cannot parse git information"
+ end
+ return data ()
+ end
+ die "cannot read from pipe"
+end
+
-----------------------------------------------------------------------
-- functionality
-----------------------------------------------------------------------
@@ -103,7 +133,9 @@ end
local main = function ()
local hashes = hash_all ()
- local serialized = table.serialize (hashes, true)
+ local notes = git_info ()
+ local serialized = table.serialize ({ notes = notes,
+ hashes = hashes }, true)
local success = io.savedata (filelist, serialized)
if success == false then
die ("could not write to %s.", filelist)