From 23ae4869772666fc7433ae878159277152cc3c33 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 7 Jul 2013 22:06:16 +0200 Subject: rename mkfilelist to mkstatus --- Makefile | 58 ++++++++++----------- luaotfload-tool.lua | 8 +-- mkfilelist | 147 ---------------------------------------------------- mkstatus | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 180 deletions(-) delete mode 100644 mkfilelist create mode 100644 mkstatus diff --git a/Makefile b/Makefile index 351d51f..4768d75 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,9 @@ OTFL = $(wildcard luaotfload-*.lua) luaotfload-blacklist.cnf GLYPHSCRIPT = mkglyphlist GLYPHSOURCE = glyphlist.txt CHARSCRIPT = mkcharacters -FILESCRIPT = mkfilelist +STATUSSCRIPT = mkstatus -RESOURCESCRIPTS = $(GLYPHSCRIPT) $(CHARSCRIPT) $(FILESCRIPT) +RESOURCESCRIPTS = $(GLYPHSCRIPT) $(CHARSCRIPT) $(STATUSSCRIPT) SCRIPTNAME = luaotfload-tool SCRIPT = $(SCRIPTNAME).lua @@ -25,8 +25,8 @@ DOT = $(GRAPH).dot # Files grouped by generation mode GLYPHS = luaotfload-glyphlist.lua CHARS = luaotfload-characters.lua -FILES = luaotfload-files.lua -RESOURCES = $(GLYPHS) $(CHARS) $(FILES) +STATUS = luaotfload-status.lua +RESOURCES = $(GLYPHS) $(CHARS) $(STATUS) GRAPHED = $(DOTPDF) MAN = $(MANPAGE) COMPILED = $(DOC) @@ -36,20 +36,20 @@ SOURCE = $(DTX) $(MANSOURCE) $(OTFL) README Makefile NEWS $(RESOURCESCRIPTS) # test files TESTDIR = tests -TESTFILES = $(wildcard $(TESTDIR)/*.tex $(TESTDIR)/*.ltx) -TESTFILES_SYS = $(TESTDIR)/systemfonts.tex $(TESTDIR)/fontconfig_conf_reading.tex -TESTFILES_TL = $(filter-out $(TESTFILES_SYS), $(TESTFILES)) +TESTSTATUS = $(wildcard $(TESTDIR)/*.tex $(TESTDIR)/*.ltx) +TESTSTATUS_SYS = $(TESTDIR)/systemfonts.tex $(TESTDIR)/fontconfig_conf_reading.tex +TESTSTATUS_TL = $(filter-out $(TESTSTATUS_SYS), $(TESTSTATUS)) # Files grouped by installation location -SCRIPTFILES = $(SCRIPT) $(OLDSCRIPT) $(RESOURCESCRIPTS) -RUNFILES = $(UNPACKED) $(filter-out $(SCRIPTFILES),$(OTFL)) -DOCFILES = $(DOC) $(DOTPDF) README NEWS -MANFILES = $(MANPAGE) -SRCFILES = $(DTX) Makefile +SCRIPTSTATUS = $(SCRIPT) $(OLDSCRIPT) $(RESOURCESCRIPTS) +RUNSTATUS = $(UNPACKED) $(filter-out $(SCRIPTSTATUS),$(OTFL)) +DOCSTATUS = $(DOC) $(DOTPDF) README NEWS +MANSTATUS = $(MANPAGE) +SRCSTATUS = $(DTX) Makefile # The following definitions should be equivalent -# ALL_FILES = $(RUNFILES) $(DOCFILES) $(SRCFILES) -ALL_FILES = $(GENERATED) $(SOURCE) +# ALL_STATUS = $(RUNSTATUS) $(DOCSTATUS) $(SRCSTATUS) +ALL_STATUS = $(GENERATED) $(SOURCE) # Installation locations FORMAT = luatex @@ -72,7 +72,7 @@ DO_LATEX = latexmk -pdf -e '$$pdflatex = q(lualatex %O %S)' -silent $< >/dev DO_GRAPHVIZ = dot -Tpdf -o $@ $< > /dev/null DO_GLYPHS = $(LUA) $(GLYPHSCRIPT) > /dev/null DO_CHARS = $(LUA) $(CHARSCRIPT) > /dev/null -DO_FILES = $(LUA) $(FILESCRIPT) > /dev/null +DO_STATUS = $(LUA) $(STATUSSCRIPT) > /dev/null DO_DOCUTILS = rst2man $< >$@ 2>/dev/null all: $(GENERATED) @@ -82,7 +82,7 @@ manual: $(MAN) unpack: $(UNPACKED) resources: $(RESOURCES) chars: $(CHARS) -filelist: $(FILES) +status: $(STATUS) ctan: $(CTAN_ZIP) tds: $(TDS_ZIP) world: all ctan @@ -93,8 +93,8 @@ $(GLYPHS): /dev/null $(CHARS): /dev/null $(DO_CHARS) -$(FILES): /dev/null - $(DO_FILES) +$(STATUS): /dev/null + $(DO_STATUS) $(GRAPHED): $(DOT) $(DO_GRAPHVIZ) @@ -114,15 +114,15 @@ $(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP) @zip -9 $@ $^ >/dev/null define run-install -@mkdir -p $(SCRIPTDIR) && cp $(SCRIPTFILES) $(SCRIPTDIR) -@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) -@mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR) -@mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR) -@mkdir -p $(MANDIR) && cp $(MANFILES) $(MANDIR) +@mkdir -p $(SCRIPTDIR) && cp $(SCRIPTSTATUS) $(SCRIPTDIR) +@mkdir -p $(RUNDIR) && cp $(RUNSTATUS) $(RUNDIR) +@mkdir -p $(DOCDIR) && cp $(DOCSTATUS) $(DOCDIR) +@mkdir -p $(SRCDIR) && cp $(SRCSTATUS) $(SRCDIR) +@mkdir -p $(MANDIR) && cp $(MANSTATUS) $(MANDIR) endef $(TDS_ZIP): TEXMFROOT=./tmp-texmf -$(TDS_ZIP): $(ALL_FILES) +$(TDS_ZIP): $(ALL_STATUS) @echo "Making TDS-ready archive $@." @$(RM) -- $@ $(run-install) @@ -131,20 +131,20 @@ $(TDS_ZIP): $(ALL_FILES) .PHONY: install manifest clean mrproper -install: $(ALL_FILES) +install: $(ALL_STATUS) @echo "Installing in '$(TEXMFROOT)'." $(run-install) -check: $(RUNFILES) $(TESTFILES_TL) +check: $(RUNSTATUS) $(TESTSTATUS_TL) @rm -rf var - @for f in $(TESTFILES_TL); do \ + @for f in $(TESTSTATUS_TL); do \ echo "check: luatex $$f"; \ luatex --interaction=batchmode $$f \ > /dev/null || exit $$?; \ done -check-all: $(TESTFILES_SYS) check - @cd $(TESTDIR); for f in $(TESTFILES_SYS); do \ +check-all: $(TESTSTATUS_SYS) check + @cd $(TESTDIR); for f in $(TESTSTATUS_SYS); do \ echo "check: luatex $$f"; \ $(TESTENV) luatex --interaction=batchmode ../$$f \ > /dev/null || exit $$?; \ diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 3010653..79f1c26 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -920,7 +920,7 @@ actions.list = function (job) end do - local hash_list = "luaotfload-files" + local status_file = "luaotfload-status" local out = function (...) logs.names_report (false, 0, "diagnose", ...) @@ -928,15 +928,15 @@ do local verify_files = function (errcnt) out ("Loading file hashes.") - local info = require (hash_list) + local info = require (status_file) local hashes = info.hashes local notes = info.notes if not hashes or #hashes == 0 then - out ("FAILED: cannot read checksums from %s.", hash_list) + out ("FAILED: cannot read checksums from %s.", status_file) return 1/0 elseif not notes then out ("FAILED: cannot read commit metadata from %s.", - hash_list) + status_file) return 1/0 end diff --git a/mkfilelist b/mkfilelist deleted file mode 100644 index 72dd59f..0000000 --- a/mkfilelist +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env texlua ------------------------------------------------------------------------ --- FILE: mkfilelist.lua --- USAGE: ./mkfilelist.lua --- DESCRIPTION: part of the luaotfload package --- REQUIREMENTS: luatex, the lualibs package --- AUTHOR: Philipp Gesang (Phg), --- VERSION: 1.0 --- CREATED: 2013-07-07 14:01:12+0200 ------------------------------------------------------------------------ --- --- This script generates a list of hashes that serves as the input --- for the file integrity check (option --diagnose). md5 is all we can --- assume in Luatex, so it’s really only a superficial test. - -kpse.set_program_name "luatex" - -local md5 = require "md5" - -require "lualibs" - -local stringformat = string.format -local md5sumhexa = md5.sumhexa -local ioloaddata = io.loaddata -local iosavedata = io.savedata -local iopopen = io.popen - ------------------------------------------------------------------------ --- settings ------------------------------------------------------------------------ - -local filelist = "luaotfload-files.lua" --- result - -local names = { - --- only the runtime files and scripts - "luaotfload-auxiliary.lua", - "luaotfload-basics-gen.lua", - "luaotfload-basics-nod.lua", - "luaotfload-characters.lua", - "luaotfload-colors.lua", - "luaotfload-database.lua", - "luaotfload-extralibs.lua", - "luaotfload-features.lua", - "luaotfload-fonts-cbk.lua", - "luaotfload-fonts-def.lua", - "luaotfload-fonts-enc.lua", - "luaotfload-fonts-ext.lua", - "luaotfload-fonts-lua.lua", - "luaotfload-fonts-tfm.lua", - "luaotfload-glyphlist.lua", - "luaotfload-letterspace.lua", - "luaotfload-loaders.lua", - "luaotfload.lua", - "luaotfload-merged.lua", - "luaotfload-override.lua", - "luaotfload-tool.lua", - "luaotfload-typo-krn.lua", - "mkcharacters", - "mkfilelist", - "mkglyphlist", -} - ------------------------------------------------------------------------ --- helpers ------------------------------------------------------------------------ - -local die = function (...) - io.stderr:write "[fatal error]: " - io.stderr:write (stringformat (...)) - io.stderr:write "\naborting.\n" - 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 ------------------------------------------------------------------------ - -local hash_file = function (fname) - if not lfs.isfile (fname) then - die ("cannot find %s.", fname) - end - local raw = ioloaddata (fname) - if not raw then - die ("cannot read from %s.", fname) - end - return md5sumhexa (raw) -end - -local hash_all -hash_all = function (list, acc) - if list == nil then - return hash_all (table.fastcopy (names), { }) - end - - local fname = list[#list] - list[#list] = nil - if fname then - local sum = hash_file (fname) - acc[#acc+1] = { fname, sum } - return hash_all (list, acc) - end - return acc -end - -local main = function () - local hashes = hash_all () - 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) - end - return 0 -end - -return main () - diff --git a/mkstatus b/mkstatus new file mode 100644 index 0000000..97d9f04 --- /dev/null +++ b/mkstatus @@ -0,0 +1,147 @@ +#!/usr/bin/env texlua +----------------------------------------------------------------------- +-- FILE: mkstatus.lua +-- USAGE: ./mkstatus.lua +-- DESCRIPTION: writes the repository state +-- REQUIREMENTS: luatex, the lualibs package +-- AUTHOR: Philipp Gesang (Phg), +-- VERSION: 1.0 +-- CREATED: 2013-07-07 14:01:12+0200 +----------------------------------------------------------------------- +-- +-- This script generates a list of hashes that serves as the input +-- for the file integrity check (option --diagnose). md5 is all we can +-- assume in Luatex, so it’s really only a superficial test. + +kpse.set_program_name "luatex" + +local md5 = require "md5" + +require "lualibs" + +local stringformat = string.format +local md5sumhexa = md5.sumhexa +local ioloaddata = io.loaddata +local iosavedata = io.savedata +local iopopen = io.popen + +----------------------------------------------------------------------- +-- settings +----------------------------------------------------------------------- + +local filelist = "luaotfload-status.lua" --- result + +local names = { + --- only the runtime files and scripts + "luaotfload-auxiliary.lua", + "luaotfload-basics-gen.lua", + "luaotfload-basics-nod.lua", + "luaotfload-characters.lua", + "luaotfload-colors.lua", + "luaotfload-database.lua", + "luaotfload-extralibs.lua", + "luaotfload-features.lua", + "luaotfload-fonts-cbk.lua", + "luaotfload-fonts-def.lua", + "luaotfload-fonts-enc.lua", + "luaotfload-fonts-ext.lua", + "luaotfload-fonts-lua.lua", + "luaotfload-fonts-tfm.lua", + "luaotfload-glyphlist.lua", + "luaotfload-letterspace.lua", + "luaotfload-loaders.lua", + "luaotfload.lua", + "luaotfload-merged.lua", + "luaotfload-override.lua", + "luaotfload-tool.lua", + "luaotfload-typo-krn.lua", + "mkcharacters", + "mkglyphlist", + "mkstatus", +} + +----------------------------------------------------------------------- +-- helpers +----------------------------------------------------------------------- + +local die = function (...) + io.stderr:write "[fatal error]: " + io.stderr:write (stringformat (...)) + io.stderr:write "\naborting.\n" + 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 +----------------------------------------------------------------------- + +local hash_file = function (fname) + if not lfs.isfile (fname) then + die ("cannot find %s.", fname) + end + local raw = ioloaddata (fname) + if not raw then + die ("cannot read from %s.", fname) + end + return md5sumhexa (raw) +end + +local hash_all +hash_all = function (list, acc) + if list == nil then + return hash_all (table.fastcopy (names), { }) + end + + local fname = list[#list] + list[#list] = nil + if fname then + local sum = hash_file (fname) + acc[#acc+1] = { fname, sum } + return hash_all (list, acc) + end + return acc +end + +local main = function () + local hashes = hash_all () + 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) + end + return 0 +end + +return main () + -- cgit v1.2.3